diff --git a/botcmd.py b/botcmd.py index 6976eb6..bab91bc 100644 --- a/botcmd.py +++ b/botcmd.py @@ -109,10 +109,24 @@ def parse((line,irc)): else: if line[3][1:] in authcmds: authcmds.pop(line[3][1:]) + if line[5]=='0': + irc.send('PRIVMSG %s :Register account with NickServ'%line[3][1:]) + elif line[5]=='1': + irc.send('PRIVMSG %s :Identify with NickServ'%line[3][1:]) + else: + irc.send('PRIVMSG %s :WTF, NickServ returned %s'%(line[3][1:],line[5])) trustedlock.release() authcmdlock.release() elif line[1]=='482': irc.send('PRIVMSG %s :Not op'%line[3]) + #elif line[1]=='332' or line[1]=='TOPIC': + # if line[1]=='332': + # ch=line[3] + # tp=' '.join(line[4:])[1:] + # elif line[1]=='TOPIC': + # ch=line[2] + # tp=' '.join(line[3:])[1:] + # #Do the magic here msglock.acquire() if (line[1]=='PRIVMSG' or line[1]=='JOIN') and nick in msgs: @@ -133,7 +147,7 @@ def execcmd(cmdline): def help(cmd): if cmd=='': - return '#echo #op #deop #kick #src #msg #readmsg #help' + return '#echo #op #deop #voice #devoice #kick #src #msg #readmsg #help' elif cmd=='#echo': return '#echo text echo text back' elif cmd=='#op': diff --git a/botcmd.pyc b/botcmd.pyc deleted file mode 100644 index cc4f7e2..0000000 Binary files a/botcmd.pyc and /dev/null differ diff --git a/eliza.pyc b/eliza.pyc deleted file mode 100644 index 75706f8..0000000 Binary files a/eliza.pyc and /dev/null differ diff --git a/ircbot.py b/ircbot.py index 38812c9..98f3075 100644 --- a/ircbot.py +++ b/ircbot.py @@ -48,8 +48,23 @@ class Connhandler(threading.Thread): self.logc.send(line+'\n') Threadwrapper(botcmd.parse,(line,self.inpc)).start() def run(self): - self.sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.connect((self.server,self.port)) + self.sock=None + for af, socktype, proto, canonname, sa in socket.getaddrinfo(self.server,self.port,socket.AF_UNSPEC,socket.SOCK_STREAM): + try: + self.sock=socket.socket(af, socktype, proto) + except socket.error: + self.sock=None + conntinue + try: + self.sock.connect(sa) + except socket.error: + self.sock.close() + self.sock=None + continue + break + if self.sock is None: + self.logc.send('QUIT'); + sys.exit(1); self.sock.settimeout(0.1) self.send('NICK %s'%self.nick)