MCPcopy
hub / github.com/42wim/matterbridge / doConnect

Method doConnect

bridge/irc/irc.go:191–211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189}
190
191func (b *Birc) doConnect() {
192 for {
193 if err := b.i.Connect(); err != nil {
194 b.Log.Errorf("disconnect: error: %s", err)
195 if b.FirstConnection {
196 b.connected <- err
197 return
198 }
199 } else {
200 b.Log.Info("disconnect: client requested quit")
201 }
202 b.Log.Info("reconnecting in 30 seconds...")
203 time.Sleep(30 * time.Second)
204 b.i.Handlers.Clear(girc.RPL_WELCOME)
205 b.i.Handlers.Add(girc.RPL_WELCOME, func(client *girc.Client, event girc.Event) {
206 b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: "", Account: b.Account, Event: config.EventRejoinChannels}
207 // set our correct nick on reconnect if necessary
208 b.Nick = event.Source.Name
209 })
210 }
211}
212
213// Sanitize nicks for RELAYMSG: replace IRC characters with special meanings with "-"
214func sanitizeNick(nick string) string {

Callers 1

ConnectMethod · 0.95

Calls 1

ConnectMethod · 0.65

Tested by

no test coverage detected