From 17a8d8148697a9b7efcd6a6d3f372f44007494f3 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Mon, 6 Jun 2016 13:05:11 +0300 Subject: [PATCH] settings encryption fix and todo's --- src/main.py | 1 + src/profile.py | 7 +++++-- src/settings.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.py b/src/main.py index 04d9d57..4e78235 100644 --- a/src/main.py +++ b/src/main.py @@ -335,6 +335,7 @@ class Toxygen(object): if __name__ == '__main__': + # TODO: add tox: URI support if len(sys.argv) == 1: toxygen = Toxygen() else: # path to profile diff --git a/src/profile.py b/src/profile.py index 8a71797..8f1d50c 100644 --- a/src/profile.py +++ b/src/profile.py @@ -506,13 +506,16 @@ class Profile(Contact, Singleton): """ Friend with specified number quit """ - # TODO: fix + # TODO: fix and add full file resuming support self.get_friend_by_number(friend_number).status = None self.friend_typing(friend_number, False) if friend_number in self._call: self._call.finish_call(friend_number, True) for key in filter(lambda x: x[0] == friend_number, self._file_transfers.keys()): - self._file_transfers[key].pause(False) + if type(self._file_transfers[key]) in (ReceiveAvatar, SendAvatar): + self._file_transfers[key].cancelled() + else: + self._file_transfers[key].pause(False) # ----------------------------------------------------------------------------------------------------------------- # Typing notifications diff --git a/src/settings.py b/src/settings.py index a589d35..7ca7cb7 100644 --- a/src/settings.py +++ b/src/settings.py @@ -16,7 +16,7 @@ class Settings(Singleton, dict): self.path = ProfileHelper.get_path() + str(name) + '.json' self.name = name if os.path.isfile(self.path): - with open(self.path) as fl: + with open(self.path, 'rb') as fl: data = fl.read() inst = LibToxEncryptSave.get_instance() try: @@ -105,7 +105,7 @@ class Settings(Singleton, dict): inst = LibToxEncryptSave.get_instance() if inst.has_password(): text = inst.pass_encrypt(text) - with open(self.path, 'w') as fl: + with open(self.path, 'wb') as fl: fl.write(text) def close(self):