Merge branch 'xep0356-v0.4' into 'master'

XEP-0356: namespace version bump

See merge request poezio/slixmpp!206
This commit is contained in:
Link Mauve 2022-07-12 13:26:14 +02:00
commit 9560f39de7
3 changed files with 10 additions and 7 deletions

View file

@ -7,7 +7,7 @@ from slixmpp.plugins.xep_0297 import Forwarded
class Privilege(ElementBase): class Privilege(ElementBase):
namespace = "urn:xmpp:privilege:1" namespace = "urn:xmpp:privilege:2"
name = "privilege" name = "privilege"
plugin_attrib = "privilege" plugin_attrib = "privilege"
@ -24,7 +24,10 @@ class Privilege(ElementBase):
def presence(self): def presence(self):
return self.permission("presence") return self.permission("presence")
def iq(self):
return self.permission("iq")
def add_perm(self, access, type): def add_perm(self, access, type):
# This should only be needed for servers, so maybe out of scope for slixmpp # This should only be needed for servers, so maybe out of scope for slixmpp
perm = Perm() perm = Perm()
@ -34,7 +37,7 @@ class Privilege(ElementBase):
class Perm(ElementBase): class Perm(ElementBase):
namespace = "urn:xmpp:privilege:1" namespace = "urn:xmpp:privilege:2"
name = "perm" name = "perm"
plugin_attrib = "perm" plugin_attrib = "perm"
plugin_multi_attrib = "perms" plugin_multi_attrib = "perms"
@ -44,4 +47,4 @@ class Perm(ElementBase):
def register(): def register():
register_stanza_plugin(Message, Privilege) register_stanza_plugin(Message, Privilege)
register_stanza_plugin(Privilege, Forwarded) register_stanza_plugin(Privilege, Forwarded)
register_stanza_plugin(Privilege, Perm, iterable=True) register_stanza_plugin(Privilege, Perm, iterable=True)

View file

@ -13,7 +13,7 @@ class TestPermissions(SlixTest):
def testAdvertisePermission(self): def testAdvertisePermission(self):
xmlstring = """ xmlstring = """
<message from='capulet.net' to='pubub.capulet.lit'> <message from='capulet.net' to='pubub.capulet.lit'>
<privilege xmlns='urn:xmpp:privilege:1'> <privilege xmlns='urn:xmpp:privilege:2'>
<perm access='roster' type='both'/> <perm access='roster' type='both'/>
<perm access='message' type='outgoing'/> <perm access='message' type='outgoing'/>
<perm access='presence' type='managed_entity'/> <perm access='presence' type='managed_entity'/>

View file

@ -31,7 +31,7 @@ class TestPermissions(SlixTest):
self.recv( self.recv(
""" """
<message from='capulet.net' to='pubub.capulet.lit' id='54321'> <message from='capulet.net' to='pubub.capulet.lit' id='54321'>
<privilege xmlns='urn:xmpp:privilege:1'> <privilege xmlns='urn:xmpp:privilege:2'>
<perm access='roster' type='both'/> <perm access='roster' type='both'/>
<perm access='message' type='outgoing'/> <perm access='message' type='outgoing'/>
</privilege> </privilege>
@ -95,7 +95,7 @@ class TestPermissions(SlixTest):
def testMakeOutgoingMessage(self): def testMakeOutgoingMessage(self):
xmlstring = """ xmlstring = """
<message xmlns="jabber:component:accept" from='pubsub.capulet.lit' to='capulet.net'> <message xmlns="jabber:component:accept" from='pubsub.capulet.lit' to='capulet.net'>
<privilege xmlns='urn:xmpp:privilege:1'> <privilege xmlns='urn:xmpp:privilege:2'>
<forwarded xmlns='urn:xmpp:forward:0'> <forwarded xmlns='urn:xmpp:forward:0'>
<message from="juliet@capulet.lit" to="romeo@montague.lit" xmlns="jabber:client"> <message from="juliet@capulet.lit" to="romeo@montague.lit" xmlns="jabber:client">
<body>I do not hate you</body> <body>I do not hate you</body>