From 8b0070efd42facb264842e1f54e2a02ee3ae0afc Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Wed, 16 Jan 2019 17:54:29 -0600 Subject: [PATCH] Attempt to fix problem when a message is not detected as unread --- src/controller/buffers.py | 1 - src/controller/mainController.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 3532728..a73d1f9 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -821,7 +821,6 @@ class chatBuffer(baseBuffer): self.session.soundplayer.play("message_unread.ogg") self.reads.append(msg["id"]) self.session.db[self.name]["items"][-1]["read_state"] = 1 -# print msg if "attachments" in msg and len(msg["attachments"]) > 0: self.tab.attachments.list.Enable(True) self.attachments = list() diff --git a/src/controller/mainController.py b/src/controller/mainController.py index c0e0495..aa003a6 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -419,15 +419,15 @@ class Controller(object): # If the chat already exists, let's create a dictionary wich will contains data of the received message. message.update(id=obj.message_id, user_id=uid, date=obj.timestamp, body=obj.text, attachments=obj.attachments) # if attachments is true, let's request for the full message with attachments formatted in a better way. - # Todo: code improvements. We shouldn't need to request the same message again just for these attachments. + # ToDo: code improvements. We shouldn't need to request the same message again just for these attachments. if len(message["attachments"]) != 0: message_ids = message["id"] results = self.session.vk.client.messages.getById(message_ids=message_ids) message = results["items"][0] - message.update(read_state=0) if obj.from_me: message["from_id"] = self.session.user_id else: + message.update(read_state=0) message["from_id"] = obj.user_id data = [message] # Let's add this to the buffer.