def setRegistered(evname, net, message): if not net.authenticated: log.info("Registered with %s", net.name) net.authenticated=True if message.command=='001': net.nick=message.parameters[0] event.trigger('Network/Authenticated/'+net.name, net=net)
def sendAuthentication(evname, net, server): log.info("%s: connected to %s/%s", net.name, server[0], server[1]) passwd=config.get('Networks/'+net.name+'/Password', None) if passwd: net.sendf("PASS %s\r\n", passwd) net.sendf("NICK %s\r\n", config.get('Networks/'+net.name+'/Nick', core.NAME)) net.sendf("USER %s %d * :%s\r\n", config.get('Networks/'+net.name+'/Ident', core.NAME), config.get('Networks/'+net.name+'/InitModes', 0), config.get('Networks/'+net.name+'/Realname', "%s v%s"%(core.NAME, core.VERSION)) )
def handleChannelUserChange(evname, net, message): if message.command=='JOIN': chan=Channel.add(net, message.parameters[0]) if net.isFromMe(message.fromnick): log.edebug("I just joined %s", message.parameters[0]) else: log.info("%s: %s joined %s", net.name, message.fromnick, message.parameters[0]) chan.addUser(message.fromnick.split("!")[0]) elif message.command=='PART' or message.command=='QUIT': log.info("%s: %s left %s: %s: %s", net.name, message.fromnick, message.parameters[0], message.command, message.parameters[-1]) chan=Channel.add(net, message.parameters[0]) chan.removeUser(message.fromnick.split("!")[0]) elif message.command=='KICK': log.info("%s: %s kicked %s from %s: %s", net.name, message.fromnick, message.parameters[1], message.parameters[0], message.parameters[-1]) chan=Channel.add(net, message.parameters[0]) chan.removeUser(message.parameters[1]) elif message.command=='353': #2011-08-21 11:24:44 [EDEBUG ]: [<<<Local] :irc.local 353 fwee = #test :@alec fwee [in /home/alec/Desktop/fweebot/modules/fweebot.py/printmsgs(), line 56] chan=Channel.add(net, message.parameters[2]) for name in message.parameters[3].split(): chan.addUser(name) elif core.DEBUG and message.command=='366': chan=Channel.add(net, message.parameters[1])
def handleDisconnect(evname, net, reason="Could not connect"): log.error("Disconnected from network %s: %s", net.name, reason) if net.reconnect is not None: log.info("%s: reconnecting in %ds", net.name, net.reconnect) event.schedule(net.connect, delay=net.reconnect, count=1)