diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..cc7f102 --- /dev/null +++ b/.mailmap @@ -0,0 +1,2 @@ +James Lu +James Lu diff --git a/classes.py b/classes.py index 8db6287..9b89f46 100644 --- a/classes.py +++ b/classes.py @@ -50,6 +50,8 @@ class Irc(): self.connected = threading.Event() self.aborted = threading.Event() + self.initVars() + if world.testing: # HACK: Don't thread if we're running tests. self.connect() @@ -162,7 +164,6 @@ class Irc(): __init__ in a separate thread to allow multiple concurrent connections. """ while True: - self.initVars() ip = self.serverdata["ip"] port = self.serverdata["port"] checks_ok = True @@ -296,6 +297,9 @@ class Irc(): log.debug('(%s) _disconnect: Setting self.aborted to True.', self.name) self.aborted.set() + log.debug('(%s) disconnect: Clearing state via initVars().', self.name) + self.initVars() + log.debug('(%s) Removing channel logging handlers due to disconnect.', self.name) while self.loghandlers: log.removeHandler(self.loghandlers.pop()) diff --git a/utils.py b/utils.py index 72947d8..1db3714 100644 --- a/utils.py +++ b/utils.py @@ -214,12 +214,18 @@ def parseModes(irc, target, args): args = args[1:] if usermodes: log.debug('(%s) Using irc.umodes for this query: %s', irc.name, irc.umodes) - assert target in irc.users, "Unknown user %r." % target + + if target not in irc.users: + log.warning('(%s) Possible desync! Mode target %s is not in the users index.', irc.name, target) + supported_modes = irc.umodes oldmodes = irc.users[target].modes else: log.debug('(%s) Using irc.cmodes for this query: %s', irc.name, irc.cmodes) - assert target in irc.channels, "Unknown channel %r." % target + + if target not in irc.channels: + log.warning('(%s) Possible desync! Mode target %s is not in the channels index.', irc.name, target) + supported_modes = irc.cmodes oldmodes = irc.channels[target].modes res = []