incoming avatars improvements
This commit is contained in:
parent
c30abec24d
commit
658b4b718a
@ -150,6 +150,7 @@ class ReceiveTransfer(FileTransfer):
|
|||||||
def __init__(self, path, tox, friend_number, size, file_number):
|
def __init__(self, path, tox, friend_number, size, file_number):
|
||||||
super(ReceiveTransfer, self).__init__(path, tox, friend_number, size, file_number)
|
super(ReceiveTransfer, self).__init__(path, tox, friend_number, size, file_number)
|
||||||
self._file = open(self._path, 'wb')
|
self._file = open(self._path, 'wb')
|
||||||
|
if type(self) is not ReceiveAvatar:
|
||||||
self._file.truncate(0)
|
self._file.truncate(0)
|
||||||
self._file_size = 0
|
self._file_size = 0
|
||||||
|
|
||||||
@ -236,6 +237,8 @@ class ReceiveAvatar(ReceiveTransfer):
|
|||||||
self.send_control(TOX_FILE_CONTROL['CANCEL'])
|
self.send_control(TOX_FILE_CONTROL['CANCEL'])
|
||||||
self.state = TOX_FILE_TRANSFER_STATE['CANCELED']
|
self.state = TOX_FILE_TRANSFER_STATE['CANCELED']
|
||||||
else:
|
else:
|
||||||
|
self._file.truncate(0)
|
||||||
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
||||||
else:
|
else:
|
||||||
|
self._file.truncate(0)
|
||||||
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
||||||
|
@ -1133,7 +1133,7 @@ class Tox(object):
|
|||||||
if file_id is None:
|
if file_id is None:
|
||||||
file_id = create_string_buffer(TOX_FILE_ID_LENGTH)
|
file_id = create_string_buffer(TOX_FILE_ID_LENGTH)
|
||||||
tox_err_file_get = c_int()
|
tox_err_file_get = c_int()
|
||||||
Tox.libtoxcore.tox_file_control(self._tox_pointer, c_uint32(friend_number), c_uint32(file_number), file_id,
|
Tox.libtoxcore.tox_file_get_file_id(self._tox_pointer, c_uint32(friend_number), c_uint32(file_number), file_id,
|
||||||
addressof(tox_err_file_get))
|
addressof(tox_err_file_get))
|
||||||
tox_err_file_get = tox_err_file_get.value
|
tox_err_file_get = tox_err_file_get.value
|
||||||
if tox_err_file_get == TOX_ERR_FILE_GET['OK']:
|
if tox_err_file_get == TOX_ERR_FILE_GET['OK']:
|
||||||
|
Loading…
Reference in New Issue
Block a user