mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:13:01 +01:00
properly flag lines with unread mark
This commit is contained in:
parent
416ebc9ab8
commit
09f90d095b
@ -156,15 +156,13 @@ void line_info_add(ToxWindow *self, char *timestr, char *name1, char *name2, uin
|
||||
/* for type-specific formatting in print function */
|
||||
switch (type) {
|
||||
case IN_ACTION:
|
||||
case OUT_ACTION:
|
||||
len += 3;
|
||||
break;
|
||||
|
||||
case OUT_ACTION:
|
||||
len += 5;
|
||||
break;
|
||||
|
||||
case IN_MSG:
|
||||
case OUT_MSG:
|
||||
len += 4;
|
||||
len += 2;
|
||||
break;
|
||||
|
||||
case CONNECTION:
|
||||
@ -214,6 +212,7 @@ void line_info_add(ToxWindow *self, char *timestr, char *name1, char *name2, uin
|
||||
new_line->type = type;
|
||||
new_line->bold = bold;
|
||||
new_line->colour = colour;
|
||||
new_line->noread_flag = false;
|
||||
new_line->timestamp = get_unix_time();
|
||||
|
||||
hst->queue[hst->queue_sz++] = new_line;
|
||||
@ -320,6 +319,11 @@ void line_info_print(ToxWindow *self)
|
||||
wattron(win, COLOR_PAIR(RED));
|
||||
wprintw(win, " x", line->msg);
|
||||
wattroff(win, COLOR_PAIR(RED));
|
||||
|
||||
if (line->noread_flag == false) {
|
||||
line->noread_flag = true;
|
||||
line->len += 2;
|
||||
}
|
||||
}
|
||||
|
||||
wprintw(win, "\n", line->msg);
|
||||
@ -340,6 +344,11 @@ void line_info_print(ToxWindow *self)
|
||||
wattron(win, COLOR_PAIR(RED));
|
||||
wprintw(win, " x", line->msg);
|
||||
wattroff(win, COLOR_PAIR(RED));
|
||||
|
||||
if (line->noread_flag == false) {
|
||||
line->noread_flag = true;
|
||||
line->len += 2;
|
||||
}
|
||||
}
|
||||
|
||||
wprintw(win, "\n", line->msg);
|
||||
|
@ -52,6 +52,7 @@ struct line_info {
|
||||
uint8_t type;
|
||||
uint8_t bold;
|
||||
uint8_t colour;
|
||||
uint8_t noread_flag; /* true if a line should be flagged as unread */
|
||||
uint32_t id;
|
||||
uint16_t len; /* combined len of entire line */
|
||||
uint8_t newlines;
|
||||
|
@ -70,8 +70,10 @@ static void cqueue_mark_read(ToxWindow *self, uint32_t id, uint8_t type)
|
||||
if (line->id == id) {
|
||||
line->type = type == OUT_ACTION ? OUT_ACTION_READ : OUT_MSG_READ;
|
||||
|
||||
if (timed_out(line->timestamp, get_unix_time(), CQUEUE_TRY_SEND_INTERVAL))
|
||||
line->len -= 2; /* removes " x" */
|
||||
if (line->noread_flag == true) {
|
||||
line->len -= 2;
|
||||
line->noread_flag = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user