Mercurial > libervia-web
comparison src/server/server.py @ 909:e8b133b77aa4
browser, server: update to get compatibility with 0.7-dev (not finished):
Q&D update to restore compatibility
- version changed to 0.7D
- contact list has been modified to be compatible with changes, but it doesn't take profit of improvment yet
- messageSend partially work, there is a disconnection and an error in console logs when sending a message
- message are not received yet
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 09 Aug 2016 01:07:15 +0200 |
parents | 763da94ba28b |
children | 58f611481e6d |
comparison
equal
deleted
inserted
replaced
908:f38b8be94131 | 909:e8b133b77aa4 |
---|---|
461 @param status: any string to describe your status | 461 @param status: any string to describe your status |
462 """ | 462 """ |
463 profile = ISATSession(self.session).profile | 463 profile = ISATSession(self.session).profile |
464 self.sat_host.bridge.setPresence('', presence, {'': status}, profile) | 464 self.sat_host.bridge.setPresence('', presence, {'': status}, profile) |
465 | 465 |
466 def jsonrpc_sendMessage(self, to_jid, msg, subject, type_, options={}): | 466 def jsonrpc_messageSend(self, to_jid, msg, subject, type_, extra={}): |
467 """send message""" | 467 """send message""" |
468 profile = ISATSession(self.session).profile | 468 profile = ISATSession(self.session).profile |
469 return self.asyncBridgeCall("sendMessage", to_jid, msg, subject, type_, options, profile) | 469 return self.asyncBridgeCall("messageSend", to_jid, msg, subject, type_, extra, profile) |
470 | 470 |
471 ## PubSub ## | 471 ## PubSub ## |
472 | 472 |
473 def jsonrpc_psDeleteNode(self, service, node): | 473 def jsonrpc_psDeleteNode(self, service, node): |
474 """Delete a whole node | 474 """Delete a whole node |
711 result.append((float(timestamp), unicode(from_jid), unicode(to_jid), unicode(message), unicode(mess_type), dict(extra))) | 711 result.append((float(timestamp), unicode(from_jid), unicode(to_jid), unicode(message), unicode(mess_type), dict(extra))) |
712 return result | 712 return result |
713 d.addCallback(show) | 713 d.addCallback(show) |
714 return d | 714 return d |
715 | 715 |
716 def jsonrpc_joinMUC(self, room_jid, nick): | 716 def jsonrpc_mucJoin(self, room_jid, nick): |
717 """Join a Multi-User Chat room | 717 """Join a Multi-User Chat room |
718 | 718 |
719 @param room_jid (unicode): room JID or empty string to generate a unique name | 719 @param room_jid (unicode): room JID or empty string to generate a unique name |
720 @param nick (unicode): user nick | 720 @param nick (unicode): user nick |
721 """ | 721 """ |
742 except: | 742 except: |
743 log.warning('Invalid room jid') | 743 log.warning('Invalid room jid') |
744 return | 744 return |
745 self.sat_host.bridge.mucLeave(room_jid.userhost(), profile) | 745 self.sat_host.bridge.mucLeave(room_jid.userhost(), profile) |
746 | 746 |
747 def jsonrpc_getRoomsJoined(self): | 747 def jsonrpc_mucGetRoomsJoined(self): |
748 """Return list of room already joined by user""" | 748 """Return list of room already joined by user""" |
749 profile = ISATSession(self.session).profile | 749 profile = ISATSession(self.session).profile |
750 return self.sat_host.bridge.getRoomsJoined(profile) | 750 return self.sat_host.bridge.mucGetRoomsJoined(profile) |
751 | 751 |
752 def jsonrpc_getRoomsSubjects(self): | 752 def jsonrpc_mucGetDefaultService(self): |
753 """Return list of room subjects""" | |
754 profile = ISATSession(self.session).profile | |
755 return self.sat_host.bridge.getRoomsSubjects(profile) | |
756 | |
757 def jsonrpc_getDefaultMUC(self): | |
758 """@return: the default MUC""" | 753 """@return: the default MUC""" |
759 d = self.asyncBridgeCall("getDefaultMUC") | 754 d = self.asyncBridgeCall("mucGetDefaultService") |
760 return d | 755 return d |
761 | 756 |
762 def jsonrpc_launchTarotGame(self, other_players, room_jid=""): | 757 def jsonrpc_launchTarotGame(self, other_players, room_jid=""): |
763 """Create a room, invite the other players and start a Tarot game. | 758 """Create a room, invite the other players and start a Tarot game. |
764 | 759 |
1507 def backendReady(dummy): | 1502 def backendReady(dummy): |
1508 self.bridge.register("connected", self.signal_handler.connected) | 1503 self.bridge.register("connected", self.signal_handler.connected) |
1509 self.bridge.register("disconnected", self.signal_handler.disconnected) | 1504 self.bridge.register("disconnected", self.signal_handler.disconnected) |
1510 self.bridge.register("actionResult", self.action_handler.actionResultCb) | 1505 self.bridge.register("actionResult", self.action_handler.actionResultCb) |
1511 #core | 1506 #core |
1512 for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', | 1507 for signal_name in ['presenceUpdate', 'messageNew', 'subscribe', 'contactDeleted', |
1513 'newContact', 'entityDataUpdated', 'askConfirmation', 'newAlert', 'paramUpdate']: | 1508 'newContact', 'entityDataUpdated', 'askConfirmation', 'newAlert', 'paramUpdate']: |
1514 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) | 1509 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) |
1515 # XXX: actionNew is handled separately because the handler must manage security_limit | 1510 # XXX: actionNew is handled separately because the handler must manage security_limit |
1516 self.bridge.register('actionNew', self.signal_handler.actionNewHandler) | 1511 self.bridge.register('actionNew', self.signal_handler.actionNewHandler) |
1517 #plugins | 1512 #plugins |
1518 for signal_name in ['psEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', | 1513 for signal_name in ['psEvent', 'mucRoomJoined', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', |
1519 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 'tarotGamePlayers', | 1514 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 'tarotGamePlayers', |
1520 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected', 'radiocolPlayers', | 1515 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected', 'radiocolPlayers', |
1521 'roomLeft', 'roomUserChangedNick', 'chatStateReceived']: | 1516 'mucRoomLeft', 'mucRoomUserChangedNick', 'chatStateReceived']: |
1522 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") | 1517 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") |
1523 self.media_dir = self.bridge.getConfig('', 'media_dir') | 1518 self.media_dir = self.bridge.getConfig('', 'media_dir') |
1524 self.local_dir = self.bridge.getConfig('', 'local_dir') | 1519 self.local_dir = self.bridge.getConfig('', 'local_dir') |
1525 | 1520 |
1526 ## URLs ## | 1521 ## URLs ## |