Documentation ¶
Index ¶
- func NewConn(server, channel, userTelegram string, backup bool, h func(e *event)) (*ircconn, error)
- type IRCMessage
- type Manager
- func (m *Manager) Event(e *event)
- func (m *Manager) MarkDead(i *ircconn)
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) SendMessage(ctx context.Context, user, text string) error
- func (m *Manager) Subscribe(c chan *Notification)
- func (m *Manager) UpdateNickmap(conn *ircconn, nick string)
- type Notification
- type NotificationMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IRCMessage ¶
type IRCMessage struct {
// contains filtered or unexported fields
}
ircMessage is a message received on IRC by a connection, sent over to the Manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager maintains a set of IRC connections to a server and channel. Its has three interfaces to the outside world:
- control, from the owner of Manager (eg. a bridge to another protocol) that allows sending messages as a given user and to subscribe to notifications
- events, from IRC connections, to update the manager about a connection state (lifecycle or nick change)
- subscriptions, that pass received messages from IRC to a channel requested by control.
The Manager will maintain exactly one 'receiver', which is an IRC connection that is used as a source of truth for messages on an IRC channel. This will either be an existing connection for a user, or a 'backup' connection that will close as soon as a real/named connection exists and is fully connected.
func (*Manager) MarkDead ¶
func (m *Manager) MarkDead(i *ircconn)
Event: mark a given connection as dead.
func (*Manager) Run ¶
Run maintains the main logic of the Manager - servicing control and event messages, and ensuring there is a receiver on the given channel.
func (*Manager) SendMessage ¶
Control: send a message to IRC.
func (*Manager) Subscribe ¶
func (m *Manager) Subscribe(c chan *Notification)
Control: subscribe to notifiactions.
type Notification ¶
type Notification struct { // A new message appeared on the channel Message *NotificationMessage // Nicks of our connections have changed Nickmap *map[string]string }
Notifications are sent to subscribers when things happen on IRC