mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-01 21:16:20 +00:00
Attention flag - Implemented Alt+m
This commit is contained in:
@@ -996,6 +996,18 @@ ui_win_unread(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
ui_win_has_attention(int index)
|
||||||
|
{
|
||||||
|
ProfWin* window = wins_get_by_num(index);
|
||||||
|
if (window) {
|
||||||
|
return win_has_attention(window);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
ui_ask_password(gboolean confirm)
|
ui_ask_password(gboolean confirm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -815,15 +814,7 @@ static int
|
|||||||
_inp_rl_win_attention_handler(int count, int key) {
|
_inp_rl_win_attention_handler(int count, int key) {
|
||||||
ProfWin* current = wins_get_current();
|
ProfWin* current = wins_get_current();
|
||||||
if ( current ) {
|
if ( current ) {
|
||||||
if (current->type == WIN_CHAT) {
|
win_toggle_attention(current);
|
||||||
ProfChatWin* chatwin = (ProfChatWin*)current;
|
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
|
||||||
chatwin->has_attention = !chatwin->has_attention;
|
|
||||||
} else if (current->type == WIN_MUC) {
|
|
||||||
ProfMucWin* mucwin = (ProfMucWin*)current;
|
|
||||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
||||||
mucwin->has_attention = !mucwin->has_attention;
|
|
||||||
}
|
|
||||||
win_redraw(current);
|
win_redraw(current);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -831,7 +822,10 @@ _inp_rl_win_attention_handler(int count, int key) {
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
_inp_rl_win_attention_next_handler(int count, int key) {
|
_inp_rl_win_attention_next_handler(int count, int key) {
|
||||||
//ProfWin* current = wins_get_current();
|
ProfWin* window = wins_get_next_attention();
|
||||||
|
if (window) {
|
||||||
|
ui_focus_win(window);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ int ui_close_all_wins(void);
|
|||||||
int ui_close_read_wins(void);
|
int ui_close_read_wins(void);
|
||||||
void ui_close_win(int index);
|
void ui_close_win(int index);
|
||||||
int ui_win_unread(int index);
|
int ui_win_unread(int index);
|
||||||
|
gboolean ui_win_has_attention(int index);
|
||||||
|
gboolean win_has_attention(ProfWin* window);
|
||||||
|
gboolean win_toggle_attention(ProfWin* window);
|
||||||
char* ui_ask_password(gboolean confirm);
|
char* ui_ask_password(gboolean confirm);
|
||||||
char* ui_get_line(void);
|
char* ui_get_line(void);
|
||||||
char* ui_ask_pgp_passphrase(const char* hint, int prev_fail);
|
char* ui_ask_pgp_passphrase(const char* hint, int prev_fail);
|
||||||
|
|||||||
@@ -1842,6 +1842,39 @@ win_unread(ProfWin* window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
win_has_attention(ProfWin* window)
|
||||||
|
{
|
||||||
|
if (window->type == WIN_CHAT) {
|
||||||
|
ProfChatWin* chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
|
return chatwin->has_attention;
|
||||||
|
} else if (window->type == WIN_MUC) {
|
||||||
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
return mucwin->has_attention;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
win_toggle_attention(ProfWin* window)
|
||||||
|
{
|
||||||
|
if (window->type == WIN_CHAT) {
|
||||||
|
ProfChatWin* chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
|
chatwin->has_attention = !chatwin->has_attention;
|
||||||
|
return chatwin->has_attention;
|
||||||
|
} else if (window->type == WIN_MUC) {
|
||||||
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
mucwin->has_attention = !mucwin->has_attention;
|
||||||
|
return mucwin->has_attention;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int indent)
|
win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int indent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1205,6 +1205,38 @@ wins_get_next_unread(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfWin*
|
||||||
|
wins_get_next_attention(void)
|
||||||
|
{
|
||||||
|
// get and sort win nums
|
||||||
|
GList* values = g_hash_table_get_values(windows);
|
||||||
|
values = g_list_sort(values, _wins_cmp_num);
|
||||||
|
GList* curr = values;
|
||||||
|
|
||||||
|
while (curr) {
|
||||||
|
// copy from wins_get_next_unread - what is it?
|
||||||
|
if (current == GPOINTER_TO_INT(curr->data)) {
|
||||||
|
curr = g_list_next(curr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfWin* window_current = wins_get_by_num( current);
|
||||||
|
ProfWin* window = curr->data;
|
||||||
|
if( window_current == window ) {
|
||||||
|
curr = g_list_next(curr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (win_has_attention(window)) {
|
||||||
|
g_list_free(values);
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
curr = g_list_next(curr);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free(values);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wins_add_urls_ac(const ProfWin* const win, const ProfMessage* const message)
|
wins_add_urls_ac(const ProfWin* const win, const ProfMessage* const message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ ProfWin* wins_get_by_string(const char* str);
|
|||||||
ProfWin* wins_get_next(void);
|
ProfWin* wins_get_next(void);
|
||||||
ProfWin* wins_get_previous(void);
|
ProfWin* wins_get_previous(void);
|
||||||
ProfWin* wins_get_next_unread(void);
|
ProfWin* wins_get_next_unread(void);
|
||||||
|
ProfWin* wins_get_next_attention(void);
|
||||||
int wins_get_num(ProfWin* window);
|
int wins_get_num(ProfWin* window);
|
||||||
int wins_get_current_num(void);
|
int wins_get_current_num(void);
|
||||||
void wins_close_by_num(int i);
|
void wins_close_by_num(int i);
|
||||||
|
|||||||
Reference in New Issue
Block a user