summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/__init__.py1
-rw-r--r--slixmpp/plugins/protoxep_occupantid/__init__.py12
-rw-r--r--slixmpp/plugins/protoxep_occupantid/occupantid.py27
-rw-r--r--slixmpp/plugins/protoxep_occupantid/stanza.py16
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'}