Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mrDoctorWho/vk4xmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Smith <mrdoctorwho@helldev.net>2020-03-19 12:04:07 +0300
committerJohn Smith <mrdoctorwho@helldev.net>2020-03-19 12:04:07 +0300
commitf9714348a234a191b7475f36d59d331b2fcf8856 (patch)
tree2dd4512c671a8aa3ea1dacc0184228e4e3501fd6
parent6b251103a15ebf4bc9a81b690912444ccd12d709 (diff)
Update xmpppy: add XEP-0203 support
-rw-r--r--library/xmpp/protocol.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/library/xmpp/protocol.py b/library/xmpp/protocol.py
index da8c2f5..414cd2a 100644
--- a/library/xmpp/protocol.py
+++ b/library/xmpp/protocol.py
@@ -76,7 +76,10 @@ NS_COMPRESS = "http://jabber.org/protocol/compress" # XEP-0138
NS_DATA = "jabber:x:data" # XEP-0004
NS_DATA_LAYOUT = "http://jabber.org/protocol/xdata-layout" # XEP-0141
NS_DATA_VALIDATE = "http://jabber.org/protocol/xdata-validate" # XEP-0122
-NS_DELAY = "jabber:x:delay" # XEP-0091 (deprecated)
+NS_DELAY = "jabber:x:delay" # XEP-0091 (deprecated in favour of XEP-0203)
+NS_URN_DELAY = "urn:xmpp:delay" # XEP-0203
+
+
NS_DIALBACK = "jabber:server:dialback" # RFC 3921
NS_DISCO = "http://jabber.org/protocol/disco" # XEP-0030
NS_DISCO_INFO = NS_DISCO + "#info" # XEP-0030
@@ -145,7 +148,7 @@ NS_WAITINGLIST = "http://jabber.org/protocol/waitinglist" # XEP-0130
NS_XHTML_IM = "http://jabber.org/protocol/xhtml-im" # XEP-0071
NS_XMPP_STREAMS = "urn:ietf:params:xml:ns:xmpp-streams" # RFC 3920
NS_PING = "urn:xmpp:ping" # XEP-0199
-NS_CHAT_MARKERS = "urn:xmpp:chat-markers:0" # XEP-0333
+NS_CHAT_MARKERS = "urn:xmpp:chat-markers:0" # XEP-0333
NS_MUC_FILTER = "http://jabber.ru/muc-filter"
@@ -522,15 +525,16 @@ class Protocol(Node):
if node and isinstance(node, self.__class__) and self.__class__ == node.__class__ and "id" in self.attrs:
del self.attrs["id"]
self.timestamp = None
- for x in self.getTags("x", namespace=NS_DELAY):
- try:
- if not self.getTimestamp() or x.getAttr("stamp") < self.getTimestamp():
- self.setTimestamp(x.getAttr("stamp"))
- except Exception:
- pass
+
+ delay = self.getTag("delay", namespace=NS_URN_DELAY) or self.getTag("x", namespace=NS_DELAY)
+ if delay:
+ if not self.getTimestamp() or delay.getAttr("stamp") < self.getTimestamp():
+ self.setTimestamp(delay.getAttr("stamp"))
+
if timestamp is not None:
self.setTimestamp(timestamp) # To auto-timestamp stanza just pass timestamp=""
+
def getTo(self):
"""
Return value of the "to" attribute.