def dispatchCommands(evname, net, message): commandchar=config.get('Networks/'+net.name+'/Channels/'+message.parameters[0]+'/CommandChar') if commandchar is None: commandchar=config.get('Networks/'+net.name+'/CommandChar') if commandchar is None: commandchar=config.get('CommandChar', '!') if message.parameters[-1].startswith('?trigger'): message.reply("This bots current trigger is "+commandchar) return #if not message.parameters[-1].startswith(commandchar): return match=re.match(r'^'+commandchar+r'(\S+)(?:\s+(.*))?$', message.parameters[-1]) if not match: return event.trigger("Command/"+match.group(1).upper(), net=net, message=message, args=parseArguments(match.group(2)))
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 sendNickServ(evname, net, message): global sendPass if not net.name in sendPass: sendPass[net.name] = 0 #log.edebug("sendPass="******"NICKSERV:"+str(config.get("Networks/"+net.name+"/NickServ"))) #Displays nickserv config entry for debugging purposes. if config.get("Networks/"+net.name+"/NickServ") is None: consoleMessage(net.name, "No NickServ entry found in config for "+net.name+" - Bypassing NickServ module.") event.trigger("Network/Event/AutoJoin", net) sendPass[net.name] = 2 return if config.get("Networks/"+net.name+"/NickServ") == "": consoleMessage(net.name, "NickServ entry for "+net.name+" is blank. - Bypassing NickServ module.") event.trigger("Network/Event/AutoJoin", net) sendPass[net.name] = 2 return chkMessage = str(message).split(":",1) if len(chkMessage) < 2: return chkMessage = str(chkMessage[1]).split("!",1) #log.edebug("chkMessage="+str(chkMessage[0])) #Displays chkMessage for debugging purposes. if str(chkMessage[0]) == "NickServ": if sendPass[net.name] == 1: event.trigger("Network/Event/AutoJoin", net) return consoleMessage(net.name, "NickServ entry found in fwee.conf for "+net.name) consoleMessage(net.name, "Sending NickServ password...") net.send("PRIVMSG NickServ :"+config.get("Networks/"+net.name+"/NickServ")+"\r\n") sendPass[net.name] = 1 if str(chkMessage[0]) == "AuthServ": if sendPass[net.name] == 1: event.trigger("Network/Event/AutoJoin", net) return consoleMessage(net.name, "NickServ entry found in fwee.conf for "+net.name) consoleMessage(net.name, "Sending AuthServ password...") net.send("PRIVMSG AuthServ :"+config.get("Networks/"+net.name+"/NickServ")+"\r\n") sendPass[net.name] = 1