diff --git a/pytox/toxcore/tox.pxd b/pytox/toxcore/tox.pxd index ad4cd23..61f5412 100644 --- a/pytox/toxcore/tox.pxd +++ b/pytox/toxcore/tox.pxd @@ -289,16 +289,15 @@ cdef extern from "tox/tox.h": TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_PEER_NOT_FOUND TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_TOO_LONG TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_EMPTY + TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_BAD_TYPE TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_PERMISSIONS TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_FAIL_SEND TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_DISCONNECTED - TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_BAD_TYPE cpdef enum Tox_Err_Group_Send_Custom_Packet: TOX_ERR_GROUP_SEND_CUSTOM_PACKET_OK TOX_ERR_GROUP_SEND_CUSTOM_PACKET_GROUP_NOT_FOUND TOX_ERR_GROUP_SEND_CUSTOM_PACKET_TOO_LONG TOX_ERR_GROUP_SEND_CUSTOM_PACKET_EMPTY - TOX_ERR_GROUP_SEND_CUSTOM_PACKET_PERMISSIONS TOX_ERR_GROUP_SEND_CUSTOM_PACKET_DISCONNECTED TOX_ERR_GROUP_SEND_CUSTOM_PACKET_FAIL_SEND cpdef enum Tox_Err_Group_Send_Custom_Private_Packet: @@ -307,7 +306,6 @@ cdef extern from "tox/tox.h": TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_TOO_LONG TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_EMPTY TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_PEER_NOT_FOUND - TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_PERMISSIONS TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_FAIL_SEND TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_DISCONNECTED cpdef enum Tox_Err_Group_Invite_Friend: @@ -434,21 +432,21 @@ cdef extern from "tox/tox.h": ctypedef void tox_conference_message_cb(Tox* tox, Tox_Conference_Number conference_number, Tox_Conference_Peer_Number peer_number, Tox_Message_Type type_, const uint8_t* message, size_t length, void* user_data) except * ctypedef void tox_conference_title_cb(Tox* tox, Tox_Conference_Number conference_number, Tox_Conference_Peer_Number peer_number, const uint8_t* title, size_t length, void* user_data) except * ctypedef void tox_group_self_join_cb(Tox* tox, Tox_Group_Number group_number, void* user_data) except * - ctypedef void tox_group_peer_name_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* name, size_t length, void* user_data) except * + ctypedef void tox_group_peer_name_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* name, size_t name_length, void* user_data) except * ctypedef void tox_group_peer_status_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_User_Status status, void* user_data) except * ctypedef void tox_group_peer_limit_cb(Tox* tox, Tox_Group_Number group_number, uint32_t peer_limit, void* user_data) except * ctypedef void tox_group_peer_join_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, void* user_data) except * ctypedef void tox_group_peer_exit_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Group_Exit_Type exit_type, const uint8_t* name, size_t name_length, const uint8_t* part_message, size_t part_message_length, void* user_data) except * - ctypedef void tox_group_topic_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* topic, size_t length, void* user_data) except * + ctypedef void tox_group_topic_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* topic, size_t topic_length, void* user_data) except * ctypedef void tox_group_privacy_state_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Privacy_State privacy_state, void* user_data) except * ctypedef void tox_group_voice_state_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Voice_State voice_state, void* user_data) except * ctypedef void tox_group_topic_lock_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Topic_Lock topic_lock, void* user_data) except * - ctypedef void tox_group_password_cb(Tox* tox, Tox_Group_Number group_number, const uint8_t* password, size_t length, void* user_data) except * - ctypedef void tox_group_message_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type_, const uint8_t* message, size_t length, Tox_Group_Message_Id message_id, void* user_data) except * - ctypedef void tox_group_private_message_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type_, const uint8_t* message, size_t length, void* user_data) except * - ctypedef void tox_group_custom_packet_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t length, void* user_data) except * - ctypedef void tox_group_custom_private_packet_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t length, void* user_data) except * - ctypedef void tox_group_invite_cb(Tox* tox, Tox_Friend_Number friend_number, const uint8_t* invite_data, size_t length, const uint8_t* group_name, size_t group_name_length, void* user_data) except * + ctypedef void tox_group_password_cb(Tox* tox, Tox_Group_Number group_number, const uint8_t* password, size_t password_length, void* user_data) except * + ctypedef void tox_group_message_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type message_type, const uint8_t* message, size_t message_length, Tox_Group_Message_Id message_id, void* user_data) except * + ctypedef void tox_group_private_message_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type message_type, const uint8_t* message, size_t message_length, Tox_Group_Message_Id message_id, void* user_data) except * + ctypedef void tox_group_custom_packet_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t data_length, void* user_data) except * + ctypedef void tox_group_custom_private_packet_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t data_length, void* user_data) except * + ctypedef void tox_group_invite_cb(Tox* tox, Tox_Friend_Number friend_number, const uint8_t* invite_data, size_t invite_data_length, const uint8_t* group_name, size_t group_name_length, void* user_data) except * ctypedef void tox_group_join_fail_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Join_Fail fail_type, void* user_data) except * ctypedef void tox_group_moderation_cb(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number source_peer_id, Tox_Group_Peer_Number target_peer_id, Tox_Group_Mod_Event mod_type, void* user_data) except * cdef bool tox_options_get_ipv6_enabled(const Tox_Options* self) @@ -660,8 +658,8 @@ cdef extern from "tox/tox.h": cdef void tox_callback_group_voice_state(Tox* self, tox_group_voice_state_cb* callback) cdef void tox_callback_group_topic_lock(Tox* self, tox_group_topic_lock_cb* callback) cdef void tox_callback_group_password(Tox* self, tox_group_password_cb* callback) - cdef Tox_Group_Message_Id tox_group_send_message(const Tox* self, Tox_Group_Number group_number, Tox_Message_Type type_, const uint8_t* message, size_t length, Tox_Err_Group_Send_Message* error) - cdef bool tox_group_send_private_message(const Tox* self, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type_, const uint8_t* message, size_t length, Tox_Err_Group_Send_Private_Message* error) + cdef Tox_Group_Message_Id tox_group_send_message(const Tox* self, Tox_Group_Number group_number, Tox_Message_Type message_type, const uint8_t* message, size_t length, Tox_Err_Group_Send_Message* error) + cdef Tox_Group_Message_Id tox_group_send_private_message(const Tox* self, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type message_type, const uint8_t* message, size_t length, Tox_Err_Group_Send_Private_Message* error) cdef bool tox_group_send_custom_packet(const Tox* self, Tox_Group_Number group_number, bool lossless, const uint8_t* data, size_t length, Tox_Err_Group_Send_Custom_Packet* error) cdef bool tox_group_send_custom_private_packet(const Tox* self, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, bool lossless, const uint8_t* data, size_t length, Tox_Err_Group_Send_Custom_Private_Packet* error) cdef void tox_callback_group_message(Tox* self, tox_group_message_cb* callback) diff --git a/pytox/toxcore/tox.pyi b/pytox/toxcore/tox.pyi index 7610834..4893415 100644 --- a/pytox/toxcore/tox.pyi +++ b/pytox/toxcore/tox.pyi @@ -230,7 +230,7 @@ class Tox_Ptr: def handle_group_peer_name(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, name: bytes) -> None: ... def handle_group_peer_status(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, status: Tox_User_Status) -> None: ... def handle_group_privacy_state(self, group_number: Tox_Group_Number, privacy_state: Tox_Group_Privacy_State) -> None: ... - def handle_group_private_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes) -> None: ... + def handle_group_private_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) -> None: ... def handle_group_self_join(self, group_number: Tox_Group_Number) -> None: ... def handle_group_topic(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, topic: bytes) -> None: ... def handle_group_topic_lock(self, group_number: Tox_Group_Number, topic_lock: Tox_Group_Topic_Lock) -> None: ... @@ -448,7 +448,6 @@ TOX_ERR_GROUP_SEND_CUSTOM_PACKET_EMPTY: Tox_Err_Group_Send_Custom_Packet TOX_ERR_GROUP_SEND_CUSTOM_PACKET_FAIL_SEND: Tox_Err_Group_Send_Custom_Packet TOX_ERR_GROUP_SEND_CUSTOM_PACKET_GROUP_NOT_FOUND: Tox_Err_Group_Send_Custom_Packet TOX_ERR_GROUP_SEND_CUSTOM_PACKET_OK: Tox_Err_Group_Send_Custom_Packet -TOX_ERR_GROUP_SEND_CUSTOM_PACKET_PERMISSIONS: Tox_Err_Group_Send_Custom_Packet TOX_ERR_GROUP_SEND_CUSTOM_PACKET_TOO_LONG: Tox_Err_Group_Send_Custom_Packet TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_DISCONNECTED: Tox_Err_Group_Send_Custom_Private_Packet TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_EMPTY: Tox_Err_Group_Send_Custom_Private_Packet @@ -456,7 +455,6 @@ TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_FAIL_SEND: Tox_Err_Group_Send_Custom_Pr TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_GROUP_NOT_FOUND: Tox_Err_Group_Send_Custom_Private_Packet TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_OK: Tox_Err_Group_Send_Custom_Private_Packet TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_PEER_NOT_FOUND: Tox_Err_Group_Send_Custom_Private_Packet -TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_PERMISSIONS: Tox_Err_Group_Send_Custom_Private_Packet TOX_ERR_GROUP_SEND_CUSTOM_PRIVATE_PACKET_TOO_LONG: Tox_Err_Group_Send_Custom_Private_Packet TOX_ERR_GROUP_SEND_MESSAGE_BAD_TYPE: Tox_Err_Group_Send_Message TOX_ERR_GROUP_SEND_MESSAGE_DISCONNECTED: Tox_Err_Group_Send_Message diff --git a/pytox/toxcore/tox.pyx b/pytox/toxcore/tox.pyx index ed98aaa..55b4044 100644 --- a/pytox/toxcore/tox.pyx +++ b/pytox/toxcore/tox.pyx @@ -102,8 +102,8 @@ cdef: py_handle_group_self_join( user_data, group_number) void py_handle_group_peer_name(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, name: bytes) except *: self.handle_group_peer_name(group_number, peer_id, name) - void handle_group_peer_name(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* name, size_t length, void* user_data) except *: - py_handle_group_peer_name( user_data, group_number, peer_id, name[:length]) + void handle_group_peer_name(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* name, size_t name_length, void* user_data) except *: + py_handle_group_peer_name( user_data, group_number, peer_id, name[:name_length]) void py_handle_group_peer_status(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, status: Tox_User_Status) except *: self.handle_group_peer_status(group_number, peer_id, status) void handle_group_peer_status(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_User_Status status, void* user_data) except *: @@ -122,8 +122,8 @@ cdef: py_handle_group_peer_exit( user_data, group_number, peer_id, exit_type, name[:name_length], part_message[:part_message_length]) void py_handle_group_topic(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, topic: bytes) except *: self.handle_group_topic(group_number, peer_id, topic) - void handle_group_topic(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* topic, size_t length, void* user_data) except *: - py_handle_group_topic( user_data, group_number, peer_id, topic[:length]) + void handle_group_topic(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* topic, size_t topic_length, void* user_data) except *: + py_handle_group_topic( user_data, group_number, peer_id, topic[:topic_length]) void py_handle_group_privacy_state(self: Tox_Ptr, group_number: Tox_Group_Number, privacy_state: Tox_Group_Privacy_State) except *: self.handle_group_privacy_state(group_number, privacy_state) void handle_group_privacy_state(Tox* tox, Tox_Group_Number group_number, Tox_Group_Privacy_State privacy_state, void* user_data) except *: @@ -138,28 +138,28 @@ cdef: py_handle_group_topic_lock( user_data, group_number, Tox_Group_Topic_Lock(topic_lock)) void py_handle_group_password(self: Tox_Ptr, group_number: Tox_Group_Number, password: bytes) except *: self.handle_group_password(group_number, password) - void handle_group_password(Tox* tox, Tox_Group_Number group_number, const uint8_t* password, size_t length, void* user_data) except *: - py_handle_group_password( user_data, group_number, password[:length]) - void py_handle_group_message(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) except *: - self.handle_group_message(group_number, peer_id, type_, message, message_id) - void handle_group_message(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type_, const uint8_t* message, size_t length, Tox_Group_Message_Id message_id, void* user_data) except *: - py_handle_group_message( user_data, group_number, peer_id, Tox_Message_Type(type_), message[:length], message_id) - void py_handle_group_private_message(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes) except *: - self.handle_group_private_message(group_number, peer_id, type_, message) - void handle_group_private_message(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type_, const uint8_t* message, size_t length, void* user_data) except *: - py_handle_group_private_message( user_data, group_number, peer_id, Tox_Message_Type(type_), message[:length]) + void handle_group_password(Tox* tox, Tox_Group_Number group_number, const uint8_t* password, size_t password_length, void* user_data) except *: + py_handle_group_password( user_data, group_number, password[:password_length]) + void py_handle_group_message(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, message_type: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) except *: + self.handle_group_message(group_number, peer_id, message_type, message, message_id) + void handle_group_message(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type message_type, const uint8_t* message, size_t message_length, Tox_Group_Message_Id message_id, void* user_data) except *: + py_handle_group_message( user_data, group_number, peer_id, Tox_Message_Type(message_type), message[:message_length], message_id) + void py_handle_group_private_message(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, message_type: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) except *: + self.handle_group_private_message(group_number, peer_id, message_type, message, message_id) + void handle_group_private_message(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type message_type, const uint8_t* message, size_t message_length, Tox_Group_Message_Id message_id, void* user_data) except *: + py_handle_group_private_message( user_data, group_number, peer_id, Tox_Message_Type(message_type), message[:message_length], message_id) void py_handle_group_custom_packet(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, data: bytes) except *: self.handle_group_custom_packet(group_number, peer_id, data) - void handle_group_custom_packet(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t length, void* user_data) except *: - py_handle_group_custom_packet( user_data, group_number, peer_id, data[:length]) + void handle_group_custom_packet(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t data_length, void* user_data) except *: + py_handle_group_custom_packet( user_data, group_number, peer_id, data[:data_length]) void py_handle_group_custom_private_packet(self: Tox_Ptr, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, data: bytes) except *: self.handle_group_custom_private_packet(group_number, peer_id, data) - void handle_group_custom_private_packet(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t length, void* user_data) except *: - py_handle_group_custom_private_packet( user_data, group_number, peer_id, data[:length]) + void handle_group_custom_private_packet(Tox* tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, const uint8_t* data, size_t data_length, void* user_data) except *: + py_handle_group_custom_private_packet( user_data, group_number, peer_id, data[:data_length]) void py_handle_group_invite(self: Tox_Ptr, friend_number: Tox_Friend_Number, invite_data: bytes, group_name: bytes) except *: self.handle_group_invite(friend_number, invite_data, group_name) - void handle_group_invite(Tox* tox, Tox_Friend_Number friend_number, const uint8_t* invite_data, size_t length, const uint8_t* group_name, size_t group_name_length, void* user_data) except *: - py_handle_group_invite( user_data, friend_number, invite_data[:length], group_name[:group_name_length]) + void handle_group_invite(Tox* tox, Tox_Friend_Number friend_number, const uint8_t* invite_data, size_t invite_data_length, const uint8_t* group_name, size_t group_name_length, void* user_data) except *: + py_handle_group_invite( user_data, friend_number, invite_data[:invite_data_length], group_name[:group_name_length]) void py_handle_group_join_fail(self: Tox_Ptr, group_number: Tox_Group_Number, fail_type: Tox_Group_Join_Fail) except *: self.handle_group_join_fail(group_number, fail_type) void handle_group_join_fail(Tox* tox, Tox_Group_Number group_number, Tox_Group_Join_Fail fail_type, void* user_data) except *: @@ -443,8 +443,8 @@ cdef class Tox_Ptr: def handle_group_voice_state(self, group_number: Tox_Group_Number, voice_state: Tox_Group_Voice_State) -> None: pass def handle_group_topic_lock(self, group_number: Tox_Group_Number, topic_lock: Tox_Group_Topic_Lock) -> None: pass def handle_group_password(self, group_number: Tox_Group_Number, password: bytes) -> None: pass - def handle_group_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) -> None: pass - def handle_group_private_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, type_: Tox_Message_Type, message: bytes) -> None: pass + def handle_group_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, message_type: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) -> None: pass + def handle_group_private_message(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, message_type: Tox_Message_Type, message: bytes, message_id: Tox_Group_Message_Id) -> None: pass def handle_group_custom_packet(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, data: bytes) -> None: pass def handle_group_custom_private_packet(self, group_number: Tox_Group_Number, peer_id: Tox_Group_Peer_Number, data: bytes) -> None: pass def handle_group_invite(self, friend_number: Tox_Friend_Number, invite_data: bytes, group_name: bytes) -> None: pass