- if newnick.lower() != oldnick.lower():
- self.parent.users[newnick.lower()] = self.parent.users[oldnick.lower()]
- del self.parent.users[oldnick.lower()]
- self.parent.users[newnick.lower()].nickchange(newnick)
- def _gotmode(self, pieces): #TODO parse for ops/voices (at least)
- pass
-
-
- def __debug_cbexception(self, *args):
- if int(self.parent.cfg.get('debug', 'cbexc', default=0)) == 1:
- self.conn.send("PRIVMSG DimeCadmium :%09.3f ^C4^B!!!^B^C CBEXC" % (time.time() % 100000))
- print "%09.3f %s [!] CBEXC %r" % (time.time() % 100000, self.nick, args)
- __import__('traceback').print_exc()
+ if oldnick == self.nick:
+ self.nick = newnick
+ else:
+ if newnick.lower() != oldnick.lower():
+ self.parent.users[newnick.lower()] = self.parent.users[oldnick.lower()]
+ del self.parent.users[oldnick.lower()]
+ self.parent.users[newnick.lower()].nickchange(newnick)
+ def _gotmode(self, pieces):
+ source = pieces[0].split('!')[0][1:]
+ chan = pieces[2]
+ if not chan.startswith("#"): return
+ chan = self.parent.channel(pieces[2])
+ mode = pieces[3]
+ args = pieces[4:]
+
+ adding = True
+ for c in mode:
+ if c == '+':
+ adding = True
+ elif c == '-':
+ adding = False
+ elif c == 'o':
+ if adding:
+ chan.userop(self.parent.user(args.pop(0)))
+ else:
+ chan.userdeop(self.parent.user(args.pop(0)))
+ elif c == 'v':
+ if adding:
+ chan.uservoice(self.parent.user(args.pop(0)))
+ else:
+ chan.userdevoice(self.parent.user(args.pop(0)))
+ else:
+ pass # don't care about other modes
+
+ def _cbexception(self, source, *args, chained=False, **kwargs):
+ if not chained: # skip hooks if we were caused by a hook
+ exc = sys.exception()
+ if self.parent.hasexceptionhook(exc):
+ for callback in self.parent.getexceptionhook(exc):
+ try:
+ callback(self, exc, source, *args, **kwargs)
+ except Exception:
+ self._cbexception('exceptionhook', chained=True, module=callback.__module__, function=callback.__name__, underlying=(source, args, kwargs))
+ if self.parent.cfg.getboolean('debug', 'cbexc'):
+ self.conn.send("PRIVMSG %s :%09.3f \ 34\1f!!! CBEXC\1f\ 3 %s" % (self.parent.cfg.get('debug', 'owner'), time.time() % 100000, source))
+ traceback.print_exc(chain=not chained)
+ self.log('!', "CBEXC %s %r %r" % (source, args, kwargs))