Documentation
¶
Overview ¶
Package pairing keeps the direct messages that a channel with dm_policy "pairing" received from senders not in its allow_from. Such a message is not processed; the channel records the sender here, and the owner approves it in the dashboard, which appends SenderID to the channel's allow_from.
The requests live in pairing.json in the Compa home. Each channel keeps at most MaxPendingPerChannel of them: a new sender beyond that replaces the one seen longest ago. A request whose sender has been silent for Expiry is dropped.
Index ¶
Constants ¶
View Source
const ( // FileName is the store's file in the Compa home. FileName = "pairing.json" // MaxPendingPerChannel bounds the requests kept for one channel. MaxPendingPerChannel = 20 // Expiry is how long a request is kept after its sender's last message. Expiry = 7 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Request ¶
type Request struct {
// Channel is the channel's name in channel_list.
Channel string `json:"channel"`
// SenderID is the value to append to the channel's allow_from: the
// canonical "platform:id" form the allow_from matching accepts.
SenderID string `json:"sender_id"`
// PlatformID is the sender's id on the platform, for display.
PlatformID string `json:"platform_id,omitempty"`
// DisplayName is the name the sender shows on the platform.
DisplayName string `json:"display_name,omitempty"`
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
// Count is how many messages the sender sent while waiting.
Count int `json:"count"`
}
Request is one sender waiting for the owner's approval.
Click to show internal directories.
Click to hide internal directories.