# HG changeset patch # User souliane # Date 1384706859 -3600 # Node ID cc778206b7ae23d1becfe97ba26f0f98acd5a2e7 # Parent 56a307f08ffecce7f3a5cfb3a2487e658b76aec3 bridge: added inviteMUC + modify joinMUC to make it accept room_jid = "" diff -r 56a307f08ffe -r cc778206b7ae libervia.py --- a/libervia.py Sun Nov 17 17:43:31 2013 +0100 +++ b/libervia.py Sun Nov 17 17:47:39 2013 +0100 @@ -115,7 +115,7 @@ ["getContacts", "addContact", "sendMessage", "sendMblog", "sendMblogComment", "getLastMblogs", "getMassiveLastMblogs", "getMblogComments", "getProfileJid", "getHistory", "getPresenceStatus", "joinMUC", "mucLeave", "getRoomsJoined", - "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", + "inviteMUC", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed", "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getCard", "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction", diff -r 56a307f08ffe -r cc778206b7ae libervia.tac --- a/libervia.tac Sun Nov 17 17:43:31 2013 +0100 +++ b/libervia.tac Sun Nov 17 17:47:39 2013 +0100 @@ -318,14 +318,30 @@ return d def jsonrpc_joinMUC(self, room_jid, nick): - """Join a Multi-User Chat room""" + """Join a Multi-User Chat room + @room_jid: leave empty string to generate a unique name + """ profile = ISATSession(self.session).profile try: - room_jid = JID(room_jid) + if room_jid != "": + room_jid = JID(room_jid).userhost() except: warning('Invalid room jid') return - self.sat_host.bridge.joinMUC(room_jid.userhost(), nick, {}, profile) + d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile) + return d + + def jsonrpc_inviteMUC(self, contact_jid, room_jid): + """Invite a user to a Multi-User Chat room""" + profile = ISATSession(self.session).profile + try: + room_jid = JID(room_jid).userhost() + except: + warning('Invalid room jid') + return + room_id = room_jid.split("@")[0] + service = room_jid.split("@")[1] + self.sat_host.bridge.inviteMUC(contact_jid, service, room_id, {}, profile) def jsonrpc_mucLeave(self, room_jid): """Quit a Multi-User Chat room"""