diff 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
line wrap: on
line diff
--- a/libervia.tac	Sat Apr 16 01:46:01 2011 +0200
+++ b/libervia.tac	Sat Apr 16 18:06:02 2011 +0200
@@ -65,6 +65,13 @@
         """Return all passed args."""
         profile = self.session.sat_profile
         return self.sat_host.bridge.getContacts(profile)
+
+    def jsonrpc_setStatus(self, status):
+        """Change the status"""
+        profile = self.session.sat_profile
+        print "new status received:", status
+        self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile)
+
     
     def jsonrpc_sendMessage(self, to_jid, msg, subject, type):
         """send message"""
@@ -85,6 +92,11 @@
             else:
                 return self.sat_host.bridge.sendGroupBlog([recip], text, profile)
 
+    def jsonrpc_getPresenceStatus(self):
+        """Get Presence information for connected contacts"""
+        profile = self.session.sat_profile
+        return self.sat_host.bridge.getPresenceStatus(profile) 
+
     def jsonrpc_getHistory(self, from_jid, to_jid, size):
         """Return history for the from_jid/to_jid couple"""
         #FIXME: this method should definitely be asynchrone, need to fix it !!!
@@ -310,7 +322,7 @@
             sys.exit(1)
         self.bridge.register("connected", self.signal_handler.connected)
         self.bridge.register("connectionError", self.signal_handler.connectionError)
-        for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage']:
+        for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'presenceUpdate']:
             self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
         root.putChild('json_signal_api', self.signal_handler)
         root.putChild('json_api', MethodHandler(self))