Commit 91fb4a7f authored by Philipp Hörist's avatar Philipp Hörist
Browse files

feat: Add support for XEP-0421

parent 3ca9eeb3
......@@ -116,6 +116,12 @@ class MUC(BaseModule):
properties.muc_jid = properties.jid.new_as_bare()
properties.muc_nickname = properties.jid.resource
occupant_id = stanza.getTagAttr('occupant-id',
'id',
namespace=Namespace.OCCUPANT_ID)
properties.occupant_id = occupant_id
def _process_muc_user_presence(self, _client, stanza, properties):
muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
if muc_user is None:
......@@ -123,6 +129,13 @@ class MUC(BaseModule):
properties.from_muc = True
properties.muc_jid = properties.jid.new_as_bare()
occupant_id = stanza.getTagAttr('occupant-id',
'id',
namespace=Namespace.OCCUPANT_ID)
properties.occupant_id = occupant_id
destroy = muc_user.getTag('destroy')
if destroy is not None:
alternate = destroy.getAttr('jid')
......@@ -192,6 +205,12 @@ class MUC(BaseModule):
properties.muc_jid = properties.jid.new_as_bare()
properties.muc_nickname = properties.jid.resource
occupant_id = stanza.getTagAttr('occupant-id',
'id',
namespace=Namespace.OCCUPANT_ID)
properties.occupant_id = occupant_id
muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
if muc_user is not None:
try:
......@@ -220,6 +239,12 @@ class MUC(BaseModule):
if muc_user is None:
return
occupant_id = stanza.getTagAttr('occupant-id',
'id',
namespace=Namespace.OCCUPANT_ID)
properties.occupant_id = occupant_id
# MUC Private message
if (properties.type.is_chat or
properties.type.is_error and
......
......@@ -114,6 +114,7 @@ class _Namespaces:
MUC_REQUEST: str = 'http://jabber.org/protocol/muc#request'
MUC_INFO: str = 'http://jabber.org/protocol/muc#roominfo'
NICK: str = 'http://jabber.org/protocol/nick'
OCCUPANT_ID: str = 'urn:xmpp:occupant-id:0'
OMEMO_TEMP: str = 'eu.siacs.conversations.axolotl'
OMEMO_TEMP_BUNDLE: str = 'eu.siacs.conversations.axolotl.bundles'
OMEMO_TEMP_DL: str = 'eu.siacs.conversations.axolotl.devicelist'
......
......@@ -963,6 +963,7 @@ class MessageProperties:
http_auth: Optional[HTTPAuthData] = None
nickname: Optional[str] = None
from_muc: bool = False
occupant_id: Optional[str] = None
muc_jid: Optional[JID] = None
muc_nickname: Optional[str] = None
muc_status_codes: Optional[Set[StatusCode]] = None
......@@ -1183,6 +1184,7 @@ class PresenceProperties:
self_presence: bool = False
self_bare: bool = False
from_muc: bool = False
occupant_id: Optional[str] = None
status: str = ''
timestamp: float = field(default_factory=time.time)
user_timestamp: Optional[float] = None
......
......@@ -401,6 +401,13 @@
<xmpp:version>0.3.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0421.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>0.1.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0425.html"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment