diff src/plugins/plugin_xep_0334.py @ 2132:c0577837680a

core: replaced SkipHistory exception by a key in mess_data: SkipHistory was skipping all remaining triggers just to skip history, which is not the intented behaviour. Now history can be skipped by setting mess_data[u'history'] = C.HISTORY_SKIP, this way we won't skip importants triggers. When history is skipped, mess_data[u'extra'][u'history'] will be set to C.HISTORY_SKIP for frontends, so they can inform user that the message is not stored locally.
author Goffi <goffi@goffi.org>
date Sun, 05 Feb 2017 14:55:21 +0100
parents 628c1c95f442
children 1d3f73e065e1
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0334.py	Sun Feb 05 14:55:19 2017 +0100
+++ b/src/plugins/plugin_xep_0334.py	Sun Feb 05 14:55:21 2017 +0100
@@ -21,8 +21,8 @@
 from sat.core.i18n import _, D_
 from sat.core.log import getLogger
 log = getLogger(__name__)
+from sat.core.constants import Const as C
 
-from sat.core import exceptions
 from sat.tools.common import data_format
 
 from wokkel import disco, iwokkel
@@ -30,7 +30,6 @@
     from twisted.words.protocols.xmlstream import XMPPHandler
 except ImportError:
     from wokkel.subprotocols import XMPPHandler
-from twisted.python import failure
 from zope.interface import implements
 from textwrap import dedent
 
@@ -95,9 +94,8 @@
         return True
 
     def _receivedSkipHistory(self, mess_data):
-        mess_data[u'extra'][u'history'] == u'skipped'
-        raise failure.Failure(exceptions.SkipHistory())
-
+        mess_data[u'history'] = C.HISTORY_SKIP
+        return mess_data
 
     def messageReceivedTrigger(self, client, message_elt, post_treat):
         """Check for hints in the received message"""