diff src/core/sat_main.py @ 2113:9c861d07b5b6

core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
author Goffi <goffi@goffi.org>
date Thu, 05 Jan 2017 22:22:13 +0100
parents c96fe007ca41
children 2f264f3df280
line wrap: on
line diff
--- a/src/core/sat_main.py	Thu Jan 05 20:37:01 2017 +0100
+++ b/src/core/sat_main.py	Thu Jan 05 22:22:13 2017 +0100
@@ -118,6 +118,7 @@
         self.bridge.register_method("discoItems", self.memory.disco._discoItems)
         self.bridge.register_method("saveParamsTemplate", self.memory.save_xml)
         self.bridge.register_method("loadParamsTemplate", self.memory.load_xml)
+        self.bridge.register_method("sessionInfosGet", self.getSessionInfos)
 
         self.memory.initialized.addCallback(self._postMemoryInit)
 
@@ -1077,8 +1078,8 @@
         return ret
 
     def getMenuHelp(self, menu_id, language=''):
-        """
-        return the help string of the menu
+        """return the help string of the menu
+
         @param menu_id: id of the menu (same as callback_id)
         @param language: language used for translation, or empty string for default
         @param return: translated help
@@ -1092,3 +1093,12 @@
         help_string = _(menu_data['help_string'])
         languageSwitch()
         return help_string
+
+    def getSessionInfos(self, profile_key):
+        """compile interesting data on current profile session"""
+        client = self.getClient(profile_key)
+        data = {
+            "jid": client.jid.full(),
+            "started": unicode(int(client.started)),
+            }
+        return defer.succeed(data)