# HG changeset patch # User Charly COSTE # Date 1267996345 -3600 # Node ID a434b73bde51f4b45f065335c03d64b566d35d85 # Parent 3c493741e53afda726b45106fbb6917351cdd320 added optional "action" argument to Participant.say_on_xmpp_to and muc.say_to Signed-off-by: Charly COSTE diff --git a/muc.py b/muc.py --- a/muc.py +++ b/muc.py @@ -130,9 +130,11 @@ class muc: self.xmpp_c.lock.release() - def say_to(self, to, message): + def say_to(self, to, message, action=False): """Send a private message""" self.xmpp_c.lock.acquire() + if action: + message = '/me '+message s = xmpp.protocol.Message(to=self.room_jid+'/'+to, typ='chat', body=message) self._send(s) self.xmpp_c.lock.release() diff --git a/participant.py b/participant.py --- a/participant.py +++ b/participant.py @@ -308,10 +308,10 @@ class Participant: if isinstance(self.irc_connection, ServerConnection): self.irc_connection.privmsg(to, message) elif not isinstance(self.xmpp_c, xmpp.client.Client): - if self.bridge.mode != 'normal': - self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') + if self.bridge.mode not in ['normal', 'bypass']: + self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') else: - self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.') + self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.') def say_on_xmpp(self, message, action=False): @@ -321,14 +321,14 @@ class Participant: self.bridge.say_on_behalf(self.nickname, message, 'xmpp', action=action) - def say_on_xmpp_to(self, to, message): + def say_on_xmpp_to(self, to, message, action=False): if isinstance(self.xmpp_c, xmpp.client.Client): - self.muc.say_to(to, message) + self.muc.say_to(to, message, action=action) elif not isinstance(self.irc_connection, ServerConnection): - if self.bridge.mode != 'normal': - self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') + if self.bridge.mode not in ['normal', 'bypass']: + self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') else: - self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.') + self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.') def leave(self, message):