summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0421/stanza.py
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2020-05-27 22:28:47 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2020-05-27 22:39:52 +0200
commitcec34686fcfe09281931e977fcf322dac275aad1 (patch)
treea4ce63dbe9f9a0766dd30fc3f84dac3d7761b178 /slixmpp/plugins/xep_0421/stanza.py
parent6f4e9b485f743bc55ab0c2ae08afcdae89451110 (diff)
downloadslixmpp-cec34686fcfe09281931e977fcf322dac275aad1.tar.gz
slixmpp-cec34686fcfe09281931e977fcf322dac275aad1.tar.bz2
slixmpp-cec34686fcfe09281931e977fcf322dac275aad1.tar.xz
slixmpp-cec34686fcfe09281931e977fcf322dac275aad1.zip
New XEP: 0421 Occupant-id
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'slixmpp/plugins/xep_0421/stanza.py')
-rw-r--r--slixmpp/plugins/xep_0421/stanza.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0421/stanza.py b/slixmpp/plugins/xep_0421/stanza.py
new file mode 100644
index 00000000..d05bcfc1
--- /dev/null
+++ b/slixmpp/plugins/xep_0421/stanza.py
@@ -0,0 +1,37 @@
+"""
+ Slixmpp: The Slick XMPP Library
+ Copyright (C) 2020 "Maxime “pep” Buquet <pep@bouah.net>"
+ This file is part of Slixmpp.
+
+ See the file LICENSE for copying permission.
+"""
+
+from slixmpp.xmlstream import ElementBase
+
+
+class OccupantId(ElementBase):
+ '''
+ An Occupant-id tag.
+
+ An <occupant-id/> tag is set by the MUC.
+
+ This is useful in semi-anon MUCs (and MUC-PMs) as a stable identifier to
+ prevent the usual races with nicknames.
+
+ Without occupant-id, getting the following messages from MUC history would
+ prevent a client from asserting senders are the same entity:
+
+ <message type='groupchat' from='foo@muc/nick1' id='message1'>
+ <body>Some message</body>
+ <occupant-id xmlns='urn:xmpp:occupant-id:0' id='unique-opaque-id1'/>
+ </message>
+ <message type='groupchat' from='foo@muc/nick2' id='message2'>
+ <body>Some correction</body>
+ <occupant-id xmlns='urn:xmpp:occupant-id:0' id='unique-opaque-id1'/>
+ <replace xmlns='urn:xmpp:message-correct:0' id='message1'/>
+ </message>
+ '''
+
+ name = 'occupant-id'
+ namespace = 'urn:xmpp:occupant-id:0'
+ interface = {'id'}