Updated code to handle unread messsages
This commit is contained in:
parent
e3dae698d9
commit
ba14699dfb
@ -858,6 +858,11 @@ class chatBuffer(baseBuffer):
|
|||||||
else:
|
else:
|
||||||
log.debug("Unhandled attachment: %r" % (attachment,))
|
log.debug("Unhandled attachment: %r" % (attachment,))
|
||||||
|
|
||||||
|
def clear_reads(self):
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if "read_state" in i and i["read_state"] == 0:
|
||||||
|
i["read_state"] = 1
|
||||||
|
|
||||||
class peopleBuffer(feedBuffer):
|
class peopleBuffer(feedBuffer):
|
||||||
|
|
||||||
def create_tab(self, parent):
|
def create_tab(self, parent):
|
||||||
|
@ -479,6 +479,7 @@ class Controller(object):
|
|||||||
for i in self.buffers:
|
for i in self.buffers:
|
||||||
if hasattr(i, "reads") and len(i.reads) != 0:
|
if hasattr(i, "reads") and len(i.reads) != 0:
|
||||||
response = self.session.vk.client.messages.markAsRead(peer_id=i.kwargs["user_id"])
|
response = self.session.vk.client.messages.markAsRead(peer_id=i.kwargs["user_id"])
|
||||||
|
i.clear_reads()
|
||||||
i.reads = []
|
i.reads = []
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user