Commit 81a454c2 authored by Manuel Cortez's avatar Manuel Cortez

Read confirmations will be sent in real time in conversations

parent 6f245d9b
......@@ -8,7 +8,8 @@
* For users with multiple soundcards, there is a new tab in the preferences dialogue of Socializer, called sound. From there, you can define what soundcard will be used for input and output.
* Improvements in conversation buffers:
* it is possible to retrieve more items for conversation buffers. Due to API limitations, it is possible to load up to the last 600 messages for every conversation. Take into account that the process of loading more items takes some time. You will hear a message when the process is done.
* It is possible to delete entire conversations from the tree of buffers, by using the menu key and selecting "delete conversation". The conversation will be removed from VK.
* It is possible to delete entire conversations from the buffer's tree, by using the menu key and selecting "delete conversation". The conversation will be removed from VK.
* Read confirmations will be sent to VK as soon as you read the message. Before, read confirmations were being sent every 3 minutes to the social network.
## Changes in version 0.19 (13.03.2019)
......@@ -911,13 +911,11 @@ class chatBuffer(baseBuffer):
def insert(self, item, reversed=False):
""" Add a new item to the list. Uses session.composefunc for parsing the dictionary and create a valid result for putting it in the list."""
# as this tab is based in a text control, we have to overwrite the defaults.
item_ = getattr(renderers, self.compose_function)(item, self.session)
# the dictionary will have (first_line, last_line) as keys and message ID as a value for looking into it when needed.
# Here we will get first and last line of a chat message appended to the history.
lines =
values =[0], reverse=reversed)
if reversed:
values = (values[0]-lines, values[1]-lines)
self.chats[values] = item["id"]
def get_focused_post(self):
......@@ -933,7 +931,6 @@ class chatBuffer(baseBuffer):
# position[2]+1 is added because line may start with 0, while in wx.TextCtrl.GetNumberLines() that is not possible.
if position[2]+1 >= i[0] and position[2]+1 < i[1]:
id_ = self.chats[i]
# print i
# Retrieve here the object based in id_
if id_ != None:
......@@ -949,9 +946,10 @@ class chatBuffer(baseBuffer):
msg = self.get_focused_post()
if msg == False: # Handle the case where the last line of the control cannot be matched to anything.
if "read_state" in msg and msg["read_state"] == 0 and msg["id"] not in self.reads and "out" in msg and msg["out"] == 0:
# Mark unread conversations as read.
if "read_state" in msg and msg["read_state"] == 0 and "out" in msg and msg["out"] == 0:"message_unread.ogg")
call_threaded(self.session.vk.client.messages.markAsRead, peer_id=self.kwargs["peer_id"])
self.session.db[]["items"][-1]["read_state"] = 1
if "attachments" in msg and len(msg["attachments"]) > 0:
......@@ -1115,7 +1113,6 @@ class chatBuffer(baseBuffer):
def __init__(self, unread=False, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs)
self.unread = unread
self.reads = []
self.chats = dict()
self.peer_typing = 0
self.last_keypress = time.time()
......@@ -114,8 +114,6 @@ class Controller(object):
self.repeatedUpdate = RepeatingTimer(120, self.update_all_buffers)
self.readMarker = RepeatingTimer(60, self.mark_as_read)
def complete_buffer_creation(self, buffer, name_, position):
answer = buffer.get_items()
......@@ -158,14 +156,6 @@ class Controller(object):
call_threaded(self.chat_from_id, i["last_message"]["peer_id"], setfocus=False, unread=False)
def mark_as_read(self):
for i in self.buffers:
if hasattr(i, "reads") and len(i.reads) != 0:
response = self.session.vk.client.messages.markAsRead(peer_id=i.kwargs["peer_id"])
i.reads = []
def get_audio_albums(self, user_id=None, create_buffers=True, force_action=False):
if self.session.settings["load_at_startup"]["audio_albums"] == False and force_action == False:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment