Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0297.py @ 2698:5060cbeec01e
core: minor style/typos fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Dec 2018 10:04:17 +0100 |
parents | 56f94936df1e |
children | 003b8b4b56a7 |
comparison
equal
deleted
inserted
replaced
2697:fcc945537d5f | 2698:5060cbeec01e |
---|---|
32 from wokkel.subprotocols import XMPPHandler | 32 from wokkel.subprotocols import XMPPHandler |
33 from zope.interface import implements | 33 from zope.interface import implements |
34 | 34 |
35 from twisted.words.xish import domish | 35 from twisted.words.xish import domish |
36 | 36 |
37 NS_SF = C.NS_FORWARD | |
38 | |
39 PLUGIN_INFO = { | 37 PLUGIN_INFO = { |
40 C.PI_NAME: u"Stanza Forwarding", | 38 C.PI_NAME: u"Stanza Forwarding", |
41 C.PI_IMPORT_NAME: u"XEP-0297", | 39 C.PI_IMPORT_NAME: u"XEP-0297", |
42 C.PI_TYPE: u"XEP", | 40 C.PI_TYPE: u"XEP", |
43 C.PI_PROTOCOLS: [u"XEP-0297"], | 41 C.PI_PROTOCOLS: [u"XEP-0297"], |
49 | 47 |
50 class XEP_0297(object): | 48 class XEP_0297(object): |
51 # FIXME: check this implementation which doesn't seems to be used | 49 # FIXME: check this implementation which doesn't seems to be used |
52 | 50 |
53 def __init__(self, host): | 51 def __init__(self, host): |
54 log.info(_("Stanza Forwarding plugin initialization")) | 52 log.info(_(u"Stanza Forwarding plugin initialization")) |
55 self.host = host | 53 self.host = host |
56 | 54 |
57 def getHandler(self, client): | 55 def getHandler(self, client): |
58 return XEP_0297_handler(self, client.profile) | 56 return XEP_0297_handler(self, client.profile) |
59 | 57 |
93 | 91 |
94 body_elt = domish.Element((None, "body")) | 92 body_elt = domish.Element((None, "body")) |
95 if body: | 93 if body: |
96 body_elt.addContent(body) | 94 body_elt.addContent(body) |
97 | 95 |
98 forwarded_elt = domish.Element((NS_SF, "forwarded")) | 96 forwarded_elt = domish.Element((C.NS_FORWARD, "forwarded")) |
99 delay_elt = self.host.plugins["XEP-0203"].delay(stamp) | 97 delay_elt = self.host.plugins["XEP-0203"].delay(stamp) |
100 forwarded_elt.addChild(delay_elt) | 98 forwarded_elt.addChild(delay_elt) |
101 if not stanza.uri: # None or '' | 99 if not stanza.uri: # None or '' |
102 XEP_0297.updateUri(stanza, "jabber:client") | 100 XEP_0297.updateUri(stanza, "jabber:client") |
103 forwarded_elt.addChild(stanza) | 101 forwarded_elt.addChild(stanza) |
116 self.plugin_parent = plugin_parent | 114 self.plugin_parent = plugin_parent |
117 self.host = plugin_parent.host | 115 self.host = plugin_parent.host |
118 self.profile = profile | 116 self.profile = profile |
119 | 117 |
120 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): | 118 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): |
121 return [disco.DiscoFeature(NS_SF)] | 119 return [disco.DiscoFeature(C.NS_FORWARD)] |
122 | 120 |
123 def getDiscoItems(self, requestor, target, nodeIdentifier=""): | 121 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
124 return [] | 122 return [] |