comparison libervia.tac @ 266:cc778206b7ae

bridge: added inviteMUC + modify joinMUC to make it accept room_jid = ""
author souliane <souliane@mailoo.org>
date Sun, 17 Nov 2013 17:47:39 +0100
parents 3df0c3634c29
children 79970bf6af93
comparison
equal deleted inserted replaced
265:56a307f08ffe 266:cc778206b7ae
316 return result 316 return result
317 d.addCallback(show) 317 d.addCallback(show)
318 return d 318 return d
319 319
320 def jsonrpc_joinMUC(self, room_jid, nick): 320 def jsonrpc_joinMUC(self, room_jid, nick):
321 """Join a Multi-User Chat room""" 321 """Join a Multi-User Chat room
322 @room_jid: leave empty string to generate a unique name
323 """
322 profile = ISATSession(self.session).profile 324 profile = ISATSession(self.session).profile
323 try: 325 try:
324 room_jid = JID(room_jid) 326 if room_jid != "":
327 room_jid = JID(room_jid).userhost()
325 except: 328 except:
326 warning('Invalid room jid') 329 warning('Invalid room jid')
327 return 330 return
328 self.sat_host.bridge.joinMUC(room_jid.userhost(), nick, {}, profile) 331 d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile)
332 return d
333
334 def jsonrpc_inviteMUC(self, contact_jid, room_jid):
335 """Invite a user to a Multi-User Chat room"""
336 profile = ISATSession(self.session).profile
337 try:
338 room_jid = JID(room_jid).userhost()
339 except:
340 warning('Invalid room jid')
341 return
342 room_id = room_jid.split("@")[0]
343 service = room_jid.split("@")[1]
344 self.sat_host.bridge.inviteMUC(contact_jid, service, room_id, {}, profile)
329 345
330 def jsonrpc_mucLeave(self, room_jid): 346 def jsonrpc_mucLeave(self, room_jid):
331 """Quit a Multi-User Chat room""" 347 """Quit a Multi-User Chat room"""
332 profile = ISATSession(self.session).profile 348 profile = ISATSession(self.session).profile
333 try: 349 try: