Load all chats during startup

This commit is contained in:
Manuel Cortez 2019-01-21 17:32:23 -06:00
parent d6a87bc426
commit 1db4e10dc8
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,8 @@
* Fixed an error in Socializer that was making it unable to detect unread messages properly. * 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)) * 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)) * 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 + up/down arrows: Increase / decrease volume.
* Alt + Left/down arrows: Play previous and next song if playing an audios buffer. * Alt + Left/down arrows: Play previous and next song if playing an audios buffer.
* Control + P: Play/pause. * Control + P: Play/pause.

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import range
import time import time
import os import os
import webbrowser import webbrowser
@ -459,12 +457,13 @@ class Controller(object):
return return
try: try:
log.debug("Getting possible unread messages.") 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: except VkApiError as ex:
if ex.code == 6: if ex.code == 6:
log.exception("Something went wrong when getting messages. Waiting a second to retry") log.exception("Something went wrong when getting messages. Waiting a second to retry")
for i in msgs["items"]: 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): def mark_as_read(self):
for i in self.buffers: for i in self.buffers: