func OnConnect(event string, serv *bot.Server, msg *bot.Message) { if *nsid != "" { serv.WriteMessage(bot.NewMessage("", bot.CMD_PRIVMSG, "NickServ", "IDENTIFY "+*nsid)) time.Sleep(3) } serv.WriteMessage(bot.NewMessage("", "JOIN", *channel)) }
func OnDisconnect(event string, serv *bot.Server, msg *bot.Message) { server, pass := serv.Name(), servers[serv.Name()] log.Printf("Server %q disconnected.", server) time.Sleep(*delay) for { log.Printf("Recnnecting to %q...", server) if err := serv.Bot().ConnectPass(server, pass); err != nil { log.Printf("connect: %s", err) time.Sleep(*rdelay) continue } break } }
func delServer(event string, serv *bot.Server, msg *bot.Message) { servers.Lock() defer servers.Unlock() delete(servers.m, serv.Name()) }
func addServer(event string, serv *bot.Server, msg *bot.Message) { servers.Lock() defer servers.Unlock() servers.m[serv.Name()] = serv }