Pass packet ID to custom packet handlers.

We don't expose this to the user code, yet, because it would break the
API, but this is useful for future internal code.
This commit is contained in:
iphydf 2020-03-07 14:21:54 +00:00
parent 7b3d2eda3f
commit bd7b7fadba
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
3 changed files with 10 additions and 10 deletions

View File

@ -1824,7 +1824,7 @@ static int m_handle_lossy_packet(void *object, int friend_num, const uint8_t *pa
}
if (m->lossy_packethandler) {
m->lossy_packethandler(m, friend_num, packet, length, userdata);
m->lossy_packethandler(m, friend_num, packet[0], packet, length, userdata);
}
return 1;
@ -1900,7 +1900,7 @@ static int handle_custom_lossless_packet(void *object, int friend_num, const uin
}
if (m->lossless_packethandler) {
m->lossless_packethandler(m, friend_num, packet, length, userdata);
m->lossless_packethandler(m, friend_num, packet[0], packet, length, userdata);
}
return 1;

View File

@ -200,10 +200,10 @@ typedef void m_file_chunk_request_cb(Messenger *m, uint32_t friend_number, uint3
size_t length, void *user_data);
typedef void m_file_recv_chunk_cb(Messenger *m, uint32_t friend_number, uint32_t file_number, uint64_t position,
const uint8_t *data, size_t length, void *user_data);
typedef void m_friend_lossy_packet_cb(Messenger *m, uint32_t friend_number, const uint8_t *data, size_t length,
void *user_data);
typedef void m_friend_lossless_packet_cb(Messenger *m, uint32_t friend_number, const uint8_t *data, size_t length,
void *user_data);
typedef void m_friend_lossy_packet_cb(Messenger *m, uint32_t friend_number, uint8_t packet_id, const uint8_t *data,
size_t length, void *user_data);
typedef void m_friend_lossless_packet_cb(Messenger *m, uint32_t friend_number, uint8_t packet_id, const uint8_t *data,
size_t length, void *user_data);
typedef void m_friend_connectionstatuschange_internal_cb(Messenger *m, uint32_t friend_number,
uint8_t connection_status, void *user_data);
typedef void m_conference_invite_cb(Messenger *m, uint32_t friend_number, const uint8_t *cookie, uint16_t length,

View File

@ -302,8 +302,8 @@ static void tox_conference_peer_list_changed_handler(Messenger *m, uint32_t conf
}
}
static void tox_friend_lossy_packet_handler(Messenger *m, uint32_t friend_number, const uint8_t *data, size_t length,
void *user_data)
static void tox_friend_lossy_packet_handler(Messenger *m, uint32_t friend_number, uint8_t packet_id,
const uint8_t *data, size_t length, void *user_data)
{
struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data;
@ -312,8 +312,8 @@ static void tox_friend_lossy_packet_handler(Messenger *m, uint32_t friend_number
}
}
static void tox_friend_lossless_packet_handler(Messenger *m, uint32_t friend_number, const uint8_t *data, size_t length,
void *user_data)
static void tox_friend_lossless_packet_handler(Messenger *m, uint32_t friend_number, uint8_t packet_id,
const uint8_t *data, size_t length, void *user_data)
{
struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data;