Add the occupant id stanza elements
This commit is contained in:
parent
b50bfb2f34
commit
5f49df6b56
4 changed files with 56 additions and 0 deletions
|
@ -86,4 +86,5 @@ __all__ = [
|
|||
'xep_0325', # IoT Systems Control
|
||||
'xep_0332', # HTTP Over XMPP Transport
|
||||
'protoxep_reactions', # https://dino.im/xeps/reactions.html
|
||||
'protoxep_occupantid', # https://dino.im/xeps/occupant-id.html
|
||||
]
|
||||
|
|
12
slixmpp/plugins/protoxep_occupantid/__init__.py
Normal file
12
slixmpp/plugins/protoxep_occupantid/__init__.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
"""
|
||||
Slixmpp: The Slick XMPP Library
|
||||
Copyright (C) 2019 Mathieu Pasquet
|
||||
This file is part of Slixmpp.
|
||||
|
||||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
from slixmpp.plugins.base import register_plugin
|
||||
from slixmpp.plugins.protoxep_occupantid.occupantid import XEP_OccupantID
|
||||
from slixmpp.plugins.protoxep_occupantid.stanza import OccupantID
|
||||
|
||||
register_plugin(XEP_OccupantID)
|
27
slixmpp/plugins/protoxep_occupantid/occupantid.py
Normal file
27
slixmpp/plugins/protoxep_occupantid/occupantid.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
Slixmpp: The Slick XMPP Library
|
||||
Copyright (C) 2019 Mathieu Pasquet
|
||||
This file is part of Slixmpp.
|
||||
|
||||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
from slixmpp.plugins import BasePlugin
|
||||
from slixmpp.stanza import Message, Presence
|
||||
from slixmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
from slixmpp.plugins.protoxep_occupantid import stanza
|
||||
|
||||
|
||||
class XEP_OccupantID(BasePlugin):
|
||||
name = 'protoxep_occupantid'
|
||||
description = 'XEP-XXXX: Anonymous unique occupant identifiers for MUCs'
|
||||
dependencies = {'xep_0030'}
|
||||
stanza = stanza
|
||||
|
||||
def plugin_init(self):
|
||||
self.xmpp['xep_0030'].add_feature('urn:xmpp:occupant-id:0')
|
||||
register_stanza_plugin(Message, stanza.OccupantID)
|
||||
register_stanza_plugin(Presence, stanza.OccupantID)
|
||||
|
||||
def plugin_end(self):
|
||||
self.xmpp['xep_0030'].remove_feature('urn:xmpp:occupant-id:0')
|
16
slixmpp/plugins/protoxep_occupantid/stanza.py
Normal file
16
slixmpp/plugins/protoxep_occupantid/stanza.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
Slixmpp: The Slick XMPP Library
|
||||
Copyright (C) 2019 Mathieu Pasquet
|
||||
This file is part of Slixmpp.
|
||||
|
||||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
|
||||
from slixmpp.xmlstream import ElementBase
|
||||
|
||||
|
||||
class OccupantID(ElementBase):
|
||||
name = 'occupant-id'
|
||||
plugin_attrib = 'occupant-id'
|
||||
namespace = 'urn:xmpp:occupant-id:0'
|
||||
interfaces = {'id'}
|
Loading…
Reference in a new issue