# HG changeset patch # User Charly COSTE # Date 1267966821 -3600 # Node ID 1a82d5d40d9078de0ff9003871ac00ddb888a5ea # Parent 5726a0833537f2bedba79f79ecfa3d69ca83ea5b moved irc_id handling to irclib Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -666,7 +666,7 @@ class Bot(threading.Thread): return elif event.eventtype() == 'join': bridge = self.get_bridge(irc_room=event.target().lower(), irc_server=connection.server) - bridge.add_participant('irc', nickname, irc_id=event.source()) + bridge.add_participant('irc', nickname) return diff --git a/bridge.py b/bridge.py --- a/bridge.py +++ b/bridge.py @@ -127,7 +127,7 @@ class Bridge: self.stop(message='Failed to connect to the XMPP room, stopping bridge') - def add_participant(self, from_protocol, nickname, real_jid=None, irc_id=None): + def add_participant(self, from_protocol, nickname, real_jid=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(self)+'"', debug=True) @@ -136,8 +136,6 @@ class Bridge: p = self.get_participant(nickname) if p.protocol != from_protocol: if from_protocol == 'irc' and isinstance(p.irc_connection, ServerConnection) and p.irc_connection.logged_in and p.irc_connection.real_nickname == nickname or from_protocol == 'xmpp' and isinstance(p.xmpp_c, xmpp.client.Client) and isinstance(p.muc, xmpp.muc) and p.xmpp_c.nickname == nickname: - if irc_id: - p.irc_connection.irc_id = irc_id return p p.set_both_sides() return p diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -770,6 +770,11 @@ class ServerConnection(Connection): if not is_channel(target): command = "umode" + if command == "join": + self.irc_id = prefix + if DEBUG: + print "irc_id: %s" % (prefix) + if DEBUG: print "command: %s, source: %s, target: %s, arguments: %s" % ( command, prefix, target, arguments)