comparison libervia.tac @ 137:b145da69a218

server + browser side: new api fix
author Goffi <goffi@goffi.org>
date Mon, 22 Oct 2012 00:08:41 +0200
parents ceef355156de
children 09a512d9a0c0
comparison
equal deleted inserted replaced
136:9d7d98954e34 137:b145da69a218
250 def show(result_dbus): 250 def show(result_dbus):
251 result = [] 251 result = []
252 for line in result_dbus: 252 for line in result_dbus:
253 #XXX: we have to do this stupid thing because Python D-Bus use its own types instead of standard types 253 #XXX: we have to do this stupid thing because Python D-Bus use its own types instead of standard types
254 # and txJsonRPC doesn't accept D-Bus types, resulting in a empty query 254 # and txJsonRPC doesn't accept D-Bus types, resulting in a empty query
255 timestamp, from_jid, to_jid, message = line 255 timestamp, from_jid, to_jid, message, mess_type = line
256 result.append((float(timestamp), unicode(from_jid), unicode(to_jid), unicode(message))) 256 result.append((float(timestamp), unicode(from_jid), unicode(to_jid), unicode(message), unicode(mess_type)))
257 return result 257 return result
258 d.addCallback(show) 258 d.addCallback(show)
259 return d 259 return d
260 260
261 def jsonrpc_joinMUC(self, room_jid, nick): 261 def jsonrpc_joinMUC(self, room_jid, nick):
302 def jsonrpc_launchRadioCollective(self, invited): 302 def jsonrpc_launchRadioCollective(self, invited):
303 """Create a room, invite people, and start a radio collective""" 303 """Create a room, invite people, and start a radio collective"""
304 profile = ISATSession(self.session).profile 304 profile = ISATSession(self.session).profile
305 self.sat_host.bridge.radiocolLaunch(invited, profile) 305 self.sat_host.bridge.radiocolLaunch(invited, profile)
306 306
307 def jsonrpc_getCardCache(self, jid): 307 def jsonrpc_getEntityData(self, jid, keys):
308 """Get the avatar of a contact 308 """Get cached data for an entit
309 @param jid: jid of contact from who we want the avatar 309 @param jid: jid of contact from who we want data
310 @return: path to the avatar image""" 310 @param keys: name of data we want (list)
311 profile = ISATSession(self.session).profile 311 @return: requested data"""
312 return self.sat_host.bridge.getCardCache(jid, profile) 312 profile = ISATSession(self.session).profile
313 return self.sat_host.bridge.getEntityData(jid, keys, profile)
313 314
314 class Register(jsonrpc.JSONRPC): 315 class Register(jsonrpc.JSONRPC):
315 """This class manage the registration procedure with SàT 316 """This class manage the registration procedure with SàT
316 It provide an api for the browser, check password and setup the web server""" 317 It provide an api for the browser, check password and setup the web server"""
317 318
689 sys.exit(1) 690 sys.exit(1)
690 self.bridge.register("connected", self.signal_handler.connected) 691 self.bridge.register("connected", self.signal_handler.connected)
691 self.bridge.register("connectionError", self.signal_handler.connectionError) 692 self.bridge.register("connectionError", self.signal_handler.connectionError)
692 self.bridge.register("actionResult", self.action_handler.actionResultCb) 693 self.bridge.register("actionResult", self.action_handler.actionResultCb)
693 #core 694 #core
694 for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', 'newContact', 'updatedValue']: 695 for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', 'newContact', 'entityDataUpdated']:
695 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) 696 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
696 #plugins 697 #plugins
697 for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', 698 for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat',
698 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 699 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore',
699 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected']: 700 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected']: