From 8411f08348008f5c8f3bef7e1d023aefe3801588 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 30 Jun 2018 15:23:04 +0300 Subject: [PATCH] bug with avatars fixed. bug with contacts statuses during reconnection was fixed --- toxygen/app.py | 1 + toxygen/contacts/contacts_manager.py | 8 ++++++++ toxygen/file_transfers/file_transfers_handler.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/toxygen/app.py b/toxygen/app.py index f3fd429..db3ddc8 100644 --- a/toxygen/app.py +++ b/toxygen/app.py @@ -306,6 +306,7 @@ class App: Create new tox instance (new network settings) :return: tox instance """ + self._contacts_manager.reset_contacts_statuses() self._stop_threads(False) data = self._tox.get_savedata() self._save_profile(data) diff --git a/toxygen/contacts/contacts_manager.py b/toxygen/contacts/contacts_manager.py index 08ee678..46e98a2 100644 --- a/toxygen/contacts/contacts_manager.py +++ b/toxygen/contacts/contacts_manager.py @@ -55,6 +55,14 @@ class ContactsManager(ToxSave): def is_contact_active(self, contact): return self._contacts[self._active_contact].tox_id == contact.tox_id + # ----------------------------------------------------------------------------------------------------------------- + # Reconnection support + # ----------------------------------------------------------------------------------------------------------------- + + def reset_contacts_statuses(self): + for contact in self._contacts: + contact.status = None + # ----------------------------------------------------------------------------------------------------------------- # Work with active friend # ----------------------------------------------------------------------------------------------------------------- diff --git a/toxygen/file_transfers/file_transfers_handler.py b/toxygen/file_transfers/file_transfers_handler.py index 64a2bfe..d462c89 100644 --- a/toxygen/file_transfers/file_transfers_handler.py +++ b/toxygen/file_transfers/file_transfers_handler.py @@ -254,7 +254,7 @@ class FileTransfersHandler(ToxSave): if ra.state != FILE_TRANSFER_STATE['CANCELLED']: self._file_transfers[(friend_number, file_number)] = ra ra.set_transfer_finished_handler(self.transfer_finished) - else: + elif not size: friend.reset_avatar(self._settings['identicons']) def _send_avatar_to_contacts(self):