changeset 913:58f611481e6d

server, browser: removed deprecated methods which have been removed from backend, and associated code
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 19:25:52 +0200
parents 1ced5b522ae2
children 0c0551967bdf
files src/browser/libervia_main.py src/browser/sat_browser/json.py src/server/server.py
diffstat 3 files changed, 3 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Wed Aug 10 23:22:49 2016 +0200
+++ b/src/browser/libervia_main.py	Sun Aug 28 19:25:52 2016 +0200
@@ -599,18 +599,6 @@
         self.setSelected(wid)
         return wid
 
-    def askConfirmationHandler(self, confirmation_id, confirmation_type, data):
-        answer_data = {}
-
-        def confirm_cb(result):
-            self.bridge.call('confirmationAnswer', None, confirmation_id, result, answer_data)
-
-        if confirmation_type == "YES/NO":
-            dialog.ConfirmDialog(confirm_cb, text=data["message"], title=data["title"]).show()
-
-    def _newAlert(self, message, title, alert_type):
-        dialog.InfoDialog(title, message).show()
-
     def isHidden(self):
         """Tells if the frontend window is hidden.
 
--- a/src/browser/sat_browser/json.py	Wed Aug 10 23:22:49 2016 +0200
+++ b/src/browser/sat_browser/json.py	Sun Aug 28 19:25:52 2016 +0200
@@ -182,8 +182,8 @@
                          "tarotGamePlayCards", "launchRadioCollective",
                          "getWaitingSub", "subscription", "delContact", "updateContact", "getCard",
                          "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction",
-                         "disconnect", "chatStateComposing", "getNewAccountDomain", "confirmationAnswer",
-                         "syntaxConvert", "getAccountDialogUI", "getMainResource", "getWaitingConf", "getEntitiesData",
+                         "disconnect", "chatStateComposing", "getNewAccountDomain",
+                         "syntaxConvert", "getAccountDialogUI", "getMainResource", "getEntitiesData",
                          "getVersion", "getLiberviaVersion", "mucGetDefaultService", "getFeatures",
                         ])
 
--- a/src/server/server.py	Wed Aug 10 23:22:49 2016 +0200
+++ b/src/server/server.py	Sun Aug 28 19:25:52 2016 +0200
@@ -318,40 +318,6 @@
         f.childNotFound = self.childNotFound
         return f
 
-class SATActionIDHandler(object):
-    """Manage SàT action action_id lifecycle"""
-    ID_LIFETIME = 30  # after this time (in seconds), action_id will be suppressed and action result will be ignored
-
-    def __init__(self):
-        self.waiting_ids = {}
-
-    def waitForId(self, callback, action_id, profile, *args, **kwargs):
-        """Wait for an action result
-
-        @param callback: method to call when action gave a result back
-        @param action_id: action_id to wait for
-        @param profile: %(doc_profile)s
-        @param *args: additional argument to pass to callback
-        @param **kwargs: idem
-        """
-        action_tuple = (action_id, profile)
-        self.waiting_ids[action_tuple] = (callback, args, kwargs)
-        reactor.callLater(self.ID_LIFETIME, self.purgeID, action_tuple)
-
-    def purgeID(self, action_tuple):
-        """Called when an action_id has not be handled in time"""
-        if action_tuple in self.waiting_ids:
-            log.warning(u"action of action_id %s [%s] has not been managed, action_id is now ignored" % action_tuple)
-            del self.waiting_ids[action_tuple]
-
-    def actionResultCb(self, answer_type, action_id, data, profile):
-        """Manage the actionResult signal"""
-        action_tuple = (action_id, profile)
-        if action_tuple in self.waiting_ids:
-            callback, args, kwargs = self.waiting_ids[action_tuple]
-            del self.waiting_ids[action_tuple]
-            callback(answer_type, action_id, data, *args, **kwargs)
-
 
 class JSONRPCMethodManager(jsonrpc.JSONRPC):
 
@@ -450,11 +416,6 @@
         profile = ISATSession(self.session).profile
         return self.sat_host.bridge.getWaitingSub(profile)
 
-    def jsonrpc_getWaitingConf(self):
-        """Return list of waiting confirmations"""
-        profile = ISATSession(self.session).profile
-        return self.sat_host.bridge.getWaitingConf(profile)
-
     def jsonrpc_setStatus(self, presence, status):
         """Change the presence and/or status
         @param presence: value from ("", "chat", "away", "dnd", "xa")
@@ -869,11 +830,6 @@
         d = self.asyncBridgeCall("getNewAccountDomain")
         return d
 
-    def jsonrpc_confirmationAnswer(self, confirmation_id, result, answer_data):
-        """Send the user's answer to any previous 'askConfirmation' signal"""
-        profile = ISATSession(self.session).profile
-        self.sat_host.bridge.confirmationAnswer(confirmation_id, result, answer_data, profile)
-
     def jsonrpc_syntaxConvert(self, text, syntax_from=C.SYNTAX_XHTML, syntax_to=C.SYNTAX_CURRENT):
         """ Convert a text between two syntaxes
         @param text: text to convert
@@ -1490,7 +1446,6 @@
         self.signal_handler.plugRegister(_register)
         self.sessions = {}  # key = session value = user
         self.prof_connected = set()  # Profiles connected
-        self.action_handler = SATActionIDHandler()
 
         ## bridge ##
         try:
@@ -1502,10 +1457,9 @@
         def backendReady(dummy):
             self.bridge.register("connected", self.signal_handler.connected)
             self.bridge.register("disconnected", self.signal_handler.disconnected)
-            self.bridge.register("actionResult", self.action_handler.actionResultCb)
             #core
             for signal_name in ['presenceUpdate', 'messageNew', 'subscribe', 'contactDeleted',
-                                'newContact', 'entityDataUpdated', 'askConfirmation', 'newAlert', 'paramUpdate']:
+                                'newContact', 'entityDataUpdated', 'paramUpdate']:
                 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
             # XXX: actionNew is handled separately because the handler must manage security_limit
             self.bridge.register('actionNew', self.signal_handler.actionNewHandler)