def callback_friend_message(self, callback, user_data):
"""
Set the callback for the `friend_message` event. Pass None to unset.
This event is triggered when a message from a friend is received.
:param callback: Python function. Should take pointer (c_void_p) to Tox object,
The friend number (c_uint32) of the friend who sent the message,
Message type (TOX_MESSAGE_TYPE),
The message data (c_char_p) they sent,
The size (c_size_t) of the message byte array.
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_int, c_char_p, c_size_t, c_void_p)
self.friend_message_cb = c_callback(callback)
Tox.libtoxcore.tox_callback_friend_message(self._tox_pointer, self.friend_message_cb, c_void_p(user_data))
# -----------------------------------------------------------------------------------------------------------------
# File transmission: common between sending and receiving
# -----------------------------------------------------------------------------------------------------------------
评论列表
文章目录