callback for chunk update
This commit is contained in:
parent
6025c70f22
commit
4ce7f6c6a5
2 changed files with 7 additions and 3 deletions
|
@ -158,7 +158,7 @@ def tox_file_recv(window, tray):
|
|||
|
||||
|
||||
def file_recv_chunk(tox, friend_number, file_number, position, chunk, length, user_data):
|
||||
Profile.get_instance().incoming_chunk(friend_number, file_number, position, chunk, length)
|
||||
Profile.get_instance().incoming_chunk(friend_number, file_number, position, chunk if length else None)
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# Callbacks - initialization
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
|
@ -181,3 +181,4 @@ def init_callbacks(tox, window, tray):
|
|||
tox.callback_friend_request(friend_request, 0)
|
||||
|
||||
tox.callback_file_recv(tox_file_recv(window, tray), 0)
|
||||
tox.callback_file_recv_chunk(file_recv_chunk, 0)
|
||||
|
|
|
@ -706,6 +706,7 @@ class Profile(Contact, Singleton):
|
|||
def incoming_file_transfer(self, friend_number, file_number, size, file_name):
|
||||
rt = ReceiveTransfer(Settings.get_default_path() + file_name, self._tox, friend_number)
|
||||
self._file_transfers.append(rt)
|
||||
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['RESUME'])
|
||||
|
||||
def incoming_avatar(self, friend_number, file_number, size):
|
||||
"""
|
||||
|
@ -726,8 +727,10 @@ class Profile(Contact, Singleton):
|
|||
else:
|
||||
pass
|
||||
|
||||
def incoming_chunk(self, friend_number, file_number, position, chunk, length):
|
||||
pass
|
||||
def incoming_chunk(self, friend_number, file_number, position, data):
|
||||
# TODO: better transfer filtering
|
||||
transfer = filter(lambda x: x._friend_number == friend_number, self._file_transfers)[0]
|
||||
transfer.write_chunk(position, data)
|
||||
|
||||
def send_avatar(self, friend_number):
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue