def callback_file_recv(self, callback, user_data):
"""
Set the callback for the `file_recv` event. Pass None to unset.
This event is triggered when a file transfer request is received.
:param callback: Python function.
The client should acquire resources to be associated with the file transfer. Incoming file transfers start in
the PAUSED state. After this callback returns, a transfer can be rejected by sending a TOX_FILE_CONTROL_CANCEL
control command before any other control commands. It can be accepted by sending TOX_FILE_CONTROL_RESUME.
Should take pointer (c_void_p) to Tox object,
The friend number (c_uint32) of the friend who is sending the file transfer request.
The friend-specific file number (c_uint32) the data received is associated with.
The meaning of the file (c_uint32) to be sent.
Size in bytes (c_uint64) of the file the client wants to send, UINT64_MAX if unknown or streaming.
Name of the file (c_char_p). Does not need to be the actual name. This name will be sent along with the file
send request.
Size in bytes (c_size_t) of the filename.
pointer (c_void_p) to user_data
:param user_data: pointer (c_void_p) to user data
"""
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, c_uint32, c_uint32, c_uint64, c_char_p, c_size_t, c_void_p)
self.file_recv_cb = c_callback(callback)
self.libtoxcore.tox_callback_file_recv(self._tox_pointer, self.file_recv_cb, user_data)
评论列表
文章目录