Example #1
0
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))
}
Example #2
0
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
	}
}
Example #3
0
func delServer(event string, serv *bot.Server, msg *bot.Message) {
	servers.Lock()
	defer servers.Unlock()

	delete(servers.m, serv.Name())
}
Example #4
0
func addServer(event string, serv *bot.Server, msg *bot.Message) {
	servers.Lock()
	defer servers.Unlock()

	servers.m[serv.Name()] = serv
}