# HG changeset patch # User Charly COSTE # Date 1268040770 -3600 # Node ID 8acbfda313b9ab5c6aa27e2bb5538c628ec81b63 # Parent 533a5db7938996579fcf52bdffe1294bd4c522cc use ServerConnection.nickname instead of .real_nickname in most cases, make sure we put a string in .real_nickname Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -559,25 +559,25 @@ class Bot(threading.Thread): bridge = self.get_bridge(irc_room=event.arguments()[0], irc_server=connection.server) if event.eventtype() == 'cannotsendtochan': - if connection.real_nickname == self.nickname: + if connection.nickname == self.nickname: bridge._join_irc_failed(event.eventtype()) else: - p = bridge.get_participant(connection.real_nickname) + p = bridge.get_participant(connection.nickname) p._close_irc_connection(event.eventtype()) p.irc_connection = event.eventtype() elif event.eventtype() == 'notonchannel': - if connection.real_nickname == self.nickname: + if connection.nickname == self.nickname: bridge.restart(message='Restarting bridge because we received the IRC event '+event.eventtype()) else: - p = bridge.get_participant(connection.real_nickname) + p = bridge.get_participant(connection.nickname) p.irc_connection.join(bridge.irc_room) return # Ignore events not received on bot connection - if connection.real_nickname != self.nickname: + if connection.nickname != self.nickname: self.error(1, 'ignoring IRC '+event.eventtype()+' not received on bridge connection', debug=True) return diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -298,7 +298,7 @@ class IRC: else: self.bot.error(say_levels.error, 'Unkonwn exception on IRC thread:\n'+str(e.args)) continue - if c.real_nickname == self.bot.nickname: + if c.nickname == self.bot.nickname: self.bot.restart(message='Lost bot IRC connection') else: c.disconnect(volontary=True) @@ -780,8 +780,8 @@ class ServerConnection(Connection): if command in ["nick", "welcome"]: self.logged_in = True - self.real_nickname = target - if self.new_nickname: + if self.new_nickname and isinstance(target, basestring): + self.real_nickname = target if self.new_nickname != target: if len(self.new_nickname) > len(target): self._handle_event(Event('nicknametoolong', None, None, None))