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.
This commit is contained in:
parent
a2c151f9c6
commit
503f8644ba
1 changed files with 20 additions and 16 deletions
|
|
@ -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 @@ try:
|
|||
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 @@ class XEP_0334(object):
|
|||
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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue