diff --git a/doap.xml b/doap.xml index 5644e192..80d812aa 100644 --- a/doap.xml +++ b/doap.xml @@ -856,7 +856,7 @@ complete - 0.3.0 + 0.4.0 1.6.0 diff --git a/slixmpp/plugins/xep_0424/__init__.py b/slixmpp/plugins/xep_0424/__init__.py index 57f87fc4..e6511ca5 100644 --- a/slixmpp/plugins/xep_0424/__init__.py +++ b/slixmpp/plugins/xep_0424/__init__.py @@ -4,7 +4,6 @@ # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.plugins.base import register_plugin -from slixmpp.plugins.xep_0424.stanza import * -from slixmpp.plugins.xep_0424.retraction import XEP_0424 +from .retraction import XEP_0424 register_plugin(XEP_0424) diff --git a/slixmpp/plugins/xep_0424/retraction.py b/slixmpp/plugins/xep_0424/retraction.py index 9931d69a..1e43a993 100644 --- a/slixmpp/plugins/xep_0424/retraction.py +++ b/slixmpp/plugins/xep_0424/retraction.py @@ -31,7 +31,7 @@ class XEP_0424(BasePlugin): stanza.register_plugins() self.xmpp.register_handler(Callback( "Message Retracted", - StanzaPath("message/apply_to/retract"), + StanzaPath("message/retract"), self._handle_retract_message, )) @@ -64,7 +64,6 @@ class XEP_0424(BasePlugin): if include_fallback: msg['body'] = fallback_text msg.enable('fallback') - msg['apply_to']['id'] = id - msg['apply_to'].enable('retract') + msg['retract']['id'] = id msg.enable('store') msg.send() diff --git a/slixmpp/plugins/xep_0424/stanza.py b/slixmpp/plugins/xep_0424/stanza.py index b225fadc..44660032 100644 --- a/slixmpp/plugins/xep_0424/stanza.py +++ b/slixmpp/plugins/xep_0424/stanza.py @@ -8,28 +8,27 @@ from slixmpp.xmlstream import ( ElementBase, register_stanza_plugin, ) -from slixmpp.plugins.xep_0422.stanza import ApplyTo -from slixmpp.plugins.xep_0359 import OriginID -NS = 'urn:xmpp:message-retract:0' +NS = 'urn:xmpp:message-retract:1' class Retract(ElementBase): namespace = NS name = 'retract' plugin_attrib = 'retract' + interfaces = {'reason', 'id'} + sub_interfaces = {'reason'} class Retracted(ElementBase): namespace = NS name = 'retracted' plugin_attrib = 'retracted' - interfaces = {'stamp'} + interfaces = {'stamp', 'id', 'reason'} + sub_interfaces = {'reason'} def register_plugins(): - register_stanza_plugin(ApplyTo, Retract) + register_stanza_plugin(Message, Retract) register_stanza_plugin(Message, Retracted) - - register_stanza_plugin(Retracted, OriginID) diff --git a/tests/test_stanza_xep_0424.py b/tests/test_stanza_xep_0424.py index 684632d6..7c71cf78 100644 --- a/tests/test_stanza_xep_0424.py +++ b/tests/test_stanza_xep_0424.py @@ -2,38 +2,33 @@ import unittest from slixmpp import Message from slixmpp.test import SlixTest from slixmpp.plugins.xep_0424 import stanza -from slixmpp.plugins.xep_0422 import stanza as astanza class TestRetraction(SlixTest): def setUp(self): - astanza.register_plugins() stanza.register_plugins() def testRetract(self): message = Message() - message['apply_to']['id'] = 'some-id' - message['apply_to']['retract'] + message['retract']['id'] = 'some-id' self.check(message, """ - - - + """, use_values=False) def testRetracted(self): message = Message() message['retracted']['stamp'] = '2019-09-20T23:09:32Z' - message['retracted']['origin_id']['id'] = 'originid' + message['retracted']['id'] = 'originid' self.check(message, """ - - - + """)