Mercurial > xib
changeset 185:6173873c6b0d
minor fix in participant.py, encoding is handled in irclib since cbaab9cc23f8097dbe647d5ea6d982b1c9e49b19
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sat, 20 Feb 2010 16:41:25 +0100 |
parents | 1e5308a0db55 |
children | 70a54da14e63 |
files | participant.py |
diffstat | 1 files changed, 36 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/participant.py +++ b/participant.py @@ -274,39 +274,33 @@ class Participant: def sayOnIRC(self, message): - try: - bot_say = False - if message[:4] == '/me ': - action = True - message = message[4:] + bot_say = False + if message[:4] == '/me ': + action = True + message = message[4:] + else: + action = False + if isinstance(self.irc_connection, ServerConnection): + try: + if action: + self.irc_connection.action(self.bridge.irc_room, message) + else: + self.irc_connection.privmsg(self.bridge.irc_room, message) + except ServerNotConnectedError: + self.irc_connection.connect() + bot_say = True + elif not isinstance(self.xmpp_c, xmpp.client.Client): + bot_say = True + if bot_say: + if action: + self.bridge.irc_connection.privmsg(self.bridge.irc_room, '* '+self.nickname+' '+message) else: - action = False - if isinstance(self.irc_connection, ServerConnection): - try: - if action: - self.irc_connection.action(self.bridge.irc_room, message) - else: - self.irc_connection.privmsg(self.bridge.irc_room, message) - except ServerNotConnectedError: - self.irc_connection.connect() - bot_say = True - elif not isinstance(self.xmpp_c, xmpp.client.Client): - bot_say = True - if bot_say: - if action: - self.bridge.irc_connection.privmsg(self.bridge.irc_room, '* '+self.nickname+' '+message) - else: - self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) - except EncodingException: - self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) + self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) def sayOnIRCTo(self, to, message): if isinstance(self.irc_connection, ServerConnection): - try: - self.irc_connection.privmsg(to, message) - except EncodingException: - self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) + self.irc_connection.privmsg(to, message) elif not isinstance(self.xmpp_c, xmpp.client.Client): if self.bridge.mode != 'normal': self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') @@ -315,29 +309,23 @@ class Participant: def sayOnXMPP(self, message): - try: - if isinstance(self.xmpp_c, xmpp.client.Client): - self.muc.say(message) - elif not isinstance(self.irc_connection, ServerConnection): - if message[:4] == '/me ': - self.bridge.xmpp_room.say('* '+self.nickname+' '+message[4:]) - else: - self.bridge.xmpp_room.say('<'+self.nickname+'> '+message) - except EncodingException: - self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) + if isinstance(self.xmpp_c, xmpp.client.Client): + self.muc.say(message) + elif not isinstance(self.irc_connection, ServerConnection): + if message[:4] == '/me ': + self.bridge.xmpp_room.say('* '+self.nickname+' '+message[4:]) + else: + self.bridge.xmpp_room.say('<'+self.nickname+'> '+message) def sayOnXMPPTo(self, to, message): - try: - if isinstance(self.xmpp_c, xmpp.client.Client): - self.muc.sayTo(to, message) - elif not isinstance(self.irc_connection, ServerConnection): - if self.bridge.mode != 'normal': - self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') - else: - self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.') - except EncodingException: - self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) + if isinstance(self.xmpp_c, xmpp.client.Client): + self.muc.sayTo(to, message) + elif not isinstance(self.irc_connection, ServerConnection): + if self.bridge.mode != 'normal': + self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') + else: + self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.') def leave(self, message):