diff src/server/server.py @ 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 e8b133b77aa4
children 0c0551967bdf
line wrap: on
line diff
--- 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)