diff options
author | mathieui <mathieui@mathieui.net> | 2019-07-14 13:13:59 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2019-07-14 13:13:59 +0200 |
commit | 5f49df6b56e64b34bd9e759887138e33cffbe4c9 (patch) | |
tree | a29366b72da9109bab0a9f752b845393d061cc38 | |
parent | b50bfb2f34a3ace3a70b1647f54ad6a0e761acf7 (diff) | |
download | slixmpp-5f49df6b56e64b34bd9e759887138e33cffbe4c9.tar.gz slixmpp-5f49df6b56e64b34bd9e759887138e33cffbe4c9.tar.bz2 slixmpp-5f49df6b56e64b34bd9e759887138e33cffbe4c9.tar.xz slixmpp-5f49df6b56e64b34bd9e759887138e33cffbe4c9.zip |
Add the occupant id stanza elements
-rw-r--r-- | slixmpp/plugins/__init__.py | 1 | ||||
-rw-r--r-- | slixmpp/plugins/protoxep_occupantid/__init__.py | 12 | ||||
-rw-r--r-- | slixmpp/plugins/protoxep_occupantid/occupantid.py | 27 | ||||
-rw-r--r-- | slixmpp/plugins/protoxep_occupantid/stanza.py | 16 |
4 files changed, 56 insertions, 0 deletions
diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py index f8ebe778..716b15c3 100644 --- a/slixmpp/plugins/__init__.py +++ b/slixmpp/plugins/__init__.py @@ -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 ] diff --git a/slixmpp/plugins/protoxep_occupantid/__init__.py b/slixmpp/plugins/protoxep_occupantid/__init__.py new file mode 100644 index 00000000..1bd374b6 --- /dev/null +++ b/slixmpp/plugins/protoxep_occupantid/__init__.py @@ -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) diff --git a/slixmpp/plugins/protoxep_occupantid/occupantid.py b/slixmpp/plugins/protoxep_occupantid/occupantid.py new file mode 100644 index 00000000..2c7827fb --- /dev/null +++ b/slixmpp/plugins/protoxep_occupantid/occupantid.py @@ -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') diff --git a/slixmpp/plugins/protoxep_occupantid/stanza.py b/slixmpp/plugins/protoxep_occupantid/stanza.py new file mode 100644 index 00000000..e5853111 --- /dev/null +++ b/slixmpp/plugins/protoxep_occupantid/stanza.py @@ -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'} |