From b7a456ee817f40caec3e84b9436ddad44a0f5a10 Mon Sep 17 00:00:00 2001 From: Arthur Furlan Date: Wed, 28 Jul 2010 18:29:44 +0200 Subject: [PATCH] Allow custom usernames in MUC rooms I added an optional argument "username" in the "join_room" method to support this feature and when not passed, use the "short part" of the "self.__username". --- jabberbot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jabberbot.py b/jabberbot.py index 81f8406..763c154 100644 --- a/jabberbot.py +++ b/jabberbot.py @@ -146,9 +146,11 @@ class JabberBot(object): return self.conn - def join_room(self, room): + def join_room(self, room, username=None): """Join the specified multi-user chat room""" - my_room_JID = "%s/%s" % (room,self.__username) + if username is None: + username = self.__username.split('@')[0] + my_room_JID = '/'.join(room, username) self.connect().send(xmpp.Presence(to=my_room_JID)) def quit( self): -- 2.11.4.GIT