comparison bridge.py @ 123:75a03f10a863

Code refactoring (new method participant.set_both_sides()) Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Wed, 13 Jan 2010 22:27:00 +0100
parents 9e90e15913a7
children 99f3dee1fad7
comparison
equal deleted inserted replaced
122:9e90e15913a7 123:75a03f10a863
143 if p.protocol != from_protocol: 143 if p.protocol != from_protocol:
144 if from_protocol == 'irc' and isinstance(p.irc_connection, ServerConnection) and p.irc_connection.really_connected == True 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: 144 if from_protocol == 'irc' and isinstance(p.irc_connection, ServerConnection) and p.irc_connection.really_connected == True 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:
145 if irc_id: 145 if irc_id:
146 p.irc_connection.irc_id = irc_id 146 p.irc_connection.irc_id = irc_id
147 return p 147 return p
148 self.bot.error('===> Debug: "'+nickname+'" is on both sides of bridge "'+str(self)+'"', debug=True) 148 p.set_both_sides()
149 self.say('[Warning] The nickname "'+nickname+'" is used on both sides of the bridge, please avoid that if possible')
150 if isinstance(p.irc_connection, ServerConnection):
151 p.irc_connection.close('')
152 if p.irc_connection != 'both':
153 p.irc_connection = 'both'
154 if isinstance(p.muc, xmpp.muc):
155 p.muc.leave('')
156 self.bot.close_xmpp_connection(p.nickname)
157 if p.xmpp_c != 'both':
158 p.xmpp_c = 'both'
159 return p 149 return p
160 except NoSuchParticipantException: 150 except NoSuchParticipantException:
161 pass 151 pass
162 152
163 if nickname == 'ChanServ' and from_protocol == 'irc': 153 if nickname == 'ChanServ' and from_protocol == 'irc':