Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
ff330eeb by Philipp Hörist at 2025-04-01T21:07:37+02:00
change: MDS: Simplify set_mds()
- - - - -
8b4eab55 by Philipp Hörist at 2025-04-01T21:08:41+02:00
feat: MDS: Allow setting MDS assist on message
- - - - -
3 changed files:
- nbxmpp/modules/mds.py
- nbxmpp/namespaces.py
- nbxmpp/protocol.py
Changes:
=====================================
nbxmpp/modules/mds.py
=====================================
@@ -73,18 +73,20 @@ class MDS(BaseModule):
properties.pubsub_event = pubsub_event
@iq_request_task
- def set_mds(self, data: MDSData, by: JID):
+ def set_mds(self, jid: JID, stanza_id: str):
task = yield
- item = Node("displayed", {"xmlns": Namespace.MDS})
- sid = item.addChild("stanza-id", namespace=Namespace.SID)
- sid.setAttr("id", data.stanza_id)
- sid.setAttr("by", str(by))
+ by = self._client.get_bound_jid().bare
+
+ displayed = Node("displayed", {"xmlns": Namespace.MDS})
+ displayed.addChild(
+ "stanza-id", namespace=Namespace.SID, attrs={"id": stanza_id,
"by": by}
+ )
result = yield self.publish(
Namespace.MDS,
- item,
- id_=str(data.jid),
+ displayed,
+ id_=str(jid),
options=MDS_OPTIONS,
force_node_options=True,
)
=====================================
nbxmpp/namespaces.py
=====================================
@@ -98,6 +98,7 @@ class _Namespaces:
MESSAGE_RETRACT: str = "urn:xmpp:message-retract:0"
MESSAGE_RETRACT_1: str = "urn:xmpp:message-retract:1"
MDS: str = "urn:xmpp:mds:displayed:0"
+ MDS_ASSIST: str = "urn:xmpp:mds:server-assist:0"
MOOD: str = "http://jabber.org/protocol/mood"
MSG_HINTS: str = "urn:xmpp:hints"
MUCLUMBUS: str = "https://xmlns.zombofant.net/muclumbus/search/1.0"
=====================================
nbxmpp/protocol.py
=====================================
@@ -1410,6 +1410,12 @@ class Message(Protocol):
def setMarkable(self) -> None:
self.setTag("markable", namespace=Namespace.CHATMARKERS)
+ def setMdsAssist(self, stanza_id: str, by: JID) -> None:
+ displayed = self.setTag("displayed", namespace=Namespace.MDS)
+ displayed.addChild(
+ "stanza-id", namespace=Namespace.SID, attrs={"id": stanza_id,
"by": str(by)}
+ )
+
def setReceiptRequest(self) -> None:
self.setTag("request", namespace=Namespace.RECEIPTS)
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/834f910065498c1e80bedddf0afa56376d4fd853...8b4eab557190cdbccc76d5cdff6f6ededdb7c271
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/834f910065498c1e80bedddf0afa56376d4fd853...8b4eab557190cdbccc76d5cdff6f6ededdb7c271
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]