Mercurial > xib
changeset 10:7cb790f5f243
No comment.
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 16 Aug 2009 23:35:15 +0200 |
parents | 4b2faa511f01 |
children | 79b0a7f48a3e |
files | bot.py bridge.py participant.py |
diffstat | 3 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/bot.py +++ b/bot.py @@ -269,17 +269,18 @@ class bot(Thread): connection.bridge.addParticipant('irc', nickname) return try: + if not '!' in event.source(): + return from_ = connection.bridge.getParticipant(event.source().split('!')[0]) if event.eventtype() == 'quit' or event.eventtype() == 'part' and event.target() == connection.bridge.irc_room: if from_.protocol in ['irc', 'both']: connection.bridge.removeParticipant('irc', from_.nickname, event.arguments()[0]) return - if event.eventtype() == 'nick' and from_.protocol == 'irc': + if event.eventtype() == 'nick' and from_.protocol in ['irc', 'both']: from_.changeNickname(event.target(), 'xmpp') except NoSuchParticipantException: + self.error('===> Debug: NoSuchParticipantException "'+event.source().split('!')[0]+'"', debug=True) return - except AttributeError: - pass if event.eventtype() == 'pubmsg': if from_.protocol == 'irc' or from_.protocol == 'both': from_.sayOnXMPP(event.arguments()[0])
--- a/bridge.py +++ b/bridge.py @@ -70,7 +70,7 @@ class bridge: def addParticipant(self, protocol, nickname): """Add a participant to the bridge.""" if (protocol == 'irc' and nickname == self.irc_connection.get_nickname()) or (protocol == 'xmpp' and nickname == self.xmpp_room.nickname): - raise Exception('cannot add self') + raise Exception('Internal Error: cannot add self') try: p = self.getParticipant(nickname) if p.protocol != protocol:
--- a/participant.py +++ b/participant.py @@ -140,11 +140,11 @@ class participant: self.createDuplicateOnXMPP() elif self.protocol == 'both': if on_protocol == 'irc': - self.protocol = 'xmpp' - self.createDuplicateOnIRC() + self.bridge.removeParticipant('xmpp', self.nickname, '') + self.bridge.addParticipant('xmpp', newnick) elif on_protocol == 'xmpp': - self.protocol = 'irc' - self.createDuplicateOnXMPP() + self.bridge.removeParticipant('irc', self.nickname, '') + self.bridge.addParticipant('irc', newnick) def sayOnIRC(self, message):