comparison libervia.tac @ 20:8f4b1a8914c3

- User status is now updated - by default, the uniBar target the status - clicking on user's status unselect the selected widget
author Goffi <goffi@goffi.org>
date Sat, 16 Apr 2011 18:06:02 +0200
parents e8e3704eb97f
children 28e203f13144
comparison
equal deleted inserted replaced
19:e8e3704eb97f 20:8f4b1a8914c3
63 63
64 def jsonrpc_getContacts(self): 64 def jsonrpc_getContacts(self):
65 """Return all passed args.""" 65 """Return all passed args."""
66 profile = self.session.sat_profile 66 profile = self.session.sat_profile
67 return self.sat_host.bridge.getContacts(profile) 67 return self.sat_host.bridge.getContacts(profile)
68
69 def jsonrpc_setStatus(self, status):
70 """Change the status"""
71 profile = self.session.sat_profile
72 print "new status received:", status
73 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile)
74
68 75
69 def jsonrpc_sendMessage(self, to_jid, msg, subject, type): 76 def jsonrpc_sendMessage(self, to_jid, msg, subject, type):
70 """send message""" 77 """send message"""
71 profile = self.session.sat_profile 78 profile = self.session.sat_profile
72 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, type, profile) 79 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, type, profile)
82 #This text if for the public microblog 89 #This text if for the public microblog
83 print "Sending message to everybody" 90 print "Sending message to everybody"
84 return self.sat_host.bridge.sendPersonalEvent("MICROBLOG", {'content':text}, profile) 91 return self.sat_host.bridge.sendPersonalEvent("MICROBLOG", {'content':text}, profile)
85 else: 92 else:
86 return self.sat_host.bridge.sendGroupBlog([recip], text, profile) 93 return self.sat_host.bridge.sendGroupBlog([recip], text, profile)
94
95 def jsonrpc_getPresenceStatus(self):
96 """Get Presence information for connected contacts"""
97 profile = self.session.sat_profile
98 return self.sat_host.bridge.getPresenceStatus(profile)
87 99
88 def jsonrpc_getHistory(self, from_jid, to_jid, size): 100 def jsonrpc_getHistory(self, from_jid, to_jid, size):
89 """Return history for the from_jid/to_jid couple""" 101 """Return history for the from_jid/to_jid couple"""
90 #FIXME: this method should definitely be asynchrone, need to fix it !!! 102 #FIXME: this method should definitely be asynchrone, need to fix it !!!
91 profile = self.session.sat_profile 103 profile = self.session.sat_profile
308 print(u"Can't connect to SàT backend, are you sure it's launched ?") 320 print(u"Can't connect to SàT backend, are you sure it's launched ?")
309 import sys 321 import sys
310 sys.exit(1) 322 sys.exit(1)
311 self.bridge.register("connected", self.signal_handler.connected) 323 self.bridge.register("connected", self.signal_handler.connected)
312 self.bridge.register("connectionError", self.signal_handler.connectionError) 324 self.bridge.register("connectionError", self.signal_handler.connectionError)
313 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage']: 325 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'presenceUpdate']:
314 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) 326 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
315 root.putChild('json_signal_api', self.signal_handler) 327 root.putChild('json_signal_api', self.signal_handler)
316 root.putChild('json_api', MethodHandler(self)) 328 root.putChild('json_api', MethodHandler(self))
317 root.putChild('register_api', _register) 329 root.putChild('register_api', _register)
318 root.putChild('blog', MicroBlog(self)) 330 root.putChild('blog', MicroBlog(self))