Infobar highlight notifications

This commit is contained in:
Sebastien Helleu 2004-01-21 18:40:13 +00:00
parent 7d91cdcbb3
commit dc38b59849
20 changed files with 1104 additions and 874 deletions

View File

@ -7,6 +7,7 @@ ChangeLog - 2004-01-21
Version 0.0.5 (under dev!): Version 0.0.5 (under dev!):
* fixed QUIT IRC command: now sent to all connected servers (not only current) * fixed QUIT IRC command: now sent to all connected servers (not only current)
* new Perl script function to display message in info bar ("IRC::print_infobar") * new Perl script function to display message in info bar ("IRC::print_infobar")
* info bar highlight notifications
* info bar timestamp is added to config ("look_infobar_timestamp") * info bar timestamp is added to config ("look_infobar_timestamp")
* added info bar (optional, "look_infobar" to enable it, "on" by default) * added info bar (optional, "look_infobar" to enable it, "on" by default)
* fixed crash with /oper command * fixed crash with /oper command

448
po/fr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,7 @@ char *cfg_look_no_nickname;
char *cfg_look_completor; char *cfg_look_completor;
int cfg_look_infobar; int cfg_look_infobar;
char *cfg_look_infobar_timestamp; char *cfg_look_infobar_timestamp;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] = t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"), { { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
@ -147,6 +148,11 @@ t_config_option weechat_options_look[] =
N_("timestamp for time in infobar"), N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0, OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL }, "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
OPTION_TYPE_INT, 0, INT_MAX, 7,
NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, NULL },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
}; };
@ -172,6 +178,7 @@ int cfg_col_status_data_other;
int cfg_col_status_more; int cfg_col_status_more;
int cfg_col_status_bg; int cfg_col_status_bg;
int cfg_col_infobar; int cfg_col_infobar;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg; int cfg_col_infobar_bg;
int cfg_col_input; int cfg_col_input;
int cfg_col_input_channel; int cfg_col_input_channel;
@ -274,6 +281,10 @@ t_config_option weechat_options_colors[] =
N_("color for info bar text"), N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0, OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, NULL }, "black", NULL, &cfg_col_infobar, NULL, NULL },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_infobar_highlight, NULL, NULL },
{ "col_infobar_bg", N_("background for info bar window"), { "col_infobar_bg", N_("background for info bar window"),
N_("background for info bar window"), N_("background for info bar window"),
OPTION_TYPE_COLOR, 0, 0, 0, OPTION_TYPE_COLOR, 0, 0, 0,

View File

@ -90,6 +90,7 @@ extern char *cfg_look_no_nickname;
extern char *cfg_look_completor; extern char *cfg_look_completor;
extern int cfg_look_infobar; extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp; extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title; extern int cfg_col_title;
extern int cfg_col_title_bg; extern int cfg_col_title_bg;
@ -111,6 +112,7 @@ extern int cfg_col_status_data_other;
extern int cfg_col_status_more; extern int cfg_col_status_more;
extern int cfg_col_status_bg; extern int cfg_col_status_bg;
extern int cfg_col_infobar; extern int cfg_col_infobar;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg; extern int cfg_col_infobar_bg;
extern int cfg_col_input; extern int cfg_col_input;
extern int cfg_col_input_channel; extern int cfg_col_input_channel;

View File

@ -944,10 +944,12 @@ gui_draw_window_infobar (t_gui_window *window)
time_seconds = time (NULL); time_seconds = time (NULL);
local_time = localtime (&time_seconds); local_time = localtime (&time_seconds);
strftime (text, 1024, cfg_look_infobar_timestamp, local_time); strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
if (gui_infobar)
wprintw (window->win_infobar, "%s | %s", text, gui_infobar->text);
else
wprintw (window->win_infobar, "%s", text); wprintw (window->win_infobar, "%s", text);
if (gui_infobar)
{
gui_window_set_color (window->win_infobar, gui_infobar->color);
wprintw (window->win_infobar, " | %s", gui_infobar->text);
}
wrefresh (window->win_infobar); wrefresh (window->win_infobar);
refresh (); refresh ();
@ -1408,6 +1410,8 @@ gui_init_colors ()
cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg); cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR, init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg); cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT, init_pair (COLOR_WIN_INPUT,
cfg_col_input & A_CHARTEXT, cfg_col_input_bg); cfg_col_input & A_CHARTEXT, cfg_col_input_bg);
init_pair (COLOR_WIN_INPUT_CHANNEL, init_pair (COLOR_WIN_INPUT_CHANNEL,
@ -1455,6 +1459,7 @@ gui_init_colors ()
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD; color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD;
color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD; color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD;
color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD; color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD;
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD;
color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD; color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD;
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD; color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD;
color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD; color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD;

View File

@ -184,19 +184,26 @@ gui_window_clear_all ()
} }
/* /*
* gui_infobar_print: display message in infobar * gui_infobar_printf: display message in infobar
*/ */
void void
gui_infobar_print (char *message, int time_displayed) gui_infobar_printf (int time_displayed, int color, char *message, ...)
{ {
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar; t_gui_infobar *ptr_infobar;
char *pos; char *pos;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar)); ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar) if (ptr_infobar)
{ {
ptr_infobar->text = strdup (message); ptr_infobar->color = color;
ptr_infobar->text = strdup (buffer);
pos = strchr (ptr_infobar->text, '\n'); pos = strchr (ptr_infobar->text, '\n');
if (pos) if (pos)
pos[0] = '\0'; pos[0] = '\0';

View File

@ -26,7 +26,7 @@
#define INPUT_BUFFER_BLOCK_SIZE 256 #define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 37 #define NUM_COLORS 38
#define COLOR_WIN_TITLE 1 #define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2 #define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3 #define COLOR_WIN_CHAT_TIME 3
@ -44,18 +44,19 @@
#define COLOR_WIN_STATUS_DATA_OTHER 15 #define COLOR_WIN_STATUS_DATA_OTHER 15
#define COLOR_WIN_STATUS_MORE 16 #define COLOR_WIN_STATUS_MORE 16
#define COLOR_WIN_INFOBAR 17 #define COLOR_WIN_INFOBAR 17
#define COLOR_WIN_INPUT 18 #define COLOR_WIN_INFOBAR_HIGHLIGHT 18
#define COLOR_WIN_INPUT_CHANNEL 19 #define COLOR_WIN_INPUT 19
#define COLOR_WIN_INPUT_NICK 20 #define COLOR_WIN_INPUT_CHANNEL 20
#define COLOR_WIN_NICK 21 #define COLOR_WIN_INPUT_NICK 21
#define COLOR_WIN_NICK_OP 22 #define COLOR_WIN_NICK 22
#define COLOR_WIN_NICK_HALFOP 23 #define COLOR_WIN_NICK_OP 23
#define COLOR_WIN_NICK_VOICE 24 #define COLOR_WIN_NICK_HALFOP 24
#define COLOR_WIN_NICK_SEP 25 #define COLOR_WIN_NICK_VOICE 25
#define COLOR_WIN_NICK_SELF 26 #define COLOR_WIN_NICK_SEP 26
#define COLOR_WIN_NICK_PRIVATE 27 #define COLOR_WIN_NICK_SELF 27
#define COLOR_WIN_NICK_FIRST 28 #define COLOR_WIN_NICK_PRIVATE 28
#define COLOR_WIN_NICK_LAST 37 #define COLOR_WIN_NICK_FIRST 29
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1) #define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define SERVER(window) ((t_irc_server *)(window->server)) #define SERVER(window) ((t_irc_server *)(window->server))
@ -112,6 +113,7 @@ typedef struct t_gui_infobar t_gui_infobar;
struct t_gui_infobar struct t_gui_infobar
{ {
int color; /* text color */
char *text; /* infobar text */ char *text; /* infobar text */
int remaining_time; /* delay (sec) before erasing this text */ int remaining_time; /* delay (sec) before erasing this text */
/* if < 0, text is never erased (except */ /* if < 0, text is never erased (except */
@ -204,7 +206,7 @@ extern t_gui_infobar *gui_infobar;
extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */ extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *); extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all (); extern void gui_window_clear_all ();
extern void gui_infobar_print (char *, int); extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_remove (); extern void gui_infobar_remove ();
extern t_gui_line *gui_new_line (t_gui_window *); extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *); extern t_gui_message *gui_new_message (t_gui_window *);

View File

@ -788,8 +788,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2[0] = '\0'; pos2[0] = '\0';
irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME); irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME);
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->window, gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host); COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
ptr_channel->name,
host, pos);
}
else else
gui_printf_color (ptr_channel->window, gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host); COLOR_WIN_CHAT_NICK, "%s", host);
@ -802,8 +811,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (ptr_nick) if (ptr_nick)
{ {
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->window, ptr_nick, irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0); MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else else
irc_display_nick (ptr_channel->window, ptr_nick, irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0); MSG_TYPE_NICK, 1, 1, 0);
@ -915,10 +933,18 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
MSG_TYPE_NICK, MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<"); COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
gui_printf_color_type (ptr_channel->window, gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK, MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT, COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host); "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else else
gui_printf_color_type (ptr_channel->window, gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK, MSG_TYPE_NICK,

View File

@ -215,7 +215,7 @@ static XS (XS_IRC_print_infobar)
(void) cv; (void) cv;
if (items == 2) if (items == 2)
gui_infobar_print (SvPV (ST (1), integer), SvIV (ST (0))); gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
else else
{ {
irc_display_prefix (NULL, PREFIX_ERROR); irc_display_prefix (NULL, PREFIX_ERROR);

View File

@ -7,6 +7,7 @@ ChangeLog - 2004-01-21
Version 0.0.5 (under dev!): Version 0.0.5 (under dev!):
* fixed QUIT IRC command: now sent to all connected servers (not only current) * fixed QUIT IRC command: now sent to all connected servers (not only current)
* new Perl script function to display message in info bar ("IRC::print_infobar") * new Perl script function to display message in info bar ("IRC::print_infobar")
* info bar highlight notifications
* info bar timestamp is added to config ("look_infobar_timestamp") * info bar timestamp is added to config ("look_infobar_timestamp")
* added info bar (optional, "look_infobar" to enable it, "on" by default) * added info bar (optional, "look_infobar" to enable it, "on" by default)
* fixed crash with /oper command * fixed crash with /oper command

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,7 @@ char *cfg_look_no_nickname;
char *cfg_look_completor; char *cfg_look_completor;
int cfg_look_infobar; int cfg_look_infobar;
char *cfg_look_infobar_timestamp; char *cfg_look_infobar_timestamp;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] = t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"), { { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
@ -147,6 +148,11 @@ t_config_option weechat_options_look[] =
N_("timestamp for time in infobar"), N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0, OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL }, "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
OPTION_TYPE_INT, 0, INT_MAX, 7,
NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, NULL },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
}; };
@ -172,6 +178,7 @@ int cfg_col_status_data_other;
int cfg_col_status_more; int cfg_col_status_more;
int cfg_col_status_bg; int cfg_col_status_bg;
int cfg_col_infobar; int cfg_col_infobar;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg; int cfg_col_infobar_bg;
int cfg_col_input; int cfg_col_input;
int cfg_col_input_channel; int cfg_col_input_channel;
@ -274,6 +281,10 @@ t_config_option weechat_options_colors[] =
N_("color for info bar text"), N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0, OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, NULL }, "black", NULL, &cfg_col_infobar, NULL, NULL },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_infobar_highlight, NULL, NULL },
{ "col_infobar_bg", N_("background for info bar window"), { "col_infobar_bg", N_("background for info bar window"),
N_("background for info bar window"), N_("background for info bar window"),
OPTION_TYPE_COLOR, 0, 0, 0, OPTION_TYPE_COLOR, 0, 0, 0,

View File

@ -90,6 +90,7 @@ extern char *cfg_look_no_nickname;
extern char *cfg_look_completor; extern char *cfg_look_completor;
extern int cfg_look_infobar; extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp; extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title; extern int cfg_col_title;
extern int cfg_col_title_bg; extern int cfg_col_title_bg;
@ -111,6 +112,7 @@ extern int cfg_col_status_data_other;
extern int cfg_col_status_more; extern int cfg_col_status_more;
extern int cfg_col_status_bg; extern int cfg_col_status_bg;
extern int cfg_col_infobar; extern int cfg_col_infobar;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg; extern int cfg_col_infobar_bg;
extern int cfg_col_input; extern int cfg_col_input;
extern int cfg_col_input_channel; extern int cfg_col_input_channel;

View File

@ -944,10 +944,12 @@ gui_draw_window_infobar (t_gui_window *window)
time_seconds = time (NULL); time_seconds = time (NULL);
local_time = localtime (&time_seconds); local_time = localtime (&time_seconds);
strftime (text, 1024, cfg_look_infobar_timestamp, local_time); strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
if (gui_infobar)
wprintw (window->win_infobar, "%s | %s", text, gui_infobar->text);
else
wprintw (window->win_infobar, "%s", text); wprintw (window->win_infobar, "%s", text);
if (gui_infobar)
{
gui_window_set_color (window->win_infobar, gui_infobar->color);
wprintw (window->win_infobar, " | %s", gui_infobar->text);
}
wrefresh (window->win_infobar); wrefresh (window->win_infobar);
refresh (); refresh ();
@ -1408,6 +1410,8 @@ gui_init_colors ()
cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg); cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR, init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg); cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT, init_pair (COLOR_WIN_INPUT,
cfg_col_input & A_CHARTEXT, cfg_col_input_bg); cfg_col_input & A_CHARTEXT, cfg_col_input_bg);
init_pair (COLOR_WIN_INPUT_CHANNEL, init_pair (COLOR_WIN_INPUT_CHANNEL,
@ -1455,6 +1459,7 @@ gui_init_colors ()
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD; color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD;
color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD; color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD;
color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD; color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD;
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD;
color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD; color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD;
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD; color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD;
color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD; color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD;

View File

@ -184,19 +184,26 @@ gui_window_clear_all ()
} }
/* /*
* gui_infobar_print: display message in infobar * gui_infobar_printf: display message in infobar
*/ */
void void
gui_infobar_print (char *message, int time_displayed) gui_infobar_printf (int time_displayed, int color, char *message, ...)
{ {
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar; t_gui_infobar *ptr_infobar;
char *pos; char *pos;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar)); ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar) if (ptr_infobar)
{ {
ptr_infobar->text = strdup (message); ptr_infobar->color = color;
ptr_infobar->text = strdup (buffer);
pos = strchr (ptr_infobar->text, '\n'); pos = strchr (ptr_infobar->text, '\n');
if (pos) if (pos)
pos[0] = '\0'; pos[0] = '\0';

View File

@ -26,7 +26,7 @@
#define INPUT_BUFFER_BLOCK_SIZE 256 #define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 37 #define NUM_COLORS 38
#define COLOR_WIN_TITLE 1 #define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2 #define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3 #define COLOR_WIN_CHAT_TIME 3
@ -44,18 +44,19 @@
#define COLOR_WIN_STATUS_DATA_OTHER 15 #define COLOR_WIN_STATUS_DATA_OTHER 15
#define COLOR_WIN_STATUS_MORE 16 #define COLOR_WIN_STATUS_MORE 16
#define COLOR_WIN_INFOBAR 17 #define COLOR_WIN_INFOBAR 17
#define COLOR_WIN_INPUT 18 #define COLOR_WIN_INFOBAR_HIGHLIGHT 18
#define COLOR_WIN_INPUT_CHANNEL 19 #define COLOR_WIN_INPUT 19
#define COLOR_WIN_INPUT_NICK 20 #define COLOR_WIN_INPUT_CHANNEL 20
#define COLOR_WIN_NICK 21 #define COLOR_WIN_INPUT_NICK 21
#define COLOR_WIN_NICK_OP 22 #define COLOR_WIN_NICK 22
#define COLOR_WIN_NICK_HALFOP 23 #define COLOR_WIN_NICK_OP 23
#define COLOR_WIN_NICK_VOICE 24 #define COLOR_WIN_NICK_HALFOP 24
#define COLOR_WIN_NICK_SEP 25 #define COLOR_WIN_NICK_VOICE 25
#define COLOR_WIN_NICK_SELF 26 #define COLOR_WIN_NICK_SEP 26
#define COLOR_WIN_NICK_PRIVATE 27 #define COLOR_WIN_NICK_SELF 27
#define COLOR_WIN_NICK_FIRST 28 #define COLOR_WIN_NICK_PRIVATE 28
#define COLOR_WIN_NICK_LAST 37 #define COLOR_WIN_NICK_FIRST 29
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1) #define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define SERVER(window) ((t_irc_server *)(window->server)) #define SERVER(window) ((t_irc_server *)(window->server))
@ -112,6 +113,7 @@ typedef struct t_gui_infobar t_gui_infobar;
struct t_gui_infobar struct t_gui_infobar
{ {
int color; /* text color */
char *text; /* infobar text */ char *text; /* infobar text */
int remaining_time; /* delay (sec) before erasing this text */ int remaining_time; /* delay (sec) before erasing this text */
/* if < 0, text is never erased (except */ /* if < 0, text is never erased (except */
@ -204,7 +206,7 @@ extern t_gui_infobar *gui_infobar;
extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */ extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *); extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all (); extern void gui_window_clear_all ();
extern void gui_infobar_print (char *, int); extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_remove (); extern void gui_infobar_remove ();
extern t_gui_line *gui_new_line (t_gui_window *); extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *); extern t_gui_message *gui_new_message (t_gui_window *);

View File

@ -788,8 +788,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2[0] = '\0'; pos2[0] = '\0';
irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME); irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME);
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->window, gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host); COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
ptr_channel->name,
host, pos);
}
else else
gui_printf_color (ptr_channel->window, gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host); COLOR_WIN_CHAT_NICK, "%s", host);
@ -802,8 +811,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (ptr_nick) if (ptr_nick)
{ {
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->window, ptr_nick, irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0); MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else else
irc_display_nick (ptr_channel->window, ptr_nick, irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0); MSG_TYPE_NICK, 1, 1, 0);
@ -915,10 +933,18 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
MSG_TYPE_NICK, MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<"); COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick)) if (strstr (pos, server->nick))
{
gui_printf_color_type (ptr_channel->window, gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK, MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT, COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host); "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else else
gui_printf_color_type (ptr_channel->window, gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK, MSG_TYPE_NICK,

View File

@ -215,7 +215,7 @@ static XS (XS_IRC_print_infobar)
(void) cv; (void) cv;
if (items == 2) if (items == 2)
gui_infobar_print (SvPV (ST (1), integer), SvIV (ST (0))); gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
else else
{ {
irc_display_prefix (NULL, PREFIX_ERROR); irc_display_prefix (NULL, PREFIX_ERROR);