summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0421/occupant_id.py8
-rw-r--r--slixmpp/plugins/xep_0421/stanza.py5
2 files changed, 10 insertions, 3 deletions
diff --git a/slixmpp/plugins/xep_0421/occupant_id.py b/slixmpp/plugins/xep_0421/occupant_id.py
index 51d374fc..ff7fcda5 100644
--- a/slixmpp/plugins/xep_0421/occupant_id.py
+++ b/slixmpp/plugins/xep_0421/occupant_id.py
@@ -6,7 +6,7 @@
See the file LICENSE for copying permission.
"""
-from slixmpp import Message
+from slixmpp import JID, Message
from slixmpp.plugins import BasePlugin
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.xep_0421 import stanza
@@ -18,9 +18,13 @@ class XEP_0421(BasePlugin):
name = 'xep_0421'
description = 'Anonymous unique occupant identifiers for MUCs'
- dependencies = {'xep_0045'}
+ dependencies = {'xep_0030', 'xep_0045'}
stanza = stanza
def plugin_init(self) -> None:
# XXX: This should be MucMessage. Someday..
register_stanza_plugin(Message, OccupantId)
+
+ async def has_feature(self, jid: JID) -> bool:
+ info = await self.xmpp['xep_0030'].get_info(jid)
+ return self.stanza.NS in info.get_features()
diff --git a/slixmpp/plugins/xep_0421/stanza.py b/slixmpp/plugins/xep_0421/stanza.py
index d05bcfc1..0cb93959 100644
--- a/slixmpp/plugins/xep_0421/stanza.py
+++ b/slixmpp/plugins/xep_0421/stanza.py
@@ -9,6 +9,9 @@
from slixmpp.xmlstream import ElementBase
+NS = 'urn:xmpp:occupant-id:0'
+
+
class OccupantId(ElementBase):
'''
An Occupant-id tag.
@@ -33,5 +36,5 @@ class OccupantId(ElementBase):
'''
name = 'occupant-id'
- namespace = 'urn:xmpp:occupant-id:0'
+ namespace = NS
interface = {'id'}