core: minor style/typos fixes
This commit is contained in:
parent
af64d24d52
commit
a29893ac1f
5 changed files with 16 additions and 36 deletions
|
|
@ -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:
|
doc_param_4=filters: patterns to filter the history results, can be:
|
||||||
- body: pattern must be in message body
|
- body: pattern must be in message body
|
||||||
- search: pattern must be in message body or source resource
|
- 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
|
- not_types: type must not be one of those, values are separated by spaces
|
||||||
doc_param_5=%(doc_profile)s
|
doc_param_5=%(doc_profile)s
|
||||||
doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile)
|
doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile)
|
||||||
|
|
|
||||||
|
|
@ -630,28 +630,13 @@ class Memory(object):
|
||||||
def addToHistory(self, client, data):
|
def addToHistory(self, client, data):
|
||||||
return self.storage.addToHistory(data, client.profile)
|
return self.storage.addToHistory(data, client.profile)
|
||||||
|
|
||||||
def _historyGet(
|
def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True,
|
||||||
self,
|
filters=None, profile=C.PROF_KEY_NONE):
|
||||||
from_jid_s,
|
return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between,
|
||||||
to_jid_s,
|
filters, profile)
|
||||||
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(
|
def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True,
|
||||||
self,
|
filters=None, profile=C.PROF_KEY_NONE):
|
||||||
from_jid,
|
|
||||||
to_jid,
|
|
||||||
limit=C.HISTORY_LIMIT_NONE,
|
|
||||||
between=True,
|
|
||||||
filters=None,
|
|
||||||
profile=C.PROF_KEY_NONE,
|
|
||||||
):
|
|
||||||
"""Retrieve messages in history
|
"""Retrieve messages in history
|
||||||
|
|
||||||
@param from_jid (JID): source JID (full, or bare for catchall)
|
@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_NONE or None for unlimited
|
||||||
- C.HISTORY_LIMIT_DEFAULT to use the HISTORY_LIMIT parameter value
|
- C.HISTORY_LIMIT_DEFAULT to use the HISTORY_LIMIT parameter value
|
||||||
@param between (bool): confound source and dest (ignore the direction)
|
@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
|
@param profile (str): %(doc_profile)s
|
||||||
@return (D(list)): list of message data as in [messageNew]
|
@return (D(list)): list of message data as in [messageNew]
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ from sat.core.log import getLogger
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
from sat.core import exceptions
|
from sat.core import exceptions
|
||||||
from sat.core.constants import Const as C
|
from sat.core.constants import Const as C
|
||||||
from sat.core.xmpp import SatMessageProtocol
|
|
||||||
from twisted.words.protocols.jabber.error import StanzaError
|
from twisted.words.protocols.jabber.error import StanzaError
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from wokkel import disco, iwokkel
|
from wokkel import disco, iwokkel
|
||||||
|
|
@ -148,9 +147,9 @@ class XEP_0280(object):
|
||||||
message_elt.addChild(c)
|
message_elt.addChild(c)
|
||||||
return True
|
return True
|
||||||
elif carbons_elt.name == "sent":
|
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)
|
# 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"]:
|
if not mess_data["message"] and not mess_data["subject"]:
|
||||||
return False
|
return False
|
||||||
client.messageAddToHistory(mess_data)
|
client.messageAddToHistory(mess_data)
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ from zope.interface import implements
|
||||||
|
|
||||||
from twisted.words.xish import domish
|
from twisted.words.xish import domish
|
||||||
|
|
||||||
NS_SF = C.NS_FORWARD
|
|
||||||
|
|
||||||
PLUGIN_INFO = {
|
PLUGIN_INFO = {
|
||||||
C.PI_NAME: u"Stanza Forwarding",
|
C.PI_NAME: u"Stanza Forwarding",
|
||||||
C.PI_IMPORT_NAME: u"XEP-0297",
|
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
|
# FIXME: check this implementation which doesn't seems to be used
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
log.info(_("Stanza Forwarding plugin initialization"))
|
log.info(_(u"Stanza Forwarding plugin initialization"))
|
||||||
self.host = host
|
self.host = host
|
||||||
|
|
||||||
def getHandler(self, client):
|
def getHandler(self, client):
|
||||||
|
|
@ -95,7 +93,7 @@ class XEP_0297(object):
|
||||||
if body:
|
if body:
|
||||||
body_elt.addContent(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)
|
delay_elt = self.host.plugins["XEP-0203"].delay(stamp)
|
||||||
forwarded_elt.addChild(delay_elt)
|
forwarded_elt.addChild(delay_elt)
|
||||||
if not stanza.uri: # None or ''
|
if not stanza.uri: # None or ''
|
||||||
|
|
@ -118,7 +116,7 @@ class XEP_0297_handler(XMPPHandler):
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
|
|
||||||
def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
|
def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
|
||||||
return [disco.DiscoFeature(NS_SF)]
|
return [disco.DiscoFeature(C.NS_FORWARD)]
|
||||||
|
|
||||||
def getDiscoItems(self, requestor, target, nodeIdentifier=""):
|
def getDiscoItems(self, requestor, target, nodeIdentifier=""):
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,7 @@ from sat.tools.common import data_format
|
||||||
|
|
||||||
from wokkel import disco, iwokkel
|
from wokkel import disco, iwokkel
|
||||||
|
|
||||||
try:
|
from twisted.words.protocols.jabber import xmlstream
|
||||||
from twisted.words.protocols.xmlstream import XMPPHandler
|
|
||||||
except ImportError:
|
|
||||||
from wokkel.subprotocols import XMPPHandler
|
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
|
|
@ -127,7 +124,7 @@ class XEP_0334(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class XEP_0334_handler(XMPPHandler):
|
class XEP_0334_handler(xmlstream.XMPPHandler):
|
||||||
implements(iwokkel.IDisco)
|
implements(iwokkel.IDisco)
|
||||||
|
|
||||||
def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
|
def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue