mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Friends client id is now removed from the request received list when he is deleted.
This commit is contained in:
parent
d2d8965470
commit
04001b2ec3
|
@ -346,6 +346,7 @@ int m_delfriend(Messenger *m, int32_t friendnumber)
|
|||
onion_delfriend(m->onion_c, m->friendlist[friendnumber].onion_friendnum);
|
||||
crypto_kill(m->net_crypto, m->friendlist[friendnumber].crypt_connection_id);
|
||||
free(m->friendlist[friendnumber].statusmessage);
|
||||
remove_request_received(&(m->fr), m->friendlist[friendnumber].client_id);
|
||||
memset(&(m->friendlist[friendnumber]), 0, sizeof(Friend));
|
||||
uint32_t i;
|
||||
|
||||
|
|
|
@ -113,6 +113,25 @@ static int request_received(Friend_Requests *fr, uint8_t *client_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Remove client id from received_requests list.
|
||||
*
|
||||
* return 0 if it removed it successfully.
|
||||
* return -1 if it didn't find it.
|
||||
*/
|
||||
int remove_request_received(Friend_Requests *fr, uint8_t *client_id)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < MAX_RECEIVED_STORED; ++i) {
|
||||
if (id_equal(fr->received_requests[i], client_id)) {
|
||||
memset(fr->received_requests[i], 0, crypto_box_PUBLICKEYBYTES);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int friendreq_handlepacket(void *object, uint8_t *source_pubkey, uint8_t *packet, uint32_t length)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,13 @@ int send_friendrequest(Onion_Client *onion_c, uint8_t *public_key, uint32_t nosp
|
|||
void set_nospam(Friend_Requests *fr, uint32_t num);
|
||||
uint32_t get_nospam(Friend_Requests *fr);
|
||||
|
||||
/* Remove client id from received_requests list.
|
||||
*
|
||||
* return 0 if it removed it successfully.
|
||||
* return -1 if it didn't find it.
|
||||
*/
|
||||
int remove_request_received(Friend_Requests *fr, uint8_t *client_id);
|
||||
|
||||
/* 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)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user