settings encryption fix and todo's

This commit is contained in:
ingvar1995 2016-06-06 13:05:11 +03:00
parent c114e9b6c3
commit 17a8d81486
3 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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):