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>2018-12-23 15:49:47 +0300
committerJohn Smith <mrdoctorwho@helldev.net>2018-12-23 15:49:47 +0300
commitd35622d82961a43fd83a80c60ce6527e1dfb95a9 (patch)
tree230c80720fff913dfe427eb926632aad6bbb1c2d /library
parent77dd22617542c2a2dede53a11a6deaf87417d26f (diff)
experimental: XEP-0333 chat read markers for both sides of conversation
Diffstat (limited to 'library')
-rw-r--r--library/defaults.py2
-rw-r--r--library/longpoll.py9
-rw-r--r--library/xmpp/protocol.py1
3 files changed, 11 insertions, 1 deletions
diff --git a/library/defaults.py b/library/defaults.py
index 4862155..15bc90d 100644
--- a/library/defaults.py
+++ b/library/defaults.py
@@ -52,4 +52,4 @@ allowBePublic = True
TransportFeatures = {xmpp.NS_DELAY}
# The features transport's users will advertise
-UserFeatures = {xmpp.NS_CHATSTATES, xmpp.NS_LAST} \ No newline at end of file
+UserFeatures = {xmpp.NS_CHATSTATES, xmpp.NS_LAST, xmpp.NS_CHAT_MARKERS} \ No newline at end of file
diff --git a/library/longpoll.py b/library/longpoll.py
index 7625542..a30128a 100644
--- a/library/longpoll.py
+++ b/library/longpoll.py
@@ -33,6 +33,9 @@ CODE_FINE = 0
CODE_ERROR = 1
TYPE_MSG = 4
+TYPE_MSG_EDIT = 5
+TYPE_MSG_READ_IN = 6 # we read the message
+TYPE_MSG_READ_OUT = 7 # they read the message
TYPE_PRS_IN = 8
TYPE_PRS_OUT = 9
TYPE_TYPING = 61
@@ -112,6 +115,12 @@ def processPollResult(user, data):
message = [{"out": 0, "uid": uid, "mid": mid, "date": date, "body": body}]
utils.runThread(user.sendMessages, (False, message, mid - 1, uid), "sendMessages-%s" % user.source)
+ elif typ == TYPE_MSG_READ_OUT:
+ uid, mid = evt
+ xmppMID = user.msgCache.get(mid)
+ if xmppMID:
+ sendChatMarker(user.source, vk2xmpp(uid), xmppMID)
+
elif typ == TYPE_PRS_IN: # user has joined
uid = abs(evt[0])
sendPresence(user.source, vk2xmpp(uid), hash=USER_CAPS_HASH)
diff --git a/library/xmpp/protocol.py b/library/xmpp/protocol.py
index c268aaa..b11cf1f 100644
--- a/library/xmpp/protocol.py
+++ b/library/xmpp/protocol.py
@@ -145,6 +145,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_MUC_FILTER = "http://jabber.ru/muc-filter"