mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Hilighting updates. /HILIGHT -color, /SET hilight_color and /SET
hilight_act_color now use %codes for specifying color. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1402 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
aa4a4d4072
commit
c3da7fa8ab
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Irssi's colors that you can use in text formats etc. :
|
Irssi's colors that you can use in text formats, hilights, etc. :
|
||||||
|
|
||||||
text text background
|
text text background
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@ -23,8 +23,8 @@
|
|||||||
In .theme files %n works a bit differently. See default.theme
|
In .theme files %n works a bit differently. See default.theme
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
MIRC colors that you can use when writing text to channel and with
|
|
||||||
hilighting text:
|
MIRC colors that you can use when writing text to channel:
|
||||||
|
|
||||||
foreground (fg) background (bg)
|
foreground (fg) background (bg)
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
-word: <text> must match to full words
|
-word: <text> must match to full words
|
||||||
-nick: Hilight only the nick, not the whole line (default)
|
-nick: Hilight only the nick, not the whole line (default)
|
||||||
-nonick: Hilight the whole line with the hilight color.
|
-nonick: Hilight the whole line with the hilight color.
|
||||||
-color: Print the message with <color>, it can be either
|
-color: Print the message with <color>. color is in %code format
|
||||||
numeric MIRC color (see docs/formats.txt) or
|
(see docs/formats.txt)
|
||||||
a named english color
|
|
||||||
-level: Match only for <level> messages, default is
|
-level: Match only for <level> messages, default is
|
||||||
publics,msgs,notices,actions
|
publics,msgs,notices,actions
|
||||||
-channels: Match only in <channels>
|
-channels: Match only in <channels>
|
||||||
@ -18,8 +17,8 @@ Examples:
|
|||||||
Hilight lines that have "mynick" word:
|
Hilight lines that have "mynick" word:
|
||||||
/HILIGHT mynick
|
/HILIGHT mynick
|
||||||
|
|
||||||
Hilight lines that were written by nicks from *.fi
|
Hilight lines that were written by nicks from *.fi with bold green
|
||||||
/HILIGHT -mask *!*@*.fi
|
/HILIGHT -color %G -mask *!*@*.fi
|
||||||
|
|
||||||
For regular expressions, see `man 7 regex`.
|
For regular expressions, see `man 7 regex`.
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ char *name;
|
|||||||
|
|
||||||
time_t createtime;
|
time_t createtime;
|
||||||
int data_level;
|
int data_level;
|
||||||
int hilight_color, hilight_bg_color;
|
char *hilight_color;
|
||||||
|
|
||||||
#undef STRUCT_SERVER_REC
|
#undef STRUCT_SERVER_REC
|
||||||
|
@ -42,7 +42,7 @@ typedef struct {
|
|||||||
int history_lines, history_over_counter;
|
int history_lines, history_over_counter;
|
||||||
|
|
||||||
int data_level; /* current data level */
|
int data_level; /* current data level */
|
||||||
int hilight_color, hilight_bg_color; /* current hilight color */
|
char *hilight_color; /* current hilight color in %format */
|
||||||
|
|
||||||
time_t last_timestamp; /* When was last timestamp printed */
|
time_t last_timestamp; /* When was last timestamp printed */
|
||||||
time_t last_line; /* When was last line printed */
|
time_t last_line; /* When was last line printed */
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
#include "themes.h"
|
#include "themes.h"
|
||||||
#include "translation.h"
|
#include "translation.h"
|
||||||
|
|
||||||
|
static const char *format_backs = "04261537";
|
||||||
|
static const char *format_fores = "kbgcrmyw";
|
||||||
|
static const char *format_boldfores = "KBGCRMYW";
|
||||||
|
|
||||||
static int signal_gui_print_text;
|
static int signal_gui_print_text;
|
||||||
static int hide_text_style;
|
static int hide_text_style;
|
||||||
|
|
||||||
@ -57,9 +61,6 @@ int format_find_tag(const char *module, const char *tag)
|
|||||||
|
|
||||||
int format_expand_styles(GString *out, char format)
|
int format_expand_styles(GString *out, char format)
|
||||||
{
|
{
|
||||||
static const char *backs = "04261537";
|
|
||||||
static const char *fores = "kbgcrmyw";
|
|
||||||
static const char *boldfores = "KBGCRMYW";
|
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@ -102,30 +103,30 @@ int format_expand_styles(GString *out, char format)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* check if it's a background color */
|
/* check if it's a background color */
|
||||||
p = strchr(backs, format);
|
p = strchr(format_backs, format);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
g_string_append_c(out, 4);
|
g_string_append_c(out, 4);
|
||||||
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
||||||
g_string_append_c(out, (char) ((int) (p-backs)+'0'));
|
g_string_append_c(out, (char) ((int) (p-format_backs)+'0'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if it's a foreground color */
|
/* check if it's a foreground color */
|
||||||
if (format == 'p') format = 'm';
|
if (format == 'p') format = 'm';
|
||||||
p = strchr(fores, format);
|
p = strchr(format_fores, format);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
g_string_append_c(out, 4);
|
g_string_append_c(out, 4);
|
||||||
g_string_append_c(out, (char) ((int) (p-fores)+'0'));
|
g_string_append_c(out, (char) ((int) (p-format_fores)+'0'));
|
||||||
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if it's a bold foreground color */
|
/* check if it's a bold foreground color */
|
||||||
if (format == 'P') format = 'M';
|
if (format == 'P') format = 'M';
|
||||||
p = strchr(boldfores, format);
|
p = strchr(format_boldfores, format);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
g_string_append_c(out, 4);
|
g_string_append_c(out, 4);
|
||||||
g_string_append_c(out, (char) (8+(int) (p-boldfores)+'0'));
|
g_string_append_c(out, (char) (8+(int) (p-format_boldfores)+'0'));
|
||||||
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -212,8 +213,7 @@ void format_create_dest(TEXT_DEST_REC *dest,
|
|||||||
window_find_closest(server, target, level);
|
window_find_closest(server, target, level);
|
||||||
|
|
||||||
dest->hilight_priority = 0;
|
dest->hilight_priority = 0;
|
||||||
dest->hilight_color = 0;
|
dest->hilight_color = NULL;
|
||||||
dest->hilight_bg_color = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return length of text part in string (ie. without % codes) */
|
/* Return length of text part in string (ie. without % codes) */
|
||||||
@ -283,6 +283,40 @@ int format_real_length(const char *str, int len)
|
|||||||
return (int) (str-start);
|
return (int) (str-start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *format_string_expand(const char *text)
|
||||||
|
{
|
||||||
|
GString *out;
|
||||||
|
char code, *ret;
|
||||||
|
|
||||||
|
g_return_val_if_fail(text != NULL, NULL);
|
||||||
|
|
||||||
|
out = g_string_new(NULL);
|
||||||
|
|
||||||
|
code = 0;
|
||||||
|
while (*text != '\0') {
|
||||||
|
if (code == '%') {
|
||||||
|
/* color code */
|
||||||
|
if (!format_expand_styles(out, *text)) {
|
||||||
|
g_string_append_c(out, '%');
|
||||||
|
g_string_append_c(out, '%');
|
||||||
|
g_string_append_c(out, *text);
|
||||||
|
}
|
||||||
|
code = 0;
|
||||||
|
} else {
|
||||||
|
if (*text == '%')
|
||||||
|
code = *text;
|
||||||
|
else
|
||||||
|
g_string_append_c(out, *text);
|
||||||
|
}
|
||||||
|
|
||||||
|
text++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = out->str;
|
||||||
|
g_string_free(out, FALSE);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static char *format_get_text_args(TEXT_DEST_REC *dest,
|
static char *format_get_text_args(TEXT_DEST_REC *dest,
|
||||||
const char *text, char **arglist)
|
const char *text, char **arglist)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ typedef struct {
|
|||||||
int level;
|
int level;
|
||||||
|
|
||||||
int hilight_priority;
|
int hilight_priority;
|
||||||
int hilight_color, hilight_bg_color;
|
char *hilight_color;
|
||||||
} TEXT_DEST_REC;
|
} TEXT_DEST_REC;
|
||||||
|
|
||||||
int format_find_tag(const char *module, const char *tag);
|
int format_find_tag(const char *module, const char *tag);
|
||||||
@ -49,6 +49,8 @@ int format_get_length(const char *str);
|
|||||||
handles %codes. */
|
handles %codes. */
|
||||||
int format_real_length(const char *str, int len);
|
int format_real_length(const char *str, int len);
|
||||||
|
|
||||||
|
char *format_string_expand(const char *text);
|
||||||
|
|
||||||
char *format_get_text(const char *module, WINDOW_REC *window,
|
char *format_get_text(const char *module, WINDOW_REC *window,
|
||||||
void *server, const char *target,
|
void *server, const char *target,
|
||||||
int formatnum, ...);
|
int formatnum, ...);
|
||||||
@ -96,7 +98,7 @@ char *strip_codes(const char *input);
|
|||||||
/* send a fully parsed text string for GUI to print */
|
/* send a fully parsed text string for GUI to print */
|
||||||
void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
|
void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
|
||||||
|
|
||||||
#define FORMAT_COLOR_NOCHANGE ('0'-1)
|
#define FORMAT_COLOR_NOCHANGE ('0'-1) /* don't change this, at least hilighting depends this value */
|
||||||
|
|
||||||
#define FORMAT_STYLE_SPECIAL 0x60
|
#define FORMAT_STYLE_SPECIAL 0x60
|
||||||
#define FORMAT_STYLE_UNDERLINE (0x01 + FORMAT_STYLE_SPECIAL)
|
#define FORMAT_STYLE_UNDERLINE (0x01 + FORMAT_STYLE_SPECIAL)
|
||||||
|
@ -161,51 +161,6 @@ static HILIGHT_REC *hilight_find(const char *text, char **channels)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* color name -> mirc color number */
|
|
||||||
static int mirc_color_name(const char *name)
|
|
||||||
{
|
|
||||||
static const char *names[] = {
|
|
||||||
"bla dbla", /* black */
|
|
||||||
"blu dblu", /* blue */
|
|
||||||
"gree dgree", /* green */
|
|
||||||
"r dr br lr", /* red .. um.. only one of them. */
|
|
||||||
"br dbr dy", /* brown / dark yello */
|
|
||||||
"m p dm dp", /* magenta / purple */
|
|
||||||
"o", /* orange */
|
|
||||||
"y by", /* yellow */
|
|
||||||
"bg lg", /* bright green */
|
|
||||||
"c dc", /* cyan */
|
|
||||||
"bc lc", /* bright cyan */
|
|
||||||
"bb lb", /* bright blue */
|
|
||||||
"bm bp lm lp", /* bright magenta/purple */
|
|
||||||
"dgray dgrey", /* dark grey */
|
|
||||||
"grey gray", /* grey */
|
|
||||||
"w", /* white */
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *p, *pname;
|
|
||||||
int n, ok;
|
|
||||||
|
|
||||||
for (n = 0; names[n] != NULL; n++) {
|
|
||||||
pname = name; ok = TRUE;
|
|
||||||
for (p = names[n]; ; p++) {
|
|
||||||
if (*p == ' ' || *p == '\0') {
|
|
||||||
if (ok) return n+1;
|
|
||||||
if (*p == '\0') break;
|
|
||||||
|
|
||||||
ok = TRUE;
|
|
||||||
pname = name;
|
|
||||||
} else if (toupper((int) *p) == toupper((int) *pname))
|
|
||||||
pname++;
|
|
||||||
else
|
|
||||||
ok = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hilight_match_text(HILIGHT_REC *rec, const char *text,
|
static int hilight_match_text(HILIGHT_REC *rec, const char *text,
|
||||||
int *match_beg, int *match_end)
|
int *match_beg, int *match_end)
|
||||||
{
|
{
|
||||||
@ -291,77 +246,35 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_colors(const char *color, int *fg, int *bg)
|
static char *hilight_get_act_color(HILIGHT_REC *rec)
|
||||||
{
|
{
|
||||||
const char *p;
|
g_return_val_if_fail(rec != NULL, NULL);
|
||||||
|
|
||||||
if (!is_numeric(color, ','))
|
return g_strdup(rec->act_color != NULL ? rec->act_color :
|
||||||
return FALSE;
|
rec->color != NULL ? rec->color :
|
||||||
|
settings_get_str("hilight_act_color"));
|
||||||
*fg = atoi(color);
|
|
||||||
*bg = -1;
|
|
||||||
|
|
||||||
p = strchr(color, ',');
|
|
||||||
if (p != NULL) {
|
|
||||||
p++;
|
|
||||||
if (!is_numeric(p, '\0'))
|
|
||||||
return FALSE;
|
|
||||||
*bg = atoi(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *hilight_get_color(HILIGHT_REC *rec, int activity)
|
static char *hilight_get_color(HILIGHT_REC *rec)
|
||||||
{
|
{
|
||||||
const char *color;
|
const char *color;
|
||||||
char number[MAX_INT_STRLEN];
|
|
||||||
int colornum, fg, bg;
|
|
||||||
|
|
||||||
g_return_val_if_fail(rec != NULL, NULL);
|
g_return_val_if_fail(rec != NULL, NULL);
|
||||||
|
|
||||||
color = activity && rec->act_color != NULL ?
|
color = rec->color != NULL ? rec->color :
|
||||||
rec->act_color : rec->color;
|
settings_get_str("hilight_color");
|
||||||
if (color == NULL) {
|
|
||||||
color = settings_get_str(activity ? "hilight_act_color" :
|
|
||||||
"hilight_color");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isalpha((int) *color)) {
|
return format_string_expand(color);
|
||||||
/* color was specified with it's name - try to convert it */
|
|
||||||
colornum = mirc_color_name(color);
|
|
||||||
if (colornum <= 0) colornum = 16;
|
|
||||||
|
|
||||||
ltoa(number, colornum);
|
|
||||||
color = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_colors(color, &fg, &bg)) {
|
|
||||||
return bg == -1 ? g_strdup_printf("\003%02d", fg) :
|
|
||||||
g_strdup_printf("\003%d,%02d", fg, bg);
|
|
||||||
}
|
|
||||||
return g_strdup(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
||||||
{
|
{
|
||||||
char *color, *bgcolor;
|
|
||||||
|
|
||||||
dest->level |= MSGLEVEL_HILIGHT;
|
dest->level |= MSGLEVEL_HILIGHT;
|
||||||
|
|
||||||
if (rec->priority > 0)
|
if (rec->priority > 0)
|
||||||
dest->hilight_priority = rec->priority;
|
dest->hilight_priority = rec->priority;
|
||||||
|
|
||||||
color = hilight_get_color(rec, TRUE);
|
dest->hilight_color = hilight_get_act_color(rec);
|
||||||
if (*color == 3) {
|
|
||||||
dest->hilight_color = atoi(color+1);
|
|
||||||
bgcolor = color+1;
|
|
||||||
while (*bgcolor != ',' && *bgcolor != '\0')
|
|
||||||
bgcolor++;
|
|
||||||
dest->hilight_bg_color = *bgcolor != ',' ? -1 :
|
|
||||||
atoi(bgcolor+1);
|
|
||||||
}
|
|
||||||
g_free(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_print_text_stripped(TEXT_DEST_REC *dest, const char *str)
|
static void sig_print_text_stripped(TEXT_DEST_REC *dest, const char *str)
|
||||||
@ -413,7 +326,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
|
|||||||
if (next_line_hilight == NULL)
|
if (next_line_hilight == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color = hilight_get_color(next_line_hilight, FALSE);
|
color = hilight_get_color(next_line_hilight);
|
||||||
next_hilight_len = next_hilight_end-next_hilight_start;
|
next_hilight_len = next_hilight_end-next_hilight_start;
|
||||||
|
|
||||||
if (!next_line_hilight->word) {
|
if (!next_line_hilight->word) {
|
||||||
@ -482,7 +395,7 @@ char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
|||||||
rec = hilight_match(server, channel, nick, address,
|
rec = hilight_match(server, channel, nick, address,
|
||||||
level, msg, NULL, NULL);
|
level, msg, NULL, NULL);
|
||||||
color = rec == NULL || !rec->nick ? NULL :
|
color = rec == NULL || !rec->nick ? NULL :
|
||||||
hilight_get_color(rec, FALSE);
|
hilight_get_color(rec);
|
||||||
|
|
||||||
next_nick_hilight = rec;
|
next_nick_hilight = rec;
|
||||||
return color;
|
return color;
|
||||||
@ -747,8 +660,8 @@ static void read_settings(void)
|
|||||||
|
|
||||||
void hilight_text_init(void)
|
void hilight_text_init(void)
|
||||||
{
|
{
|
||||||
settings_add_str("lookandfeel", "hilight_color", "8");
|
settings_add_str("lookandfeel", "hilight_color", "%Y");
|
||||||
settings_add_str("lookandfeel", "hilight_act_color", "13");
|
settings_add_str("lookandfeel", "hilight_act_color", "%M");
|
||||||
settings_add_str("lookandfeel", "hilight_level", "PUBLIC DCCMSGS");
|
settings_add_str("lookandfeel", "hilight_level", "PUBLIC DCCMSGS");
|
||||||
|
|
||||||
next_nick_hilight = NULL;
|
next_nick_hilight = NULL;
|
||||||
|
@ -34,8 +34,6 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
|
|||||||
int level, const char *str,
|
int level, const char *str,
|
||||||
int *match_beg, int *match_end);
|
int *match_beg, int *match_end);
|
||||||
|
|
||||||
char *hilight_get_color(HILIGHT_REC *rec, int activity);
|
|
||||||
|
|
||||||
char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
||||||
const char *nick, const char *address,
|
const char *nick, const char *address,
|
||||||
int level, const char *msg);
|
int level, const char *msg);
|
||||||
|
@ -391,6 +391,11 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
|
|||||||
signal_emit_id(signal_print_text_finished, 1, dest->window);
|
signal_emit_id(signal_print_text_finished, 1, dest->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sig_print_text_free(TEXT_DEST_REC *dest, const char *text)
|
||||||
|
{
|
||||||
|
g_free_and_null(dest->hilight_color);
|
||||||
|
}
|
||||||
|
|
||||||
void printtext_multiline(void *server, const char *target, int level,
|
void printtext_multiline(void *server, const char *target, int level,
|
||||||
const char *format, const char *text)
|
const char *format, const char *text)
|
||||||
{
|
{
|
||||||
@ -438,6 +443,7 @@ void printtext_init(void)
|
|||||||
|
|
||||||
read_settings();
|
read_settings();
|
||||||
signal_add("print text", (SIGNAL_FUNC) sig_print_text);
|
signal_add("print text", (SIGNAL_FUNC) sig_print_text);
|
||||||
|
signal_add_last("print text", (SIGNAL_FUNC) sig_print_text_free);
|
||||||
signal_add("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
signal_add("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
||||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
}
|
}
|
||||||
@ -445,6 +451,7 @@ void printtext_init(void)
|
|||||||
void printtext_deinit(void)
|
void printtext_deinit(void)
|
||||||
{
|
{
|
||||||
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
|
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
|
||||||
|
signal_remove("print text", (SIGNAL_FUNC) sig_print_text_free);
|
||||||
signal_remove("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
signal_remove("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
|
||||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
}
|
}
|
||||||
|
@ -36,15 +36,15 @@ static char **hide_targets;
|
|||||||
static int hide_level, msg_level, hilight_level;
|
static int hide_level, msg_level, hilight_level;
|
||||||
|
|
||||||
static void window_activity(WINDOW_REC *window, int data_level,
|
static void window_activity(WINDOW_REC *window, int data_level,
|
||||||
int hilight_color, int hilight_bg_color)
|
const char *hilight_color)
|
||||||
{
|
{
|
||||||
int old_data_level;
|
int old_data_level;
|
||||||
|
|
||||||
old_data_level = window->data_level;
|
old_data_level = window->data_level;
|
||||||
if (data_level == 0 || window->data_level < data_level) {
|
if (data_level == 0 || window->data_level < data_level) {
|
||||||
window->data_level = data_level;
|
window->data_level = data_level;
|
||||||
window->hilight_color = hilight_color;
|
g_free_not_null(window->hilight_color);
|
||||||
window->hilight_bg_color = hilight_bg_color;
|
window->hilight_color = g_strdup(hilight_color);
|
||||||
signal_emit("window hilight", 1, window);
|
signal_emit("window hilight", 1, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,15 +53,15 @@ static void window_activity(WINDOW_REC *window, int data_level,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void window_item_activity(WI_ITEM_REC *item, int data_level,
|
static void window_item_activity(WI_ITEM_REC *item, int data_level,
|
||||||
int hilight_color, int hilight_bg_color)
|
const char *hilight_color)
|
||||||
{
|
{
|
||||||
int old_data_level;
|
int old_data_level;
|
||||||
|
|
||||||
old_data_level = item->data_level;
|
old_data_level = item->data_level;
|
||||||
if (data_level == 0 || item->data_level < data_level) {
|
if (data_level == 0 || item->data_level < data_level) {
|
||||||
item->data_level = data_level;
|
item->data_level = data_level;
|
||||||
item->hilight_color = hilight_color;
|
g_free_not_null(item->hilight_color);
|
||||||
item->hilight_bg_color = hilight_bg_color;
|
item->hilight_color = g_strdup(hilight_color);
|
||||||
signal_emit("window item hilight", 1, item);
|
signal_emit("window item hilight", 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,12 +96,10 @@ static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
|
|||||||
item = window_item_find(dest->server, dest->target);
|
item = window_item_find(dest->server, dest->target);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
window_item_activity(item, data_level,
|
window_item_activity(item, data_level,
|
||||||
dest->hilight_color,
|
dest->hilight_color);
|
||||||
dest->hilight_bg_color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window_activity(dest->window, data_level,
|
window_activity(dest->window, data_level, dest->hilight_color);
|
||||||
dest->hilight_color, dest->hilight_bg_color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_dehilight_window(WINDOW_REC *window)
|
static void sig_dehilight_window(WINDOW_REC *window)
|
||||||
@ -111,9 +109,9 @@ static void sig_dehilight_window(WINDOW_REC *window)
|
|||||||
g_return_if_fail(window != NULL);
|
g_return_if_fail(window != NULL);
|
||||||
|
|
||||||
if (window->data_level != 0) {
|
if (window->data_level != 0) {
|
||||||
window_activity(window, 0, 0, 0);
|
window_activity(window, 0, NULL);
|
||||||
for (tmp = window->items; tmp != NULL; tmp = tmp->next)
|
for (tmp = window->items; tmp != NULL; tmp = tmp->next)
|
||||||
window_item_activity(tmp->data, 0, 0, 0);
|
window_item_activity(tmp->data, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,20 +226,14 @@ static char *get_activity_list(int normal, int hilight)
|
|||||||
g_string_append(str, "%W");
|
g_string_append(str, "%W");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/*FIXME:if (window->hilight_color > 0) {
|
g_string_append(str, window->hilight_color == NULL ?
|
||||||
int bg;
|
"%M" : window->hilight_color);
|
||||||
|
|
||||||
bg = window->hilight_bg_color == -1 ?
|
|
||||||
sbar_color_background :
|
|
||||||
(window->hilight_bg_color << 4);
|
|
||||||
set_color(stdscr, bg | mirc_colors[window->hilight_color%16]);
|
|
||||||
g_string_append(str, "%M");
|
|
||||||
} else */{
|
|
||||||
g_string_append(str, "%M");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_string_sprintfa(str, "%d", window->refnum);
|
g_string_sprintfa(str, "%d", window->refnum);
|
||||||
|
|
||||||
|
/* make sure the background is returned to default */
|
||||||
|
g_string_append(str, "%n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = str->len == 0 ? NULL : str->str;
|
ret = str->len == 0 ? NULL : str->str;
|
||||||
|
@ -239,7 +239,7 @@ void perl_window_item_fill_hash(HV *hv, WI_ITEM_REC *item)
|
|||||||
|
|
||||||
hv_store(hv, "createtime", 10, newSViv(item->createtime), 0);
|
hv_store(hv, "createtime", 10, newSViv(item->createtime), 0);
|
||||||
hv_store(hv, "data_level", 8, newSViv(item->data_level), 0);
|
hv_store(hv, "data_level", 8, newSViv(item->data_level), 0);
|
||||||
hv_store(hv, "hilight_color", 10, newSViv(item->hilight_color), 0);
|
hv_store(hv, "hilight_color", 10, new_pv(item->hilight_color), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel)
|
void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel)
|
||||||
|
@ -61,7 +61,7 @@ static void perl_window_fill_hash(HV *hv, WINDOW_REC *window)
|
|||||||
|
|
||||||
hv_store(hv, "level", 5, newSViv(window->level), 0);
|
hv_store(hv, "level", 5, newSViv(window->level), 0);
|
||||||
hv_store(hv, "data_level", 8, newSViv(window->data_level), 0);
|
hv_store(hv, "data_level", 8, newSViv(window->data_level), 0);
|
||||||
hv_store(hv, "hilight_color", 10, newSViv(window->hilight_color), 0);
|
hv_store(hv, "hilight_color", 10, new_pv(window->hilight_color), 0);
|
||||||
hv_store(hv, "last_timestamp", 14, newSViv(window->last_timestamp), 0);
|
hv_store(hv, "last_timestamp", 14, newSViv(window->last_timestamp), 0);
|
||||||
hv_store(hv, "last_line", 9, newSViv(window->last_line), 0);
|
hv_store(hv, "last_line", 9, newSViv(window->last_line), 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user