changeset 2698:5060cbeec01e

core: minor style/typos fixes
author Goffi <goffi@goffi.org>
date Sat, 01 Dec 2018 10:04:17 +0100
parents fcc945537d5f
children 310e41bd6666
files sat/bridge/bridge_constructor/bridge_template.ini sat/memory/memory.py sat/plugins/plugin_xep_0280.py sat/plugins/plugin_xep_0297.py sat/plugins/plugin_xep_0334.py
diffstat 5 files changed, 16 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/bridge_template.ini	Sat Dec 01 09:59:48 2018 +0100
+++ b/sat/bridge/bridge_constructor/bridge_template.ini	Sat Dec 01 10:04:17 2018 +0100
@@ -623,7 +623,7 @@
 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)
--- a/sat/memory/memory.py	Sat Dec 01 09:59:48 2018 +0100
+++ b/sat/memory/memory.py	Sat Dec 01 10:04:17 2018 +0100
@@ -630,28 +630,13 @@
     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 @@
             - 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]
         """
--- a/sat/plugins/plugin_xep_0280.py	Sat Dec 01 09:59:48 2018 +0100
+++ b/sat/plugins/plugin_xep_0280.py	Sat Dec 01 10:04:17 2018 +0100
@@ -23,7 +23,6 @@
 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 @@
                 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)
--- a/sat/plugins/plugin_xep_0297.py	Sat Dec 01 09:59:48 2018 +0100
+++ b/sat/plugins/plugin_xep_0297.py	Sat Dec 01 10:04:17 2018 +0100
@@ -34,8 +34,6 @@
 
 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 @@
     # 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 @@
         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 @@
         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 []
--- a/sat/plugins/plugin_xep_0334.py	Sat Dec 01 09:59:48 2018 +0100
+++ b/sat/plugins/plugin_xep_0334.py	Sat Dec 01 10:04:17 2018 +0100
@@ -28,10 +28,7 @@
 
 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 @@
         return True
 
 
-class XEP_0334_handler(XMPPHandler):
+class XEP_0334_handler(xmlstream.XMPPHandler):
     implements(iwokkel.IDisco)
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=""):