xep-0424: update to version 0.4.0
This commit is contained in:
parent
cf3b30120e
commit
dd903b1792
2
doap.xml
2
doap.xml
@ -856,7 +856,7 @@
|
|||||||
<xmpp:SupportedXep>
|
<xmpp:SupportedXep>
|
||||||
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0424.html"/>
|
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0424.html"/>
|
||||||
<xmpp:status>complete</xmpp:status>
|
<xmpp:status>complete</xmpp:status>
|
||||||
<xmpp:version>0.3.0</xmpp:version>
|
<xmpp:version>0.4.0</xmpp:version>
|
||||||
<xmpp:since>1.6.0</xmpp:since>
|
<xmpp:since>1.6.0</xmpp:since>
|
||||||
</xmpp:SupportedXep>
|
</xmpp:SupportedXep>
|
||||||
</implements>
|
</implements>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# This file is part of Slixmpp.
|
# This file is part of Slixmpp.
|
||||||
# See the file LICENSE for copying permission.
|
# See the file LICENSE for copying permission.
|
||||||
from slixmpp.plugins.base import register_plugin
|
from slixmpp.plugins.base import register_plugin
|
||||||
from slixmpp.plugins.xep_0424.stanza import *
|
from .retraction import XEP_0424
|
||||||
from slixmpp.plugins.xep_0424.retraction import XEP_0424
|
|
||||||
|
|
||||||
register_plugin(XEP_0424)
|
register_plugin(XEP_0424)
|
||||||
|
@ -31,7 +31,7 @@ class XEP_0424(BasePlugin):
|
|||||||
stanza.register_plugins()
|
stanza.register_plugins()
|
||||||
self.xmpp.register_handler(Callback(
|
self.xmpp.register_handler(Callback(
|
||||||
"Message Retracted",
|
"Message Retracted",
|
||||||
StanzaPath("message/apply_to/retract"),
|
StanzaPath("message/retract"),
|
||||||
self._handle_retract_message,
|
self._handle_retract_message,
|
||||||
))
|
))
|
||||||
|
|
||||||
@ -64,7 +64,6 @@ class XEP_0424(BasePlugin):
|
|||||||
if include_fallback:
|
if include_fallback:
|
||||||
msg['body'] = fallback_text
|
msg['body'] = fallback_text
|
||||||
msg.enable('fallback')
|
msg.enable('fallback')
|
||||||
msg['apply_to']['id'] = id
|
msg['retract']['id'] = id
|
||||||
msg['apply_to'].enable('retract')
|
|
||||||
msg.enable('store')
|
msg.enable('store')
|
||||||
msg.send()
|
msg.send()
|
||||||
|
@ -8,28 +8,27 @@ from slixmpp.xmlstream import (
|
|||||||
ElementBase,
|
ElementBase,
|
||||||
register_stanza_plugin,
|
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):
|
class Retract(ElementBase):
|
||||||
namespace = NS
|
namespace = NS
|
||||||
name = 'retract'
|
name = 'retract'
|
||||||
plugin_attrib = 'retract'
|
plugin_attrib = 'retract'
|
||||||
|
interfaces = {'reason', 'id'}
|
||||||
|
sub_interfaces = {'reason'}
|
||||||
|
|
||||||
|
|
||||||
class Retracted(ElementBase):
|
class Retracted(ElementBase):
|
||||||
namespace = NS
|
namespace = NS
|
||||||
name = 'retracted'
|
name = 'retracted'
|
||||||
plugin_attrib = 'retracted'
|
plugin_attrib = 'retracted'
|
||||||
interfaces = {'stamp'}
|
interfaces = {'stamp', 'id', 'reason'}
|
||||||
|
sub_interfaces = {'reason'}
|
||||||
|
|
||||||
|
|
||||||
def register_plugins():
|
def register_plugins():
|
||||||
register_stanza_plugin(ApplyTo, Retract)
|
register_stanza_plugin(Message, Retract)
|
||||||
register_stanza_plugin(Message, Retracted)
|
register_stanza_plugin(Message, Retracted)
|
||||||
|
|
||||||
register_stanza_plugin(Retracted, OriginID)
|
|
||||||
|
@ -2,38 +2,33 @@ import unittest
|
|||||||
from slixmpp import Message
|
from slixmpp import Message
|
||||||
from slixmpp.test import SlixTest
|
from slixmpp.test import SlixTest
|
||||||
from slixmpp.plugins.xep_0424 import stanza
|
from slixmpp.plugins.xep_0424 import stanza
|
||||||
from slixmpp.plugins.xep_0422 import stanza as astanza
|
|
||||||
|
|
||||||
|
|
||||||
class TestRetraction(SlixTest):
|
class TestRetraction(SlixTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
astanza.register_plugins()
|
|
||||||
stanza.register_plugins()
|
stanza.register_plugins()
|
||||||
|
|
||||||
def testRetract(self):
|
def testRetract(self):
|
||||||
message = Message()
|
message = Message()
|
||||||
message['apply_to']['id'] = 'some-id'
|
message['retract']['id'] = 'some-id'
|
||||||
message['apply_to']['retract']
|
|
||||||
|
|
||||||
self.check(message, """
|
self.check(message, """
|
||||||
<message>
|
<message>
|
||||||
<apply-to xmlns="urn:xmpp:fasten:0" id="some-id">
|
<retract xmlns="urn:xmpp:message-retract:1" id="some-id"/>
|
||||||
<retract xmlns="urn:xmpp:message-retract:0"/>
|
|
||||||
</apply-to>
|
|
||||||
</message>
|
</message>
|
||||||
""", use_values=False)
|
""", use_values=False)
|
||||||
|
|
||||||
def testRetracted(self):
|
def testRetracted(self):
|
||||||
message = Message()
|
message = Message()
|
||||||
message['retracted']['stamp'] = '2019-09-20T23:09:32Z'
|
message['retracted']['stamp'] = '2019-09-20T23:09:32Z'
|
||||||
message['retracted']['origin_id']['id'] = 'originid'
|
message['retracted']['id'] = 'originid'
|
||||||
|
|
||||||
self.check(message, """
|
self.check(message, """
|
||||||
<message>
|
<message>
|
||||||
<retracted stamp="2019-09-20T23:09:32Z" xmlns="urn:xmpp:message-retract:0">
|
<retracted stamp="2019-09-20T23:09:32Z"
|
||||||
<origin-id xmlns="urn:xmpp:sid:0" id="originid"/>
|
xmlns="urn:xmpp:message-retract:1"
|
||||||
</retracted>
|
id="originid" />
|
||||||
</message>
|
</message>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user