Mercurial > xib
comparison bridge.py @ 221:1a82d5d40d90
moved irc_id handling to irclib
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 07 Mar 2010 14:00:21 +0100 |
parents | 63289aa1dea7 |
children | 0d85049ac68d |
comparison
equal
deleted
inserted
replaced
220:5726a0833537 | 221:1a82d5d40d90 |
---|---|
125 trace = traceback.format_exc() | 125 trace = traceback.format_exc() |
126 self.bot.error(say_levels.error, 'failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge\n'+trace, send_to_admins=True) | 126 self.bot.error(say_levels.error, 'failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge\n'+trace, send_to_admins=True) |
127 self.stop(message='Failed to connect to the XMPP room, stopping bridge') | 127 self.stop(message='Failed to connect to the XMPP room, stopping bridge') |
128 | 128 |
129 | 129 |
130 def add_participant(self, from_protocol, nickname, real_jid=None, irc_id=None): | 130 def add_participant(self, from_protocol, nickname, real_jid=None): |
131 """Add a participant to the bridge.""" | 131 """Add a participant to the bridge.""" |
132 if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): | 132 if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): |
133 self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(self)+'"', debug=True) | 133 self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(self)+'"', debug=True) |
134 return | 134 return |
135 try: | 135 try: |
136 p = self.get_participant(nickname) | 136 p = self.get_participant(nickname) |
137 if p.protocol != from_protocol: | 137 if p.protocol != from_protocol: |
138 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: | 138 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: |
139 if irc_id: | |
140 p.irc_connection.irc_id = irc_id | |
141 return p | 139 return p |
142 p.set_both_sides() | 140 p.set_both_sides() |
143 return p | 141 return p |
144 except self.NoSuchParticipantException: | 142 except self.NoSuchParticipantException: |
145 pass | 143 pass |