Marks read messages every two minutes

This commit is contained in:
2016-06-06 04:27:07 -05:00
parent 2b9aa467bd
commit 8d9082235b
3 changed files with 28 additions and 2 deletions

View File

@@ -274,13 +274,18 @@ class empty(object):
class chatBuffer(baseBuffer):
def onFocus(self, *args, **kwargs):
pass
msg = self.session.db[self.name]["items"][-1]
if msg["read_state"] == 0 and msg["id"] not in self.reads:
self.reads.append(msg["id"])
self.session.db[self.name]["items"][-1]["read_state"] = 1
def create_tab(self, parent):
self.tab = home.chatTab(parent)
def connect_events(self):
widgetUtils.connect_event(self.tab.send, widgetUtils.BUTTON_PRESSED, self.send_chat_to_user)
self.tab.set_focus_function(self.onFocus)
def get_items(self, show_nextpage=False):
retrieved = True # Control variable for handling unauthorised/connection errors.
@@ -308,6 +313,10 @@ class chatBuffer(baseBuffer):
if text == "": return
response = self.session.vk.client.messages.send(user_id=self.kwargs["user_id"], message=text)
def __init__(self, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs)
self.reads = []
class peopleBuffer(feedBuffer):
def create_tab(self, parent):