From ba40b742306e0ac71f192a24a67c3c143590c1ec Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 11 Jan 2019 17:22:52 -0600 Subject: [PATCH] Reports when user is writing. Needs testing --- src/controller/buffers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 971b45c..80cb21d 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -803,7 +803,6 @@ class chatBuffer(baseBuffer): id_ = self.chats[i] # print i break - # Retrieve here the object based in id_ if id_ != None: for i in self.session.db[self.name]["items"]: @@ -851,6 +850,10 @@ class chatBuffer(baseBuffer): shift=event.ShiftDown() if event.GetKeyCode() == wx.WXK_RETURN and shift == False: return self.send_chat_to_user() + t = time.time() + if t-self.last_keypress > 5: + self.last_keypress = t + call_threaded(self.session.vk.client.messages.setActivity, peer_id=self.kwargs["peer_id"], type="typing") event.Skip() def get_items(self, show_nextpage=False, unread=False): @@ -954,6 +957,7 @@ class chatBuffer(baseBuffer): self.reads = [] self.chats = dict() self.peer_typing = 0 + self.last_keypress = time.time() def parse_attachments(self, post): attachments = []