Fixed the bug when receipts for messages sent from the receipt callback never arrived.

This commit is contained in:
Yuri 2017-03-05 10:23:47 -08:00 committed by Robin Lindén
parent e996a030f0
commit a3a22ae67e
No known key found for this signature in database
GPG Key ID: 601A604B7E605776

View File

@ -375,8 +375,6 @@ static int do_receipts(Messenger *m, int32_t friendnumber, void *userdata)
struct Receipts *receipts = m->friendlist[friendnumber].receipts_start;
while (receipts) {
struct Receipts *temp_r = receipts->next;
if (friend_received_packet(m, friendnumber, receipts->packet_num) == -1) {
break;
}
@ -385,9 +383,13 @@ static int do_receipts(Messenger *m, int32_t friendnumber, void *userdata)
(*m->read_receipt)(m, friendnumber, receipts->msg_id, userdata);
}
struct Receipts *r_next = receipts->next;
free(receipts);
m->friendlist[friendnumber].receipts_start = temp_r;
receipts = temp_r;
m->friendlist[friendnumber].receipts_start = r_next;
receipts = r_next;
}
if (!m->friendlist[friendnumber].receipts_start) {