Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
91fb4a7f by Philipp Hörist at 2022-10-16T23:09:14+02:00
feat: Add support for XEP-0421

- - - - -


4 changed files:

- nbxmpp/modules/muc/muc.py
- nbxmpp/namespaces.py
- nbxmpp/structs.py
- python-nbxmpp.doap


Changes:

=====================================
nbxmpp/modules/muc/muc.py
=====================================
@@ -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


=====================================
nbxmpp/namespaces.py
=====================================
@@ -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'


=====================================
nbxmpp/structs.py
=====================================
@@ -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


=====================================
python-nbxmpp.doap
=====================================
@@ -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"/>



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/91fb4a7f15c3992b25a916723e1138bb9e0293dd

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/91fb4a7f15c3992b25a916723e1138bb9e0293dd
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to