file transfers - profile.py update

This commit is contained in:
ingvar1995 2016-03-16 23:56:35 +03:00
parent e1c35ccd3b
commit 24109004cf
2 changed files with 11 additions and 2 deletions

View File

@ -136,7 +136,7 @@ def tox_file_recv(window, tray):
settings = Settings.get_instance()
if file_type == TOX_FILE_KIND['DATA']:
print 'file'
file_name = file_name[:].decode('utf8')
file_name = file_name[:file_name_size].decode('utf8')
invoke_in_main_thread(profile.incoming_file_transfer,
friend_number,
file_number,
@ -156,6 +156,9 @@ def tox_file_recv(window, tray):
size)
return wrapped
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)
# -----------------------------------------------------------------------------------------------------------------
# Callbacks - initialization
# -----------------------------------------------------------------------------------------------------------------

View File

@ -8,6 +8,7 @@ from ctypes import *
from util import curr_time, log, Singleton, curr_directory, convert_time
from tox_dns import tox_dns
from history import *
from file_transfers import *
import time
@ -696,13 +697,15 @@ class Profile(Contact, Singleton):
self.status = None
for friend in self._friends:
friend.status = None
# TODO: FT reset
# -----------------------------------------------------------------------------------------------------------------
# File transfers support
# -----------------------------------------------------------------------------------------------------------------
def incoming_file_transfer(self, friend_number, file_number, size, file_name):
pass
rt = ReceiveTransfer(Settings.get_default_path() + file_name, self._tox, friend_number)
self._file_transfers.append(rt)
def incoming_avatar(self, friend_number, file_number, size):
"""
@ -723,6 +726,9 @@ class Profile(Contact, Singleton):
else:
pass
def incoming_chunk(self, friend_number, file_number, position, chunk, length):
pass
def send_avatar(self, friend_number):
pass