Mercurial > xib
diff participant.py @ 226:0d85049ac68d
switch to IRC join callbacks in bridge.py and participant.py
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 07 Mar 2010 18:52:48 +0100 |
parents | 63289aa1dea7 |
children | a434b73bde51 |
line wrap: on
line diff
--- a/participant.py +++ b/participant.py @@ -115,13 +115,8 @@ class Participant: def _irc_nick_callback(self, error): - if error == None: - self.irc_connection.join(self.bridge.irc_room) - m = '"'+self.nickname+'" duplicate succesfully created on IRC side of bridge "'+str(self.bridge)+'"' - if self.nickname != self.duplicate_nickname: - m += ' using nickname "'+self.duplicate_nickname+'"' - self.bridge.say(say_levels.info, '"'+self.nickname+'" will appear as "'+self.duplicate_nickname+'" on IRC because its real nickname is reserved or contains unauthorized characters') - self.bridge.bot.error(3, m, debug=True) + if not error: + self.irc_connection.join(self.bridge.irc_room, callback=self._irc_join_callback) elif self.irc_connection != 'both': @@ -167,6 +162,19 @@ class Participant: self.irc_connection = error + def _irc_join_callback(self, channel, error): + if not error: + m = '"'+self.nickname+'" duplicate succesfully joined IRC side of bridge "'+str(self.bridge)+'"' + if self.nickname != self.duplicate_nickname: + m += ' using nickname "'+self.duplicate_nickname+'"' + self.bridge.say(say_levels.info, '"'+self.nickname+'" will appear as "'+self.duplicate_nickname+'" on IRC because its real nickname is reserved or contains unauthorized characters') + self.bridge.bot.error(3, m, debug=True) + + elif self.irc_connection != 'both': + self._close_irc_connection('') + self.irc_connection = error + + def set_both_sides(self): self.bridge.say(say_levels.warning, 'The nickname "'+self.nickname+'" is used on both sides of the bridge', log=True) if isinstance(self.irc_connection, ServerConnection):