diff --git a/sat/bridge/bridge_constructor/bridge_template.ini b/sat/bridge/bridge_constructor/bridge_template.ini index 98d9ad69..afa86010 100644 --- a/sat/bridge/bridge_constructor/bridge_template.ini +++ b/sat/bridge/bridge_constructor/bridge_template.ini @@ -623,7 +623,7 @@ doc_param_3=between: True if we want history between the two jids (in both direc doc_param_4=filters: patterns to filter the history results, can be: - body: pattern must be in message body - search: pattern must be in message body or source resource - - types: type must one of those, values are separated by spaces + - types: type must be one of those, values are separated by spaces - not_types: type must not be one of those, values are separated by spaces doc_param_5=%(doc_profile)s doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile) diff --git a/sat/memory/memory.py b/sat/memory/memory.py index c8d94ab9..92174d32 100644 --- a/sat/memory/memory.py +++ b/sat/memory/memory.py @@ -630,28 +630,13 @@ class Memory(object): def addToHistory(self, client, data): return self.storage.addToHistory(data, client.profile) - def _historyGet( - self, - from_jid_s, - to_jid_s, - limit=C.HISTORY_LIMIT_NONE, - between=True, - filters=None, - profile=C.PROF_KEY_NONE, - ): - return self.historyGet( - jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, filters, profile - ) + def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True, + filters=None, profile=C.PROF_KEY_NONE): + return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, + filters, profile) - def historyGet( - self, - from_jid, - to_jid, - limit=C.HISTORY_LIMIT_NONE, - between=True, - filters=None, - profile=C.PROF_KEY_NONE, - ): + def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, + filters=None, profile=C.PROF_KEY_NONE): """Retrieve messages in history @param from_jid (JID): source JID (full, or bare for catchall) @@ -661,7 +646,8 @@ class Memory(object): - C.HISTORY_LIMIT_NONE or None for unlimited - C.HISTORY_LIMIT_DEFAULT to use the HISTORY_LIMIT parameter value @param between (bool): confound source and dest (ignore the direction) - @param filters (str): pattern to filter the history results (see bridge API for details) + @param filters (dict[unicode, unicode]): pattern to filter the history results + (see bridge API for details) @param profile (str): %(doc_profile)s @return (D(list)): list of message data as in [messageNew] """ diff --git a/sat/plugins/plugin_xep_0280.py b/sat/plugins/plugin_xep_0280.py index 3abe915f..8d2fd106 100755 --- a/sat/plugins/plugin_xep_0280.py +++ b/sat/plugins/plugin_xep_0280.py @@ -23,7 +23,6 @@ from sat.core.log import getLogger log = getLogger(__name__) from sat.core import exceptions from sat.core.constants import Const as C -from sat.core.xmpp import SatMessageProtocol from twisted.words.protocols.jabber.error import StanzaError from twisted.internet import defer from wokkel import disco, iwokkel @@ -148,9 +147,9 @@ class XEP_0280(object): message_elt.addChild(c) return True elif carbons_elt.name == "sent": - # on send we parse the message and just add it to history + # on sent we parse the message and just add it to history # and send it to frontends (without normal sending treatments) - mess_data = SatMessageProtocol.parseMessage(cc_message_elt, client) + mess_data = client.messageProt.parseMessage(cc_message_elt) if not mess_data["message"] and not mess_data["subject"]: return False client.messageAddToHistory(mess_data) diff --git a/sat/plugins/plugin_xep_0297.py b/sat/plugins/plugin_xep_0297.py index f6df3355..7f0ab7c0 100644 --- a/sat/plugins/plugin_xep_0297.py +++ b/sat/plugins/plugin_xep_0297.py @@ -34,8 +34,6 @@ from zope.interface import implements from twisted.words.xish import domish -NS_SF = C.NS_FORWARD - PLUGIN_INFO = { C.PI_NAME: u"Stanza Forwarding", C.PI_IMPORT_NAME: u"XEP-0297", @@ -51,7 +49,7 @@ class XEP_0297(object): # FIXME: check this implementation which doesn't seems to be used def __init__(self, host): - log.info(_("Stanza Forwarding plugin initialization")) + log.info(_(u"Stanza Forwarding plugin initialization")) self.host = host def getHandler(self, client): @@ -95,7 +93,7 @@ class XEP_0297(object): if body: body_elt.addContent(body) - forwarded_elt = domish.Element((NS_SF, "forwarded")) + forwarded_elt = domish.Element((C.NS_FORWARD, "forwarded")) delay_elt = self.host.plugins["XEP-0203"].delay(stamp) forwarded_elt.addChild(delay_elt) if not stanza.uri: # None or '' @@ -118,7 +116,7 @@ class XEP_0297_handler(XMPPHandler): self.profile = profile def getDiscoInfo(self, requestor, target, nodeIdentifier=""): - return [disco.DiscoFeature(NS_SF)] + return [disco.DiscoFeature(C.NS_FORWARD)] def getDiscoItems(self, requestor, target, nodeIdentifier=""): return [] diff --git a/sat/plugins/plugin_xep_0334.py b/sat/plugins/plugin_xep_0334.py index 081d961c..f740993e 100644 --- a/sat/plugins/plugin_xep_0334.py +++ b/sat/plugins/plugin_xep_0334.py @@ -28,10 +28,7 @@ from sat.tools.common import data_format from wokkel import disco, iwokkel -try: - from twisted.words.protocols.xmlstream import XMPPHandler -except ImportError: - from wokkel.subprotocols import XMPPHandler +from twisted.words.protocols.jabber import xmlstream from zope.interface import implements from textwrap import dedent @@ -127,7 +124,7 @@ class XEP_0334(object): return True -class XEP_0334_handler(XMPPHandler): +class XEP_0334_handler(xmlstream.XMPPHandler): implements(iwokkel.IDisco) def getDiscoInfo(self, requestor, target, nodeIdentifier=""):