# HG changeset patch # User Goffi # Date 1486302956 -3600 # Node ID 410e7a940a8ba7b512ac23264f4821f968321b28 # Parent cc3a6aea9508b4864271876330473d24922ba4a6 plugin XEP-0297: used sendMessage in forward, and added comment/warning: this method need to be checked as it is not used currently, and it may need better integration in the current message sending workflow diff -r cc3a6aea9508 -r 410e7a940a8b src/plugins/plugin_xep_0297.py --- a/src/plugins/plugin_xep_0297.py Sun Feb 05 14:55:54 2017 +0100 +++ b/src/plugins/plugin_xep_0297.py Sun Feb 05 14:55:56 2017 +0100 @@ -19,7 +19,7 @@ # along with this program. If not, see . from sat.core.constants import Const as C -from sat.core.i18n import _ +from sat.core.i18n import _, D_ from sat.core.log import getLogger log = getLogger(__name__) @@ -35,17 +35,18 @@ NS_SF = C.NS_FORWARD PLUGIN_INFO = { - "name": "Stanza Forwarding", - "import_name": "XEP-0297", - "type": "XEP", - "protocols": ["XEP-0297"], - "main": "XEP_0297", - "handler": "yes", - "description": _("""Implementation of Stanza Forwarding""") + u"name": u"Stanza Forwarding", + u"import_name": u"XEP-0297", + u"type": u"XEP", + u"protocols": [u"XEP-0297"], + u"main": "XEP_0297", + u"handler": u"yes", + u"description": D_(u"""Implementation of Stanza Forwarding""") } 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")) @@ -79,6 +80,9 @@ @param profile_key (unicode): %(doc_profile_key)s @return: a Deferred when the message has been sent """ + # FIXME: this method is not used and doesn't use mess_data which should be used for client.sendMessage + # should it be deprecated? A method constructing the element without sending it seems more natural + log.warning(u"THIS METHOD IS DEPRECATED") # FIXME: we use this warning until we check the method msg = domish.Element((None, 'message')) msg['to'] = to_jid.full() msg['type'] = stanza['type'] @@ -98,7 +102,7 @@ msg.addChild(forwarded_elt) client = self.host.getClient(profile_key) - return client.send(msg.toXml()) + return client.sendMessage({u'xml': msg}) class XEP_0297_handler(XMPPHandler):