1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-29 06:56:44 +02:00

Refactor unread message flagging

This fixes an issue where the interface wasn't able to update
when the unread message flag changed. It also cleans up some
ugly code
This commit is contained in:
jfreegman
2021-11-19 22:54:35 -05:00
parent f3f81111c8
commit 1803da85c1
6 changed files with 85 additions and 31 deletions

View File

@ -28,8 +28,10 @@ struct cqueue_msg {
size_t len;
int line_id;
time_t last_send_try;
time_t time_added;
uint8_t type;
int64_t receipt;
bool noread_flag;
struct cqueue_msg *next;
struct cqueue_msg *prev;
};
@ -48,6 +50,12 @@ void cqueue_add(struct chat_queue *q, const char *msg, size_t len, uint8_t type,
*/
void cqueue_try_send(ToxWindow *self, Tox *m);
/*
* Sets the noread flag for messages sent to the peer associated with `self` which have not
* received a receipt after a period of time.
*/
void cqueue_check_unread(ToxWindow *self);
/* removes message with matching receipt from queue, writes to log and updates line to show the message was received. */
void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt);