From 1db4e10dc83c9309550fa70b708e695163e22f96 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 21 Jan 2019 17:32:23 -0600 Subject: [PATCH] Load all chats during startup --- changelog.md | 3 ++- src/controller/mainController.py | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 0c3576a..3d2d5ef 100644 --- a/changelog.md +++ b/changelog.md @@ -6,7 +6,8 @@ * Fixed an error in Socializer that was making it unable to detect unread messages properly. * Socializer should save all tracebacks directly to error.log instead of displaying an error message during exit. ([#27,](https://code.manuelcortez.net/manuelcortez/socializer/issues/27)) * When displaying user profiles, fixed an error where a married person without specifing relation partner would cause an error in the program. ([#29,](https://code.manuelcortez.net/manuelcortez/socializer/issues/29)) -* Added new global keystrokes, available in the main window of Socializer. +* Socializer will load all conversations during startup, not only conversations with unread messages. +* Added new global keystrokes, available in the main window. * Alt + up/down arrows: Increase / decrease volume. * Alt + Left/down arrows: Play previous and next song if playing an audios buffer. * Control + P: Play/pause. diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 4a49371..862b636 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals -from builtins import range import time import os import webbrowser @@ -459,12 +457,13 @@ class Controller(object): return try: log.debug("Getting possible unread messages.") - msgs = self.session.vk.client.messages.getDialogs(count=200, unread=True) + msgs = self.session.vk.client.messages.getConversations(count=200) except VkApiError as ex: if ex.code == 6: log.exception("Something went wrong when getting messages. Waiting a second to retry") for i in msgs["items"]: - call_threaded(self.chat_from_id, i["message"]["user_id"], setfocus=False, unread=True) + call_threaded(self.chat_from_id, i["last_message"]["peer_id"], setfocus=False, unread=False) + time.sleep(0.6) def mark_as_read(self): for i in self.buffers: