comparison src/server/server.py @ 689:a6adefddcb0a

browser and server side: complete changeset 669 (a8fddccf5b84) about joining MUC: - TODO: some issues remain when a MUC is already joined and you enter a "short" name (JID node) in the dialog
author souliane <souliane@mailoo.org>
date Thu, 02 Apr 2015 00:36:08 +0200
parents 9877607c719a
children 7a9c7b9f6a28
comparison
equal deleted inserted replaced
688:6fc3ff3936ba 689:a6adefddcb0a
390 d.addCallback(show) 390 d.addCallback(show)
391 return d 391 return d
392 392
393 def jsonrpc_joinMUC(self, room_jid, nick): 393 def jsonrpc_joinMUC(self, room_jid, nick):
394 """Join a Multi-User Chat room 394 """Join a Multi-User Chat room
395 @room_jid: leave empty string to generate a unique name 395
396 @param room_jid (unicode): room JID or empty string to generate a unique name
397 @param nick (unicode): user nick
396 """ 398 """
397 profile = ISATSession(self.session).profile 399 profile = ISATSession(self.session).profile
398 d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile) 400 d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile)
399 return d 401 return d
400 402
401 def jsonrpc_inviteMUC(self, contact_jid, room_jid): 403 def jsonrpc_inviteMUC(self, contact_jid, room_jid):
402 """Invite a user to a Multi-User Chat room""" 404 """Invite a user to a Multi-User Chat room
403 profile = ISATSession(self.session).profile 405
404 try: 406 @param contact_jid (unicode): contact to invite
405 room_jid = JID(room_jid).userhost() 407 @param room_jid (unicode): room JID or empty string to generate a unique name
406 except: 408 """
407 log.warning('Invalid room jid') 409 profile = ISATSession(self.session).profile
408 return
409 room_id = room_jid.split("@")[0] 410 room_id = room_jid.split("@")[0]
410 service = room_jid.split("@")[1] 411 service = room_jid.split("@")[1]
411 self.sat_host.bridge.inviteMUC(contact_jid, service, room_id, {}, profile) 412 self.sat_host.bridge.inviteMUC(contact_jid, service, room_id, {}, profile)
412 413
413 def jsonrpc_mucLeave(self, room_jid): 414 def jsonrpc_mucLeave(self, room_jid):
429 """Return list of room subjects""" 430 """Return list of room subjects"""
430 profile = ISATSession(self.session).profile 431 profile = ISATSession(self.session).profile
431 return self.sat_host.bridge.getRoomsSubjects(profile) 432 return self.sat_host.bridge.getRoomsSubjects(profile)
432 433
433 def jsonrpc_launchTarotGame(self, other_players, room_jid=""): 434 def jsonrpc_launchTarotGame(self, other_players, room_jid=""):
434 """Create a room, invite the other players and start a Tarot game 435 """Create a room, invite the other players and start a Tarot game.
435 @param room_jid: leave empty string to generate a unique room name 436
436 """ 437 @param other_players (list[unicode]): JIDs of the players to play with
437 profile = ISATSession(self.session).profile 438 @param room_jid (unicode): room JID or empty string to generate a unique name
438 try: 439 """
439 if room_jid != "": 440 profile = ISATSession(self.session).profile
440 room_jid = JID(room_jid).userhost()
441 except:
442 log.warning('Invalid room jid')
443 return
444 self.sat_host.bridge.tarotGameLaunch(other_players, room_jid, profile) 441 self.sat_host.bridge.tarotGameLaunch(other_players, room_jid, profile)
445 442
446 def jsonrpc_getTarotCardsPaths(self): 443 def jsonrpc_getTarotCardsPaths(self):
447 """Give the path of all the tarot cards""" 444 """Give the path of all the tarot cards"""
448 _join = os.path.join 445 _join = os.path.join
458 """Tell to the server the cards we want to put on the table""" 455 """Tell to the server the cards we want to put on the table"""
459 profile = ISATSession(self.session).profile 456 profile = ISATSession(self.session).profile
460 self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile) 457 self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
461 458
462 def jsonrpc_launchRadioCollective(self, invited, room_jid=""): 459 def jsonrpc_launchRadioCollective(self, invited, room_jid=""):
463 """Create a room, invite people, and start a radio collective 460 """Create a room, invite people, and start a radio collective.
464 @param room_jid: leave empty string to generate a unique room name 461
465 """ 462 @param invited (list[unicode]): JIDs of the contacts to play with
466 profile = ISATSession(self.session).profile 463 @param room_jid (unicode): room JID or empty string to generate a unique name
467 try: 464 """
468 if room_jid != "": 465 profile = ISATSession(self.session).profile
469 room_jid = JID(room_jid).userhost()
470 except:
471 log.warning('Invalid room jid')
472 return
473 self.sat_host.bridge.radiocolLaunch(invited, room_jid, profile) 466 self.sat_host.bridge.radiocolLaunch(invited, room_jid, profile)
474 467
475 def jsonrpc_getEntitiesData(self, jids, keys): 468 def jsonrpc_getEntitiesData(self, jids, keys):
476 """Get cached data for several entities at once 469 """Get cached data for several entities at once
477 470