Reports when user is writing. Needs testing

This commit is contained in:
Manuel Cortez 2019-01-11 17:22:52 -06:00
parent da9425228e
commit ba40b74230

View File

@ -803,7 +803,6 @@ class chatBuffer(baseBuffer):
id_ = self.chats[i] id_ = self.chats[i]
# print i # print i
break break
# Retrieve here the object based in id_ # Retrieve here the object based in id_
if id_ != None: if id_ != None:
for i in self.session.db[self.name]["items"]: for i in self.session.db[self.name]["items"]:
@ -851,6 +850,10 @@ class chatBuffer(baseBuffer):
shift=event.ShiftDown() shift=event.ShiftDown()
if event.GetKeyCode() == wx.WXK_RETURN and shift == False: if event.GetKeyCode() == wx.WXK_RETURN and shift == False:
return self.send_chat_to_user() 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() event.Skip()
def get_items(self, show_nextpage=False, unread=False): def get_items(self, show_nextpage=False, unread=False):
@ -954,6 +957,7 @@ class chatBuffer(baseBuffer):
self.reads = [] self.reads = []
self.chats = dict() self.chats = dict()
self.peer_typing = 0 self.peer_typing = 0
self.last_keypress = time.time()
def parse_attachments(self, post): def parse_attachments(self, post):
attachments = [] attachments = []