# HG changeset patch # User Charly COSTE # Date 1267136979 -3600 # Node ID 2a81c480439a7ef580f33e47ba4d1f29df4d52d8 # Parent 2a1ee46f86af892d8b16d424f77c1465a63cd798 renamed camelCased functions Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -164,7 +164,7 @@ class Bot(threading.Thread): r = reason.getData() if r == 'The conference component is shutting down': # MUC server is going down, try to restart the bridges in 1 minute - bridges = self.findBridges([from_.getDomain()]) + bridges = self.find_bridges([from_.getDomain()]) m = 'The MUC server '+from_.getDomain()+' seems to be going down, the bot will try to recreate all bridges related to this server in 1 minute' error = [say_levels.warning, m] self.restart_bridges_delayed(bridges, 60, error) @@ -188,7 +188,7 @@ class Bot(threading.Thread): if presence.getType() == 'unavailable': try: - p = bridge.getParticipant(resource) + p = bridge.get_participant(resource) except Bridge.NoSuchParticipantException: p = None @@ -206,7 +206,7 @@ class Bot(threading.Thread): if not new_nick: self.error(say_levels.debug, 'bad stanza, new nick is not given', no_debug_add=no_debug_add) return - p.changeNickname(new_nick, 'irc') + p.change_nickname(new_nick, 'irc') elif x and x.getTag('status', attrs={'code': '307'}): # participant was kicked @@ -232,13 +232,13 @@ class Bot(threading.Thread): s1 = 'Kicked from XMPP' s2 = ' (no reason was given)' - bridge.removeParticipant('xmpp', p.nickname, s1+s2) + bridge.remove_participant('xmpp', p.nickname, s1+s2) elif x and x.getTag('status', attrs={'code': '301'}): # participant was banned if p == None: bridge.say(say_levels.error, 'bot got banned from XMPP', on_xmpp=False, send_to_admins=True) - self.removeBridge(bridge) + self.remove_bridge(bridge) return if item: reason = item.getTag('reason') @@ -256,12 +256,12 @@ class Bot(threading.Thread): s1 = 'Banned from XMPP' s2 = ' (no reason was given)' - bridge.removeParticipant('xmpp', p.nickname, s1+s2) + bridge.remove_participant('xmpp', p.nickname, s1+s2) else: # participant left if p != None: - bridge.removeParticipant('xmpp', resource, presence.getStatus()) + bridge.remove_participant('xmpp', resource, presence.getStatus()) elif presence.getType() == 'error': error = presence.getTag('error') @@ -272,7 +272,7 @@ class Bot(threading.Thread): if err == 'cancel remote-server-not-found': # Remote server not found # Stop bridges that depend on this server - bridges = self.findBridges([from_.getDomain()]) + bridges = self.find_bridges([from_.getDomain()]) error = [say_levels.error, 'XMPP Remote server not found: '+from_.getDomain()] self.restart_bridges_delayed(bridges, 60, error) else: @@ -283,7 +283,7 @@ class Bot(threading.Thread): if item and item.has_attr('jid'): real_jid = item.getAttr('jid') - p = bridge.addParticipant('xmpp', resource, real_jid) + p = bridge.add_participant('xmpp', resource, real_jid) # if we have the real jid check if the participant is a bot admin if real_jid and isinstance(p, Participant): @@ -330,10 +330,10 @@ class Bot(threading.Thread): self.error(2, 'Received XMPP chat message.\n'+message.__str__(fancy=1), debug=True) try: - from_ = bridge.getParticipant(message.getFrom().getResource()) - to_ = bridge.getParticipant(xmpp_c.nickname) + from_ = bridge.get_participant(message.getFrom().getResource()) + to_ = bridge.get_participant(xmpp_c.nickname) - from_.sayOnIRCTo(to_.nickname, message.getBody()) + from_.say_on_irc_to(to_.nickname, message.getBody()) except Bridge.NoSuchParticipantException: if xmpp_c.nickname == self.nickname: @@ -401,13 +401,13 @@ class Bot(threading.Thread): self.error(2, 'Received XMPP groupchat message.\n'+message.__str__(fancy=1), debug=True) try: - participant = bridge.getParticipant(resource) + participant = bridge.get_participant(resource) except Bridge.NoSuchParticipantException: if resource != self.nickname: self.error(say_levels.debug, 'NoSuchParticipantException "'+resource+'" on "'+str(bridge)+'", WTF ?', no_debug_add='\n'+message.__str__(fancy=1)) return - participant.sayOnIRC(message.getBody()) + participant.say_on_irc(message.getBody()) return elif message.getType() == 'error': @@ -427,7 +427,7 @@ class Bot(threading.Thread): b.restart(message='Automatic restart of bridge') else: try: - p = b.getParticipant(xmpp_c.nickname) + p = b.get_participant(xmpp_c.nickname) p.say_on_XMPP_through_bridge(message.getBody()) except Bridge.NoSuchParticipantException: b.restart(message='Automatic restart of bridge') @@ -524,7 +524,7 @@ class Bot(threading.Thread): continue try: - from_ = bridge.getParticipant(nickname) + from_ = bridge.get_participant(nickname) except Bridge.NoSuchParticipantException: continue @@ -536,9 +536,9 @@ class Bot(threading.Thread): return try: - to_ = bridge.getParticipant(event.target().split('!')[0]) + to_ = bridge.get_participant(event.target().split('!')[0]) self.error(2, debug_str, debug=True) - from_.sayOnXMPPTo(to_.nickname, event.arguments()[0]) + from_.say_on_xmpp_to(to_.nickname, event.arguments()[0]) return except Bridge.NoSuchParticipantException: @@ -555,14 +555,14 @@ class Bot(threading.Thread): if event.eventtype() == 'kick': if event.target().lower() == bridge.irc_room: try: - kicked = bridge.getParticipant(event.arguments()[0]) + kicked = bridge.get_participant(event.arguments()[0]) if isinstance(kicked.irc_connection, irclib.ServerConnection): kicked.irc_connection.join(bridge.irc_room) else: if len(event.arguments()) > 1: - bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1]) + bridge.remove_participant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1]) else: - bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)') + bridge.remove_participant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)') return except Bridge.NoSuchParticipantException: self.error(say_levels.debug, 'a participant that was not here has been kicked ? WTF ?', no_debug_add=event_str) @@ -581,14 +581,14 @@ class Bot(threading.Thread): leave_message = 'Left channel.' else: leave_message = '' - bridge.removeParticipant('irc', from_.nickname, leave_message) + bridge.remove_participant('irc', from_.nickname, leave_message) handled = True continue # Nickname change if event.eventtype() == 'nick': - from_.changeNickname(event.target(), 'xmpp') + from_.change_nickname(event.target(), 'xmpp') handled = True continue @@ -600,7 +600,7 @@ class Bot(threading.Thread): message = event.arguments()[0] if event.eventtype() == 'action': message = '/me '+message - from_.sayOnXMPP(message) + from_.say_on_xmpp(message) return else: continue @@ -624,7 +624,7 @@ class Bot(threading.Thread): raise Exception('[Error] the nickname "'+event.target()+'" is banned from the IRC chan of bridge "'+str(bridge)+'"') else: try: - banned = bridge.getParticipant(event.target()) + banned = bridge.get_participant(event.target()) if banned.irc_connection != 'bannedfromchan': banned.irc_connection = 'bannedfromchan' self.error(2, debug_str, debug=True) @@ -648,14 +648,14 @@ class Bot(threading.Thread): if event.eventtype() in ['cannotsendtochan', 'notonchannel', 'inviteonlychan']: self.error(2, debug_str, debug=True) - bridges = self.getBridges(irc_room=event.arguments()[0], irc_server=connection.server) + bridges = self.get_bridges(irc_room=event.arguments()[0], irc_server=connection.server) if len(bridges) > 1: raise Exception, 'more than one bridge for one irc chan, WTF ?' bridge = bridges[0] if connection.get_nickname() == self.nickname: bridge._join_irc_failed(event.eventtype()) else: - p = bridge.getParticipant(connection.get_nickname()) + p = bridge.get_participant(connection.get_nickname()) p._close_irc_connection('') p.irc_connection = event.eventtype() return @@ -670,20 +670,20 @@ class Bot(threading.Thread): # Joining events if event.eventtype() in ['namreply', 'join']: if event.eventtype() == 'namreply': - for bridge in self.getBridges(irc_room=event.arguments()[1].lower(), irc_server=connection.server): + for bridge in self.get_bridges(irc_room=event.arguments()[1].lower(), irc_server=connection.server): for nickname in re.split('(?:^[&@\+%]?|(?: [&@\+%]?)*)', event.arguments()[2].strip()): if nickname == '' or nickname == self.nickname: continue - bridge.addParticipant('irc', nickname) + bridge.add_participant('irc', nickname) return elif event.eventtype() == 'join': - bridges = self.getBridges(irc_room=event.target().lower(), irc_server=connection.server) + bridges = self.get_bridges(irc_room=event.target().lower(), irc_server=connection.server) if len(bridges) == 0: self.error(2, debug_str, debug=True) self.error(3, 'no bridge found for "'+event.target().lower()+' at '+connection.server+'"', debug=True) return for bridge in bridges: - bridge.addParticipant('irc', nickname, irc_id=event.source()) + bridge.add_participant('irc', nickname, irc_id=event.source()) return @@ -697,7 +697,7 @@ class Bot(threading.Thread): self.error(1, 'ignoring IRC mode "'+event.arguments()[0]+'" for "'+event.arguments()[1]+'"', debug=True) return self.error(2, debug_str, debug=True) - bridges = self.getBridges(irc_room=event.target(), irc_server=connection.server) + bridges = self.get_bridges(irc_room=event.target(), irc_server=connection.server) if len(bridges) > 1: raise Exception, 'more than one bridge for one irc chan, WTF ?' bridge = bridges[0] @@ -742,7 +742,7 @@ class Bot(threading.Thread): return b - def findBridges(self, str_array): + def find_bridges(self, str_array): # TODO: lock self.bridges for thread safety bridges = [b for b in self.bridges] for bridge in self.bridges: @@ -759,7 +759,7 @@ class Bot(threading.Thread): return'['+str(say_levels.get(importance))+'] '+message - def getBridges(self, irc_room=None, irc_server=None, xmpp_room_jid=None): + def get_bridges(self, irc_room=None, irc_server=None, xmpp_room_jid=None): # TODO: lock self.bridges for thread safety bridges = [b for b in self.bridges] for bridge in [b for b in bridges]: @@ -851,7 +851,7 @@ class Bot(threading.Thread): self.error(3, 'XMPP connection for "'+nickname+'" is now used by '+str(c.used_by)+' bridges', debug=True) - def removeBridge(self, bridge, message='Removing bridge', log=True): + def remove_bridge(self, bridge, message='Removing bridge', log=True): self.bridges.remove(bridge) bridge.stop(message=message, log=log) @@ -913,5 +913,5 @@ class Bot(threading.Thread): def __del__(self): for bridge in self.bridges: - self.removeBridge(bridge, message='Stopping bot', log=False) + self.remove_bridge(bridge, message='Stopping bot', log=False) self.halt = True diff --git a/bridge.py b/bridge.py --- a/bridge.py +++ b/bridge.py @@ -101,7 +101,7 @@ class Bridge: def _RemoteServerNotFound_handler(self): server = xmpp.protocol.JID(self.xmpp_room_jid).getDomain() - bridges = self.bot.findBridges([server]) + bridges = self.bot.find_bridges([server]) error = [say_levels.warning, 'The MUC server '+server+' seems to be down, the bot will try to recreate all bridges related to this server in 5 minutes'] self.bot.restart_bridges_delayed(bridges, 300, error) @@ -129,13 +129,13 @@ class Bridge: self.stop(message='Failed to connect to the XMPP room, stopping bridge') - def addParticipant(self, from_protocol, nickname, real_jid=None, irc_id=None): + def add_participant(self, from_protocol, nickname, real_jid=None, irc_id=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(self)+'"', debug=True) return try: - p = self.getParticipant(nickname) + p = self.get_participant(nickname) if p.protocol != from_protocol: 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: if irc_id: @@ -166,15 +166,15 @@ class Bridge: return p - def createDuplicatesOn(self, protocols): + def create_duplicates_on(self, protocols): for p in self.participants: if p.protocol == 'xmpp' and 'irc' in protocols: - p.createDuplicateOnIRC() + p.create_duplicate_on_irc() elif p.protocol == 'irc' and 'xmpp' in protocols: - p.createDuplicateOnXMPP() + p.create_duplicate_on_xmpp() - def changeMode(self, new_mode): + def change_mode(self, new_mode): if new_mode == self.mode: return 'Mode is already equal to '+self.mode @@ -187,11 +187,11 @@ class Bridge: if old_mode == 'limited': # From limited to {normal,bypass} - self.createDuplicatesOn(['irc']) + self.create_duplicates_on(['irc']) elif old_mode in ['minimal', 'normal']: # From {minimal,normal} to {normal,bypass} - self.createDuplicatesOn(['irc', 'xmpp']) + self.create_duplicates_on(['irc', 'xmpp']) elif old_mode == 'bypass': # From bypass to normal @@ -204,7 +204,7 @@ class Bridge: elif new_mode == 'limited': if old_mode == 'minimal': - self.createDuplicatesOn(['xmpp']) + self.create_duplicates_on(['xmpp']) i = 0 for p in self.participants: @@ -235,7 +235,7 @@ class Bridge: self.say(say_levels.notice, 'Bridge is switching from '+old_mode+' to '+new_mode+' mode.', log=True) - def getParticipant(self, nickname): + def get_participant(self, nickname): """Returns a participant object if there is a participant using nickname in the bridge. Raises a NoSuchParticipantException otherwise.""" self.lock.acquire() for p in self.participants: @@ -257,19 +257,19 @@ class Bridge: return participants_nicknames - def hasParticipant(self, nickname): + def has_participant(self, nickname): try: - self.getParticipant(nickname) + self.get_participant(nickname) return True except self.NoSuchParticipantException: return False - def removeParticipant(self, left_protocol, nickname, leave_message): + def remove_participant(self, left_protocol, nickname, leave_message): """Remove the participant using nickname from the bridge. Raises a NoSuchParticipantException if nickname is not used in the bridge.""" was_on_both = None - p = self.getParticipant(nickname) + p = self.get_participant(nickname) if p.left: self.lock.acquire() @@ -283,9 +283,9 @@ class Bridge: was_on_both = True if left_protocol == 'xmpp': p.protocol = 'irc' - p.createDuplicateOnXMPP() + p.create_duplicate_on_xmpp() elif left_protocol == 'irc': - p.createDuplicateOnIRC() + p.create_duplicate_on_irc() else: if left_protocol == 'xmpp': was_on_both = False @@ -297,7 +297,7 @@ class Bridge: c = self.bot.irc.get_connection(self.irc_server, self.irc_port, p.duplicate_nickname) if not (c and self.irc_room in c.left_channels): p._close_irc_connection(leave_message) - p.createDuplicateOnIRC() + p.create_duplicate_on_irc() return elif p.protocol == 'irc': @@ -305,9 +305,9 @@ class Bridge: was_on_both = True if left_protocol == 'irc': p.protocol = 'xmpp' - p.createDuplicateOnIRC() + p.create_duplicate_on_irc() elif left_protocol == 'xmpp': - p.createDuplicateOnXMPP() + p.create_duplicate_on_xmpp() else: if left_protocol == 'irc': was_on_both = False diff --git a/commands.py b/commands.py --- a/commands.py +++ b/commands.py @@ -63,7 +63,7 @@ def _find_bridges(bot, args_array): except IndexError: ret += '\nInvalid bridge number "'+str(bn)+'".' except ValueError: - found_bridges = bot.findBridges(arg) + found_bridges = bot.find_bridges(arg) if len(found_bridges) == 0: ret += '\nNo bridge found matching "'+arg+'".' else: @@ -152,7 +152,7 @@ def change_bridges_mode(bot, command, ar found_bridges, ret = _find_bridges(bot, args.bridge_id) for found_bridge in found_bridges: - r = found_bridge.changeMode(args.new_mode) + r = found_bridge.change_mode(args.new_mode) if r: ret += r+'\n' @@ -245,7 +245,7 @@ def remove_bridges(bot, command, args_ar found_bridges, ret = _find_bridges(bot, args.bridge_id) for found_bridge in found_bridges: - bot.removeBridge(found_bridge) + bot.remove_bridge(found_bridge) return ret+'Bridges removed.' diff --git a/muc.py b/muc.py --- a/muc.py +++ b/muc.py @@ -117,7 +117,7 @@ class muc: self.xmpp_c.lock.release() - def sayTo(self, to, message): + def say_to(self, to, message): """Send a private message""" self.xmpp_c.lock.acquire() s = xmpp.protocol.Message(to=self.room_jid+'/'+to, typ='chat', body=message) diff --git a/participant.py b/participant.py --- a/participant.py +++ b/participant.py @@ -39,21 +39,21 @@ class Participant: self.muc = None self.left = False if protocol == 'xmpp' and self.bridge.mode in ['normal', 'bypass']: - self.createDuplicateOnIRC() + self.create_duplicate_on_irc() elif protocol == 'irc' and self.bridge.mode != 'minimal': - self.createDuplicateOnXMPP() + self.create_duplicate_on_xmpp() def _get_new_duplicate_nickname(self): new_duplicate_nickname = self.duplicate_nickname for i in xrange(5): new_duplicate_nickname = new_duplicate_nickname+'_' - if not self.bridge.hasParticipant(new_duplicate_nickname): + if not self.bridge.has_participant(new_duplicate_nickname): return new_duplicate_nickname return None - def createDuplicateOnXMPP(self): + def create_duplicate_on_xmpp(self): if isinstance(self.xmpp_c, xmpp.client.Client) or isinstance(self.irc_connection, ServerConnection): return self.xmpp_c = self.bridge.bot.get_xmpp_connection(self.duplicate_nickname) @@ -90,7 +90,7 @@ class Participant: if isinstance(self.xmpp_c, xmpp.client.Client): self.bridge.bot.close_xmpp_connection(self.nickname) self.xmpp_c = None - self.createDuplicateOnXMPP() + self.create_duplicate_on_xmpp() return else: @@ -107,7 +107,7 @@ class Participant: self.xmpp_c = None - def createDuplicateOnIRC(self): + def create_duplicate_on_irc(self): if isinstance(self.xmpp_c, xmpp.client.Client) or isinstance(self.irc_connection, ServerConnection): return self.irc_connection = self.bridge.bot.irc.open_connection(self.bridge.irc_server, self.bridge.irc_port, self.duplicate_nickname) @@ -139,7 +139,7 @@ class Participant: if isinstance(self.irc_connection, ServerConnection): self.irc_connection.close('') self.irc_connection = error - self.createDuplicateOnIRC() + self.create_duplicate_on_irc() return else: @@ -151,7 +151,7 @@ class Participant: if isinstance(self.irc_connection, ServerConnection): self.irc_connection.close('') self.irc_connection = error - self.createDuplicateOnIRC() + self.create_duplicate_on_irc() return else: self.bridge.say(say_levels.warning, 'The nickname "'+self.nickname+'" contains unauthorized characters and cannot be used in the IRC channel', log=True) @@ -180,7 +180,7 @@ class Participant: self.xmpp_c = 'both' - def changeNickname(self, newnick, on_protocol): + def change_nickname(self, newnick, on_protocol): """Change participant's nickname.""" p = None @@ -193,7 +193,7 @@ class Participant: else: try: - p = self.bridge.getParticipant(newnick) + p = self.bridge.get_participant(newnick) except self.bridge.NoSuchParticipantException: self.nickname = newnick self.duplicate_nickname = newnick @@ -203,11 +203,11 @@ class Participant: self.irc_connection.nick(newnick, callback=self._irc_nick_callback) else: self._close_irc_connection('Changed nickname') - self.createDuplicateOnIRC() + self.create_duplicate_on_irc() else: if self.irc_connection == 'both': - self.bridge.addParticipant('irc', oldnick) - self.createDuplicateOnIRC() + self.bridge.add_participant('irc', oldnick) + self.create_duplicate_on_irc() return elif self.protocol == 'irc': @@ -217,17 +217,17 @@ class Participant: else: try: - p = self.bridge.getParticipant(newnick) + p = self.bridge.get_participant(newnick) except self.bridge.NoSuchParticipantException: self.nickname = newnick self.duplicate_nickname = newnick if isinstance(self.xmpp_c, xmpp.client.Client): for b in self.bridge.bot.bridges: - if b.hasParticipant(oldnick) and b.irc_server != self.bridge.irc_server: + if b.has_participant(oldnick) and b.irc_server != self.bridge.irc_server: self.muc.leave(message='Changed nickname to "'+self.nickname+'"') self.xmpp_c = None self.bridge.bot.close_xmpp_connection(oldnick) - self.createDuplicateOnXMPP() + self.create_duplicate_on_xmpp() return if not self.bridge.bot.xmpp_connections.has_key(newnick): @@ -238,8 +238,8 @@ class Participant: self.muc.change_nick(newnick, status='From IRC', callback=self._xmpp_join_callback) else: if self.xmpp_c == 'both': - self.bridge.addParticipant('xmpp', oldnick) - self.createDuplicateOnXMPP() + self.bridge.add_participant('xmpp', oldnick) + self.create_duplicate_on_xmpp() return self.nickname = newnick @@ -268,13 +268,13 @@ class Participant: p.xmpp_c = None p.muc = None p.duplicate_nickname = p._get_new_duplicate_nickname() - p.createDuplicateOnXMPP() + p.create_duplicate_on_xmpp() else: # should never happen raise Exception('WTF ?') - def sayOnIRC(self, message): + def say_on_irc(self, message): bot_say = False if message[:4] == '/me ': action = True @@ -299,17 +299,17 @@ class Participant: self.bridge.say(-1, '<'+self.nickname+'> '+message, on_xmpp=False) - def sayOnIRCTo(self, to, message): + def say_on_irc_to(self, to, message): 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.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') + self.bridge.get_participant(to).say_on_xmpp_to(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 IRC duplicate with your nickname.') + 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.') - def sayOnXMPP(self, message): + def say_on_xmpp(self, message): if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say(message) elif not isinstance(self.irc_connection, ServerConnection): @@ -323,14 +323,14 @@ class Participant: self.bridge.say(-1, '<'+self.nickname+'> '+message, on_irc=False) - def sayOnXMPPTo(self, to, message): + def say_on_xmpp_to(self, to, message): if isinstance(self.xmpp_c, xmpp.client.Client): - self.muc.sayTo(to, message) + self.muc.say_to(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.') + self.bridge.get_participant(to).say_on_xmpp_to(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.') + 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.') def leave(self, message):