Updated types in Messenger callbacks to fit with the ones in the new api.

Friend number changed from int32_t to uint32_t.
Some lengths changed to size_t.
This commit is contained in:
irungentoo 2015-02-17 15:49:22 -05:00
parent 7cefc9c458
commit c6a59e64b7
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
7 changed files with 95 additions and 90 deletions

View File

@ -774,7 +774,7 @@ static int terminate_call ( MSISession *session, MSICall *call )
return 0;
}
static void handle_remote_connection_change(Messenger *messenger, int friend_num, uint8_t status, void *session_p)
static void handle_remote_connection_change(Messenger *messenger, uint32_t friend_num, uint8_t status, void *session_p)
{
(void)messenger;
MSISession *session = session_p;
@ -1101,7 +1101,8 @@ static int handle_recv_error ( MSISession *session, MSICall *call, MSIMessage *m
*
*
*/
static void msi_handle_packet ( Messenger *messenger, int source, const uint8_t *data, uint16_t length, void *object )
static void msi_handle_packet ( Messenger *messenger, uint32_t source, const uint8_t *data, uint16_t length,
void *object )
{
LOGGER_DEBUG("Got msi message");
/* Unused */

View File

@ -341,7 +341,7 @@ RTPMessage *msg_parse ( const uint8_t *data, int length )
/**
* Callback for networking core.
*/
int rtp_handle_packet ( Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t length, void *object )
int rtp_handle_packet ( Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t length, void *object )
{
RTPSession *session = object;
RTPMessage *msg;

View File

@ -886,83 +886,83 @@ void m_set_sends_receipts(Messenger *m, int32_t friendnumber, int yesno)
m->friendlist[friendnumber].receives_read_receipts = yesno;
}
/* static void (*friend_request)(uint8_t *, uint8_t *, uint16_t); */
/* Set the function that will be executed when a friend request is received. */
void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, uint16_t,
void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, size_t,
void *), void *userdata)
{
void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, uint16_t, void *) = (void *)function;
void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, size_t, void *) = (void *)function;
callback_friendrequest(&(m->fr), handle_friendrequest, m, userdata);
}
/* Set the function that will be executed when a message from a friend is received. */
void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata)
{
m->friend_message = function;
m->friend_message_userdata = userdata;
}
void m_callback_action(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_action(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata)
{
m->friend_action = function;
m->friend_action_userdata = userdata;
}
void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata)
{
m->friend_namechange = function;
m->friend_namechange_userdata = userdata;
}
void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata)
{
m->friend_statusmessagechange = function;
m->friend_statuschange_userdata = userdata;
}
void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *), void *userdata)
void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *), void *userdata)
{
m->friend_userstatuschange = function;
m->friend_userstatuschange_userdata = userdata;
}
void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, int32_t, uint8_t, void *), void *userdata)
void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, uint32_t, uint8_t, void *), void *userdata)
{
m->friend_typingchange = function;
m->friend_typingchange_userdata = userdata;
}
void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, int32_t, uint32_t, void *), void *userdata)
void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, void *), void *userdata)
{
m->read_receipt = function;
m->read_receipt_userdata = userdata;
}
void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *), void *userdata)
void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *),
void *userdata)
{
m->friend_connectionstatuschange = function;
m->friend_connectionstatuschange_userdata = userdata;
}
void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *),
void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *),
void *userdata)
{
m->friend_connectionstatuschange_internal = function;
m->friend_connectionstatuschange_internal_userdata = userdata;
}
void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t *, void *),
void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t *, void *),
void *userdata)
{
m->avatar_info_recv = function;
m->avatar_info_recv_userdata = userdata;
}
void m_callback_avatar_data(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t *, uint8_t *,
void m_callback_avatar_data(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t *, uint8_t *,
uint32_t, void *), void *userdata)
{
m->avatar_data_recv = function;
@ -1027,9 +1027,9 @@ static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_
/* Set the callback for group invites.
*
* Function(Messenger *m, int32_t friendnumber, uint8_t *data, uint16_t length)
* Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length)
*/
void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t))
void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t))
{
m->group_invite = function;
}
@ -1050,9 +1050,10 @@ int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uin
/* Set the callback for file send requests.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
*/
void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint64_t, const uint8_t *,
void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint64_t,
const uint8_t *,
uint16_t, void *), void *userdata)
{
m->file_sendrequest = function;
@ -1061,10 +1062,10 @@ void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, int3
/* Set the callback for file control requests.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata)
*
*/
void callback_file_control(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t, uint8_t,
void callback_file_control(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t, uint8_t,
const uint8_t *, uint16_t, void *), void *userdata)
{
m->file_filecontrol = function;
@ -1073,10 +1074,11 @@ void callback_file_control(Messenger *m, void (*function)(Messenger *m, int32_t,
/* Set the callback for file data.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
*
*/
void callback_file_data(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, const uint8_t *, uint16_t length,
void callback_file_data(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, const uint8_t *,
uint16_t length,
void *), void *userdata)
{
m->file_filedata = function;
@ -1397,7 +1399,7 @@ static int handle_filecontrol(const Messenger *m, int32_t friendnumber, uint8_t
*
* Function(Messenger *m, int friendnumber, uint8_t *data, uint16_t length, void *userdata)
*/
void m_callback_msi_packet(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_msi_packet(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, void *),
void *userdata)
{
m->msi_packet = function;
@ -1430,7 +1432,7 @@ static int handle_custom_lossy_packet(void *object, int friend_num, const uint8_
}
int custom_lossy_packet_registerhandler(Messenger *m, int32_t friendnumber, uint8_t byte,
int (*packet_handler_callback)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
int (*packet_handler_callback)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
void *object)
{
if (friend_not_valid(m, friendnumber))
@ -1481,7 +1483,7 @@ static int handle_custom_lossless_packet(void *object, int friend_num, const uin
}
int custom_lossless_packet_registerhandler(Messenger *m, int32_t friendnumber, uint8_t byte,
int (*packet_handler_callback)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
int (*packet_handler_callback)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
void *object)
{
if (friend_not_valid(m, friendnumber))
@ -2839,7 +2841,7 @@ uint32_t get_num_online_friends(const Messenger *m)
* Otherwise, returns the number of elements copied.
* If the array was too small, the contents
* of out_list will be truncated to list_size. */
uint32_t copy_friendlist(Messenger const *m, int32_t *out_list, uint32_t list_size)
uint32_t copy_friendlist(Messenger const *m, uint32_t *out_list, uint32_t list_size)
{
if (!out_list)
return 0;

View File

@ -222,12 +222,12 @@ typedef struct {
AVATAR_RECEIVEDATA *avatar_recv_data; // We are receiving avatar data from this friend.
struct {
int (*function)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object);
int (*function)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object);
void *object;
} lossy_packethandlers[PACKET_ID_LOSSY_RANGE_SIZE];
struct {
int (*function)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object);
int (*function)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object);
void *object;
} lossless_packethandlers[PACKET_ID_LOSSLESS_RANGE_SIZE];
} Friend;
@ -270,43 +270,43 @@ struct Messenger {
uint8_t has_added_relays; // If the first connection has occurred in do_messenger
Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config
void (*friend_message)(struct Messenger *m, int32_t, const uint8_t *, uint16_t, void *);
void (*friend_message)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
void *friend_message_userdata;
void (*friend_action)(struct Messenger *m, int32_t, const uint8_t *, uint16_t, void *);
void (*friend_action)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
void *friend_action_userdata;
void (*friend_namechange)(struct Messenger *m, int32_t, const uint8_t *, uint16_t, void *);
void (*friend_namechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
void *friend_namechange_userdata;
void (*friend_statusmessagechange)(struct Messenger *m, int32_t, const uint8_t *, uint16_t, void *);
void (*friend_statusmessagechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
void *friend_statusmessagechange_userdata;
void (*friend_userstatuschange)(struct Messenger *m, int32_t, uint8_t, void *);
void (*friend_userstatuschange)(struct Messenger *m, uint32_t, uint8_t, void *);
void *friend_userstatuschange_userdata;
void (*friend_typingchange)(struct Messenger *m, int32_t, uint8_t, void *);
void (*friend_typingchange)(struct Messenger *m, uint32_t, uint8_t, void *);
void *friend_typingchange_userdata;
void (*read_receipt)(struct Messenger *m, int32_t, uint32_t, void *);
void (*read_receipt)(struct Messenger *m, uint32_t, uint32_t, void *);
void *read_receipt_userdata;
void (*friend_statuschange)(struct Messenger *m, int32_t, uint8_t, void *);
void (*friend_statuschange)(struct Messenger *m, uint32_t, uint8_t, void *);
void *friend_statuschange_userdata;
void (*friend_connectionstatuschange)(struct Messenger *m, int32_t, uint8_t, void *);
void (*friend_connectionstatuschange)(struct Messenger *m, uint32_t, uint8_t, void *);
void *friend_connectionstatuschange_userdata;
void (*friend_connectionstatuschange_internal)(struct Messenger *m, int32_t, uint8_t, void *);
void (*friend_connectionstatuschange_internal)(struct Messenger *m, uint32_t, uint8_t, void *);
void *friend_connectionstatuschange_internal_userdata;
void *avatar_info_recv_userdata;
void (*avatar_info_recv)(struct Messenger *m, int32_t, uint8_t, uint8_t *, void *);
void (*avatar_info_recv)(struct Messenger *m, uint32_t, uint8_t, uint8_t *, void *);
void *avatar_data_recv_userdata;
void (*avatar_data_recv)(struct Messenger *m, int32_t, uint8_t, uint8_t *, uint8_t *, uint32_t, void *);
void (*avatar_data_recv)(struct Messenger *m, uint32_t, uint8_t, uint8_t *, uint8_t *, uint32_t, void *);
void *group_chat_object; /* Set by new_groupchats()*/
void (*group_invite)(struct Messenger *m, int32_t, const uint8_t *, uint16_t);
void (*group_message)(struct Messenger *m, int32_t, const uint8_t *, uint16_t);
void (*group_invite)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t);
void (*group_message)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t);
void (*file_sendrequest)(struct Messenger *m, int32_t, uint8_t, uint64_t, const uint8_t *, uint16_t, void *);
void (*file_sendrequest)(struct Messenger *m, uint32_t, uint8_t, uint64_t, const uint8_t *, uint16_t, void *);
void *file_sendrequest_userdata;
void (*file_filecontrol)(struct Messenger *m, int32_t, uint8_t, uint8_t, uint8_t, const uint8_t *, uint16_t, void *);
void (*file_filecontrol)(struct Messenger *m, uint32_t, uint8_t, uint8_t, uint8_t, const uint8_t *, uint16_t, void *);
void *file_filecontrol_userdata;
void (*file_filedata)(struct Messenger *m, int32_t, uint8_t, const uint8_t *, uint16_t length, void *);
void (*file_filedata)(struct Messenger *m, uint32_t, uint8_t, const uint8_t *, uint16_t length, void *);
void *file_filedata_userdata;
void (*msi_packet)(struct Messenger *m, int32_t, const uint8_t *, uint16_t, void *);
void (*msi_packet)(struct Messenger *m, uint32_t, const uint8_t *, uint16_t, void *);
void *msi_packet_userdata;
Messenger_Options options;
@ -624,50 +624,50 @@ uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber);
void m_set_sends_receipts(Messenger *m, int32_t friendnumber, int yesno);
/* Set the function that will be executed when a friend request is received.
* Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length)
* Function format is function(uint8_t * public_key, uint8_t * data, size_t length)
*/
void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, uint16_t,
void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const uint8_t *, const uint8_t *, size_t,
void *), void *userdata);
/* Set the function that will be executed when a message from a friend is received.
* Function format is: function(int32_t friendnumber, uint8_t * message, uint32_t length)
* Function format is: function(uint32_t friendnumber, uint8_t * message, uint32_t length)
*/
void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata);
/* Set the function that will be executed when an action from a friend is received.
* Function format is: function(int32_t friendnumber, uint8_t * action, uint32_t length)
* Function format is: function(uint32_t friendnumber, uint8_t * action, uint32_t length)
*/
void m_callback_action(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_action(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata);
/* Set the callback for name changes.
* Function(int32_t friendnumber, uint8_t *newname, uint16_t length)
* Function(uint32_t friendnumber, uint8_t *newname, size_t length)
* You are not responsible for freeing newname.
*/
void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata);
/* Set the callback for status message changes.
* Function(int32_t friendnumber, uint8_t *newstatus, uint16_t length)
* Function(uint32_t friendnumber, uint8_t *newstatus, size_t length)
*
* You are not responsible for freeing newstatus
*/
void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *),
void *userdata);
/* Set the callback for status type changes.
* Function(int32_t friendnumber, USERSTATUS kind)
* Function(uint32_t friendnumber, USERSTATUS kind)
*/
void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *), void *userdata);
void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *), void *userdata);
/* Set the callback for typing changes.
* Function(int32_t friendnumber, uint8_t is_typing)
* Function(uint32_t friendnumber, uint8_t is_typing)
*/
void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, int32_t, uint8_t, void *), void *userdata);
void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, uint32_t, uint8_t, void *), void *userdata);
/* Set the callback for read receipts.
* Function(int32_t friendnumber, uint32_t receipt)
* Function(uint32_t friendnumber, uint32_t receipt)
*
* If you are keeping a record of returns from m_sendmessage,
* receipt might be one of those values, meaning the message
@ -675,10 +675,10 @@ void m_callback_typingchange(Messenger *m, void(*function)(Messenger *m, int32_t
* Since core doesn't track ids for you, receipt may not correspond to any message.
* In that case, you should discard it.
*/
void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, int32_t, uint32_t, void *), void *userdata);
void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, uint32_t, uint32_t, void *), void *userdata);
/* Set the callback for connection status changes.
* function(int32_t friendnumber, uint8_t status)
* function(uint32_t friendnumber, uint8_t status)
*
* Status:
* 0 -- friend went offline after being previously online.
@ -688,10 +688,10 @@ void m_callback_read_receipt(Messenger *m, void (*function)(Messenger *m, int32_
* being previously online" part.
* It's assumed that when adding friends, their connection status is offline.
*/
void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *),
void m_callback_connectionstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *),
void *userdata);
/* Same as previous but for internal A/V core usage only */
void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, void *),
void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, void *),
void *userdata);
@ -701,14 +701,14 @@ void m_callback_connectionstatus_internal_av(Messenger *m, void (*function)(Mess
* information requests.
*
* Function format is:
* function(Tox *tox, int32_t friendnumber, uint8_t format, uint8_t *hash, void *userdata)
* function(Tox *tox, uint32_t friendnumber, uint8_t format, uint8_t *hash, void *userdata)
*
* where 'format' is the avatar image format (see AVATAR_FORMAT) and 'hash' is the hash of
* the avatar data for caching purposes and it is exactly AVATAR_HASH_LENGTH long. If the
* image format is NONE, the hash is zeroed.
*
*/
void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t *, void *),
void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t *, void *),
void *userdata);
@ -717,7 +717,7 @@ void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, int32_t
* friend. This only happens in reply of a avatar data request (see tox_request_avatar_data);
*
* Function format is:
* function(Tox *tox, int32_t friendnumber, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t datalen, void *userdata)
* function(Tox *tox, uint32_t friendnumber, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t datalen, void *userdata)
*
* where 'format' is the avatar image format (see AVATAR_FORMAT); 'hash' is the
* locally-calculated cryptographic hash of the avatar data and it is exactly
@ -732,7 +732,7 @@ void m_callback_avatar_info(Messenger *m, void (*function)(Messenger *m, int32_t
* potentially malicious. The library only ensures that the data which arrived is the same the
* other user sent, and does not interpret or validate any image data.
*/
void m_callback_avatar_data(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t *, uint8_t *,
void m_callback_avatar_data(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t *, uint8_t *,
uint32_t, void *), void *userdata);
@ -741,9 +741,9 @@ void m_callback_avatar_data(Messenger *m, void (*function)(Messenger *m, int32_t
/* Set the callback for group invites.
*
* Function(Messenger *m, int32_t friendnumber, uint8_t *data, uint16_t length)
* Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length)
*/
void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t));
void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t));
/* Send a group invite packet.
*
@ -757,25 +757,27 @@ int send_group_invite_packet(const Messenger *m, int32_t friendnumber, const uin
/* Set the callback for file send requests.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata)
*/
void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint64_t, const uint8_t *,
void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint64_t,
const uint8_t *,
uint16_t, void *), void *userdata);
/* Set the callback for file control requests.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata)
*
*/
void callback_file_control(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, uint8_t, uint8_t,
void callback_file_control(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, uint8_t, uint8_t,
const uint8_t *, uint16_t, void *), void *userdata);
/* Set the callback for file data.
*
* Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
* Function(Tox *tox, uint32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
*
*/
void callback_file_data(Messenger *m, void (*function)(Messenger *m, int32_t, uint8_t, const uint8_t *, uint16_t length,
void callback_file_data(Messenger *m, void (*function)(Messenger *m, uint32_t, uint8_t, const uint8_t *,
uint16_t length,
void *), void *userdata);
/* Send a file send request.
@ -823,9 +825,9 @@ uint64_t file_dataremaining(const Messenger *m, int32_t friendnumber, uint8_t fi
/* Set the callback for msi packets.
*
* Function(Messenger *m, int32_t friendnumber, uint8_t *data, uint16_t length, void *userdata)
* Function(Messenger *m, uint32_t friendnumber, uint8_t *data, uint16_t length, void *userdata)
*/
void m_callback_msi_packet(Messenger *m, void (*function)(Messenger *m, int32_t, const uint8_t *, uint16_t, void *),
void m_callback_msi_packet(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, uint16_t, void *),
void *userdata);
/* Send an msi packet.
@ -843,7 +845,7 @@ int m_msi_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data,
* return 0 on success.
*/
int custom_lossy_packet_registerhandler(Messenger *m, int32_t friendnumber, uint8_t byte,
int (*packet_handler_callback)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
int (*packet_handler_callback)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
void *object);
/* High level function to send custom lossy packets.
@ -862,7 +864,7 @@ int send_custom_lossy_packet(const Messenger *m, int32_t friendnumber, const uin
* return 0 on success.
*/
int custom_lossless_packet_registerhandler(Messenger *m, int32_t friendnumber, uint8_t byte,
int (*packet_handler_callback)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
int (*packet_handler_callback)(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint32_t len, void *object),
void *object);
/* High level function to send custom lossless packets.
@ -918,6 +920,6 @@ uint32_t get_num_online_friends(const Messenger *m);
* Otherwise, returns the number of elements copied.
* If the array was too small, the contents
* of out_list will be truncated to list_size. */
uint32_t copy_friendlist(const Messenger *m, int32_t *out_list, uint32_t list_size);
uint32_t copy_friendlist(const Messenger *m, uint32_t *out_list, uint32_t list_size);
#endif

View File

@ -42,7 +42,7 @@ uint32_t get_nospam(const Friend_Requests *fr)
/* Set the function that will be executed when a friend request is received. */
void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, uint16_t,
void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t,
void *), void *object, void *userdata)
{
fr->handle_friendrequest = function;

View File

@ -30,7 +30,7 @@
typedef struct {
uint32_t nospam;
void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, uint16_t, void *);
void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, size_t, void *);
uint8_t handle_friendrequest_isset;
void *handle_friendrequest_object;
void *handle_friendrequest_userdata;
@ -59,9 +59,9 @@ uint32_t get_nospam(const Friend_Requests *fr);
int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk);
/* Set the function that will be executed when a friend request for us is received.
* Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata)
* Function format is function(uint8_t * public_key, uint8_t * data, size_t length, void * userdata)
*/
void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, uint16_t,
void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t,
void *), void *object, void *userdata);
/* Set the function used to check if a friend request should be displayed to the user or not.

View File

@ -1236,7 +1236,7 @@ int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title, uin
return max_length;
}
static void handle_friend_invite_packet(Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length)
static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint16_t length)
{
Group_Chats *g_c = m->group_chat_object;