mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
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:
parent
69e3cebf26
commit
3520645366
@ -471,6 +471,7 @@ cmd_ac_init(void)
|
|||||||
|
|
||||||
wins_ac = autocomplete_new();
|
wins_ac = autocomplete_new();
|
||||||
autocomplete_add(wins_ac, "unread");
|
autocomplete_add(wins_ac, "unread");
|
||||||
|
autocomplete_add(wins_ac, "attention");
|
||||||
autocomplete_add(wins_ac, "prune");
|
autocomplete_add(wins_ac, "prune");
|
||||||
autocomplete_add(wins_ac, "swap");
|
autocomplete_add(wins_ac, "swap");
|
||||||
|
|
||||||
|
@ -973,6 +973,7 @@ static struct cmd_t command_defs[] = {
|
|||||||
parse_args, 0, 3, NULL,
|
parse_args, 0, 3, NULL,
|
||||||
CMD_SUBFUNCS(
|
CMD_SUBFUNCS(
|
||||||
{ "unread", cmd_wins_unread },
|
{ "unread", cmd_wins_unread },
|
||||||
|
{ "attention", cmd_wins_attention },
|
||||||
{ "prune", cmd_wins_prune },
|
{ "prune", cmd_wins_prune },
|
||||||
{ "swap", cmd_wins_swap })
|
{ "swap", cmd_wins_swap })
|
||||||
CMD_MAINFUNC(cmd_wins)
|
CMD_MAINFUNC(cmd_wins)
|
||||||
@ -981,6 +982,7 @@ static struct cmd_t command_defs[] = {
|
|||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/wins",
|
"/wins",
|
||||||
"/wins unread",
|
"/wins unread",
|
||||||
|
"/wins attention",
|
||||||
"/wins prune",
|
"/wins prune",
|
||||||
"/wins swap <source> <target>")
|
"/wins swap <source> <target>")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
@ -988,6 +990,7 @@ static struct cmd_t command_defs[] = {
|
|||||||
"Passing no argument will list all currently active windows and information about their usage.")
|
"Passing no argument will list all currently active windows and information about their usage.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "unread", "List windows with unread messages." },
|
{ "unread", "List windows with unread messages." },
|
||||||
|
{ "attention", "Marked windows" },
|
||||||
{ "prune", "Close all windows with no unread messages." },
|
{ "prune", "Close all windows with no unread messages." },
|
||||||
{ "swap <source> <target>", "Swap windows, target may be an empty position." })
|
{ "swap <source> <target>", "Swap windows, target may be an empty position." })
|
||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
|
@ -1298,6 +1298,13 @@ cmd_wins_unread(ProfWin* window, const char* const command, gchar** args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cmd_wins_attention(ProfWin* window, const char* const command, gchar** args)
|
||||||
|
{
|
||||||
|
cons_show_wins(TRUE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_wins_prune(ProfWin* window, const char* const command, gchar** args)
|
cmd_wins_prune(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +209,7 @@ gboolean cmd_otr_sendfile(ProfWin* window, const char* const command, gchar** ar
|
|||||||
|
|
||||||
gboolean cmd_wins(ProfWin* window, const char* const command, gchar** args);
|
gboolean cmd_wins(ProfWin* window, const char* const command, gchar** args);
|
||||||
gboolean cmd_wins_unread(ProfWin* window, const char* const command, gchar** args);
|
gboolean cmd_wins_unread(ProfWin* window, const char* const command, gchar** args);
|
||||||
|
gboolean cmd_wins_attention(ProfWin* window, const char* const command, gchar** args);
|
||||||
gboolean cmd_wins_prune(ProfWin* window, const char* const command, gchar** args);
|
gboolean cmd_wins_prune(ProfWin* window, const char* const command, gchar** args);
|
||||||
gboolean cmd_wins_swap(ProfWin* window, const char* const command, gchar** args);
|
gboolean cmd_wins_swap(ProfWin* window, const char* const command, gchar** args);
|
||||||
|
|
||||||
|
@ -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_prev_handler(int count, int key);
|
||||||
static int _inp_rl_win_next_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_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_pageup_handler(int count, int key);
|
||||||
static int _inp_rl_win_pagedown_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);
|
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("\\e\\e[C", _inp_rl_win_next_handler);
|
||||||
|
|
||||||
rl_bind_keyseq("\\ea", _inp_rl_win_next_unread_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\\e[5~", _inp_rl_subwin_pageup_handler);
|
||||||
rl_bind_keyseq("\\e[5;3~", _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;
|
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
|
static int
|
||||||
_inp_rl_win_pageup_handler(int count, int key)
|
_inp_rl_win_pageup_handler(int count, int key)
|
||||||
{
|
{
|
||||||
|
@ -487,6 +487,18 @@ _show_privacy(ProfChatWin* chatwin)
|
|||||||
|
|
||||||
return;
|
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) {
|
if (chatwin->pgp_send || chatwin->pgp_recv) {
|
||||||
GString* pgpmsg = g_string_new("PGP ");
|
GString* pgpmsg = g_string_new("PGP ");
|
||||||
|
@ -176,6 +176,7 @@ typedef struct prof_chat_win_t
|
|||||||
// For LMC
|
// For LMC
|
||||||
char* last_message;
|
char* last_message;
|
||||||
char* last_msg_id;
|
char* last_msg_id;
|
||||||
|
gboolean has_attention;
|
||||||
} ProfChatWin;
|
} ProfChatWin;
|
||||||
|
|
||||||
typedef struct prof_muc_win_t
|
typedef struct prof_muc_win_t
|
||||||
|
@ -158,7 +158,7 @@ win_create_chat(const char* const barejid)
|
|||||||
new_win->outgoing_char = NULL;
|
new_win->outgoing_char = NULL;
|
||||||
new_win->last_message = NULL;
|
new_win->last_message = NULL;
|
||||||
new_win->last_msg_id = NULL;
|
new_win->last_msg_id = NULL;
|
||||||
|
new_win->has_attention = FALSE;
|
||||||
new_win->memcheck = PROFCHATWIN_MEMCHECK;
|
new_win->memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
|
|
||||||
return &new_win->window;
|
return &new_win->window;
|
||||||
|
Loading…
Reference in New Issue
Block a user