core: minor style/typos fixes

This commit is contained in:
Goffi 2018-12-01 10:04:17 +01:00
commit a29893ac1f
3 changed files with 16 additions and 36 deletions

View file

@ -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)

View file

@ -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 []

View file

@ -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=""):