Attention flag for chat windows

User is able to toggle a flag for chat windows. This flag should be used to mark
the window for "Attention".

Use Ctrl+f to mark the window.
This commit is contained in:
DebXWoody
2021-05-29 08:05:03 +02:00
parent 69e3cebf26
commit 3520645366
8 changed files with 48 additions and 1 deletions

View File

@@ -125,6 +125,8 @@ static int _inp_rl_win_20_handler(int count, int key);
static int _inp_rl_win_prev_handler(int count, int key);
static int _inp_rl_win_next_handler(int count, int key);
static int _inp_rl_win_next_unread_handler(int count, int key);
static int _inp_rl_win_attention_handler(int count, int key);
static int _inp_rl_win_attention_next_handler(int count, int key);
static int _inp_rl_win_pageup_handler(int count, int key);
static int _inp_rl_win_pagedown_handler(int count, int key);
static int _inp_rl_subwin_pageup_handler(int count, int key);
@@ -480,6 +482,8 @@ _inp_rl_startup_hook(void)
rl_bind_keyseq("\\e\\e[C", _inp_rl_win_next_handler);
rl_bind_keyseq("\\ea", _inp_rl_win_next_unread_handler);
rl_bind_keyseq("\\ef", _inp_rl_win_attention_handler);
rl_bind_keyseq("\\em", _inp_rl_win_attention_next_handler);
rl_bind_keyseq("\\e\\e[5~", _inp_rl_subwin_pageup_handler);
rl_bind_keyseq("\\e[5;3~", _inp_rl_subwin_pageup_handler);
@@ -806,6 +810,24 @@ _inp_rl_win_next_unread_handler(int count, int key)
return 0;
}
static int
_inp_rl_win_attention_handler(int count, int key) {
ProfWin* current = wins_get_current();
if ( current ) {
ProfChatWin* chatwin = (ProfChatWin*)current;
chatwin->has_attention = !chatwin->has_attention;
win_redraw(current);
}
return 0;
}
static int
_inp_rl_win_attention_next_handler(int count, int key) {
//ProfWin* current = wins_get_current();
return 0;
}
static int
_inp_rl_win_pageup_handler(int count, int key)
{

View File

@@ -487,6 +487,18 @@ _show_privacy(ProfChatWin* chatwin)
return;
}
if (chatwin->has_attention) {
wprintw(win, " ");
wattron(win, bracket_attrs);
wprintw(win, "[");
wattroff(win, bracket_attrs);
wattron(win, encrypted_attrs);
wprintw(win, "ATTENTION");
wattroff(win, encrypted_attrs);
wattron(win, bracket_attrs);
wprintw(win, "]");
wattroff(win, bracket_attrs);
}
if (chatwin->pgp_send || chatwin->pgp_recv) {
GString* pgpmsg = g_string_new("PGP ");

View File

@@ -176,6 +176,7 @@ typedef struct prof_chat_win_t
// For LMC
char* last_message;
char* last_msg_id;
gboolean has_attention;
} ProfChatWin;
typedef struct prof_muc_win_t

View File

@@ -158,7 +158,7 @@ win_create_chat(const char* const barejid)
new_win->outgoing_char = NULL;
new_win->last_message = NULL;
new_win->last_msg_id = NULL;
new_win->has_attention = FALSE;
new_win->memcheck = PROFCHATWIN_MEMCHECK;
return &new_win->window;