summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/signals.txt7
-rw-r--r--src/core/window-item-rec.h4
-rw-r--r--src/fe-common/core/fe-messages.c2
-rw-r--r--src/fe-common/core/fe-queries.c2
-rw-r--r--src/fe-common/core/fe-windows.h15
-rw-r--r--src/fe-common/core/formats.c3
-rw-r--r--src/fe-common/core/formats.h3
-rw-r--r--src/fe-common/core/hilight-text.c139
-rw-r--r--src/fe-common/core/hilight-text.h11
-rw-r--r--src/fe-common/core/window-activity.c189
-rw-r--r--src/fe-common/core/window-commands.c4
-rw-r--r--src/fe-text/mainwindow-activity.c6
-rw-r--r--src/fe-text/statusbar-items.c28
-rw-r--r--src/perl/perl-common.c8
14 files changed, 190 insertions, 231 deletions
diff --git a/docs/signals.txt b/docs/signals.txt
index 7aea8658..79451139 100644
--- a/docs/signals.txt
+++ b/docs/signals.txt
@@ -236,10 +236,6 @@ fe-messages.c:
"message invite", SERVER_REC, char *channel, char *nick, char *address
"message topic", SERVER_REC, char *channel, char *topic, char *nick, char *address
-hilight-text.c:
- "window hilight", WINDOW_REC, int level
- "window activity", WINDOW_REC, int level
-
keyboard.c:
"keyinfo created", KEYINFO_REC
"keyinfo destroyed", KEYINFO_REC
@@ -253,7 +249,10 @@ themes.c:
"theme destroyed", THEME_REC
window-activity.c:
+ "window hilight", WINDOW_REC
+ "window activity", WINDOW_REC, int old_level
"window item hilight", WI_ITEM_REC
+ "window item activity", WI_ITEM_REC, int old_lvel
window-items.c:
"window item new", WINDOW_REC, WI_ITEM_REC
diff --git a/src/core/window-item-rec.h b/src/core/window-item-rec.h
index ea5365a9..dae5d5ec 100644
--- a/src/core/window-item-rec.h
+++ b/src/core/window-item-rec.h
@@ -9,7 +9,7 @@ STRUCT_SERVER_REC *server;
char *name;
time_t createtime;
-int new_data;
-int last_color; /* if NEWDATA_HILIGHT is set, color number could be specified here */
+int data_level;
+int hilight_color;
#undef STRUCT_SERVER_REC
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c
index 5a8290b5..ae0faacf 100644
--- a/src/fe-common/core/fe-messages.c
+++ b/src/fe-common/core/fe-messages.c
@@ -142,7 +142,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
for_me = nick_match_msg(chanrec, msg, server->nick);
color = for_me ? NULL :
- hilight_find_nick(target, nick, address, MSGLEVEL_PUBLIC, msg);
+ hilight_match_nick(target, nick, address, MSGLEVEL_PUBLIC, msg);
print_channel = chanrec == NULL ||
!window_item_is_active((WI_ITEM_REC *) chanrec);
diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c
index b4272011..68c67eb8 100644
--- a/src/fe-common/core/fe-queries.c
+++ b/src/fe-common/core/fe-queries.c
@@ -283,7 +283,7 @@ static int sig_query_autoclose(void)
next = tmp->next;
window = window_item_window((WI_ITEM_REC *) rec);
- if (window != active_win && rec->new_data == 0 &&
+ if (window != active_win && rec->data_level == 0 &&
now-window->last_line > query_auto_close)
query_destroy(rec);
}
diff --git a/src/fe-common/core/fe-windows.h b/src/fe-common/core/fe-windows.h
index aaa3f0ce..11e1ffd1 100644
--- a/src/fe-common/core/fe-windows.h
+++ b/src/fe-common/core/fe-windows.h
@@ -7,10 +7,10 @@
#include "window-item-def.h"
enum {
- NEWDATA_TEXT = 1,
- NEWDATA_MSG,
- NEWDATA_HILIGHT,
- NEWDATA_CUSTOM
+ DATA_LEVEL_NONE = 0,
+ DATA_LEVEL_TEXT,
+ DATA_LEVEL_MSG,
+ DATA_LEVEL_HILIGHT
};
typedef struct {
@@ -21,6 +21,7 @@ typedef struct {
WI_ITEM_REC *active;
SERVER_REC *active_server;
+ int level; /* message level */
GSList *waiting_channels; /* list of "<server tag> <channel>" */
int lines;
@@ -31,9 +32,9 @@ typedef struct {
GList *cmdhist, *histpos;
int histlines;
- int level;
- int new_data;
- int last_color;
+ int data_level; /* current data level */
+ int hilight_color; /* current hilight color */
+
time_t last_timestamp; /* When was last timestamp printed */
time_t last_line; /* When was last line printed */
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index 95aa36ba..759becdf 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -212,6 +212,9 @@ void format_create_dest(TEXT_DEST_REC *dest,
dest->level = level;
dest->window = window != NULL ? window :
window_find_closest(server, target, level);
+
+ dest->hilight_priority = 0;
+ dest->hilight_color = 0;
}
static char *format_get_text_args(TEXT_DEST_REC *dest,
diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h
index 94bb100a..b03a27f6 100644
--- a/src/fe-common/core/formats.h
+++ b/src/fe-common/core/formats.h
@@ -36,6 +36,9 @@ typedef struct {
void *server;
const char *target;
int level;
+
+ int hilight_priority;
+ int hilight_color;
} TEXT_DEST_REC;
int format_find_tag(const char *module, const char *tag);
diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c
index 2c873307..6d9f1583 100644
--- a/src/fe-common/core/hilight-text.c
+++ b/src/fe-common/core/hilight-text.c
@@ -34,10 +34,10 @@
#include "formats.h"
#define DEFAULT_HILIGHT_LEVEL \
- (MSGLEVEL_PUBLIC | MSGLEVEL_MSGS | \
- MSGLEVEL_ACTIONS | MSGLEVEL_DCCMSGS)
+ (MSGLEVEL_PUBLIC | MSGLEVEL_MSGS | MSGLEVEL_DCCMSGS)
-static int hilight_next, last_nick_color;
+static HILIGHT_REC *next_hilight;
+static int hilight_stop_next;
GSList *hilights;
static void hilight_add_config(HILIGHT_REC *rec)
@@ -136,14 +136,6 @@ static HILIGHT_REC *hilight_find(const char *text, char **channels)
return NULL;
}
-static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
-{
- if (hilight_next) {
- hilight_next = FALSE;
- signal_stop();
- }
-}
-
/* color name -> mirc color number */
static int mirc_color_name(const char *name)
{
@@ -189,16 +181,16 @@ static int mirc_color_name(const char *name)
return -1;
}
-char *hilight_match(const char *channel, const char *nickmask, int level, const char *str)
+HILIGHT_REC *hilight_match(const char *channel, const char *nickmask,
+ int level, const char *str)
{
GSList *tmp;
- const char *color;
- char number[MAX_INT_STRLEN];
- int len, best_match, colornum;
+ HILIGHT_REC *match;
+ int len, best_match;
g_return_val_if_fail(str != NULL, NULL);
- color = NULL; best_match = 0;
+ match = NULL; best_match = 0;
for (tmp = hilights; tmp != NULL; tmp = tmp->next) {
HILIGHT_REC *rec = tmp->data;
@@ -225,14 +217,24 @@ char *hilight_match(const char *channel, const char *nickmask, int level, const
len = strlen(rec->text);
if (best_match < len) {
best_match = len;
- color = rec->color;
+ match = rec;
}
}
- if (best_match == 0)
- return NULL;
+ return match;
+}
+
+char *hilight_get_color(HILIGHT_REC *rec)
+{
+ const char *color = rec->color;
+ char number[MAX_INT_STRLEN];
+ int colornum;
+
+ g_return_val_if_fail(rec != NULL, NULL);
+
+ if (color == NULL)
+ color = settings_get_str("hilight_color");
- if (color == NULL) color = settings_get_str("hilight_color");
if (isalpha((int) *color)) {
/* color was specified with it's name - try to convert it */
colornum = mirc_color_name(color);
@@ -241,70 +243,85 @@ char *hilight_match(const char *channel, const char *nickmask, int level, const
ltoa(number, colornum);
color = number;
}
+
return g_strconcat(isdigit(*color) ? "\003" : "", color, NULL);
}
static void sig_print_text_stripped(TEXT_DEST_REC *dest, const char *str)
{
+ HILIGHT_REC *hilight;
char *newstr, *color;
- int oldlevel;
g_return_if_fail(str != NULL);
+ if (next_hilight != NULL) {
+ dest->hilight_priority = next_hilight->priority;
+ color = hilight_get_color(next_hilight);
+ dest->hilight_color = (color != NULL && *color == 3) ?
+ atoi(color+1) : 0;
+ g_free(color);
+ next_hilight = NULL;
+ return;
+ }
+
if (dest->level & (MSGLEVEL_NOHILIGHT|MSGLEVEL_HILIGHT))
return;
- color = hilight_match(dest->target, NULL, dest->level, str);
- if (color == NULL) return;
+ hilight = hilight_match(dest->target, NULL, dest->level, str);
+ if (hilight == NULL)
+ return;
+
+ /* update the level / hilight info */
+ dest->level |= MSGLEVEL_HILIGHT;
+ if (hilight->priority > 0)
+ dest->hilight_priority = hilight->priority;
+ color = hilight_get_color(hilight);
if (*color == 3) {
/* colorify */
- dest->window->last_color = atoi(color+1);
- }
-
- if (dest->window != active_win) {
- oldlevel = dest->window->new_data;
- dest->window->new_data = NEWDATA_HILIGHT;
- signal_emit("window hilight", 2, dest->window, GINT_TO_POINTER(oldlevel));
- signal_emit("window activity", 2, dest->window, GINT_TO_POINTER(oldlevel));
+ dest->hilight_color = atoi(color+1);
}
- hilight_next = FALSE;
+ hilight_stop_next = FALSE;
- /* update the level, but let the signal pass through.. */
- dest->level |= MSGLEVEL_HILIGHT;
+ /* send both signals again. "print text stripped" maybe wouldn't
+ have to be resent, but it would reverse the signal sending
+ order which some things may depend on, so maybe it's best we
+ don't do it. */
+ signal_emit("print text stripped", 2, dest, str);
newstr = g_strconcat(color, str, NULL);
signal_emit("print text", 2, dest, newstr);
g_free(newstr);
- hilight_next = TRUE;
+ hilight_stop_next = TRUE;
g_free_not_null(color);
+ signal_stop();
}
-char *hilight_find_nick(const char *channel, const char *nick,
- const char *address, int level, const char *msg)
+static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
{
+ if (hilight_stop_next) {
+ hilight_stop_next = FALSE;
+ signal_stop();
+ }
+}
+
+char *hilight_match_nick(const char *channel, const char *nick,
+ const char *address, int level, const char *msg)
+{
+ HILIGHT_REC *rec;
char *color, *mask;
mask = g_strdup_printf("%s!%s", nick, address);
- color = hilight_match(channel, mask, level, msg);
+ rec = hilight_match(channel, mask, level, msg);
g_free(mask);
- last_nick_color = (color != NULL && *color == 3) ?
- atoi(color+1) : 0;
- return color;
-}
+ color = rec == NULL ? NULL : hilight_get_color(rec);
-int hilight_last_nick_color(void)
-{
- return last_nick_color;
-}
-
-static void sig_message(void)
-{
- last_nick_color = 0;
+ next_hilight = rec;
+ return color;
}
static void read_hilight_config(void)
@@ -338,6 +355,7 @@ static void read_hilight_config(void)
rec->color = color == NULL || *color == '\0' ? NULL :
g_strdup(color);
rec->level = config_node_get_int(node, "level", 0);
+ rec->priority = config_node_get_int(node, "priority", 0);
rec->nick = config_node_get_bool(node, "nick", TRUE);
rec->nickmask = config_node_get_bool(node, "mask", FALSE);
rec->fullword = config_node_get_bool(node, "fullword", FALSE);
@@ -389,7 +407,7 @@ static void cmd_hilight(const char *data)
{
GHashTable *optlist;
HILIGHT_REC *rec;
- char *colorarg, *levelarg, *chanarg, *text;
+ char *colorarg, *levelarg, *priorityarg, *chanarg, *text;
char **channels;
void *free_arg;
@@ -406,6 +424,7 @@ static void cmd_hilight(const char *data)
chanarg = g_hash_table_lookup(optlist, "channels");
levelarg = g_hash_table_lookup(optlist, "level");
+ priorityarg = g_hash_table_lookup(optlist, "priority");
colorarg = g_hash_table_lookup(optlist, "color");
if (*text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -429,6 +448,7 @@ static void cmd_hilight(const char *data)
rec->level = (levelarg == NULL || *levelarg == '\0') ? 0 :
level2bits(replace_chars(levelarg, ',', ' '));
+ rec->priority = priorityarg == NULL ? 0 : atoi(priorityarg);
rec->nick = settings_get_bool("hilight_only_nick") &&
(rec->level == 0 || (rec->level & DEFAULT_HILIGHT_LEVEL) == rec->level) ?
g_hash_table_lookup(optlist, "nonick") == NULL :
@@ -473,33 +493,30 @@ static void cmd_dehilight(const char *data)
void hilight_text_init(void)
{
- hilight_next = FALSE;
- last_nick_color = 0;
+ next_hilight = NULL;
+ hilight_stop_next = FALSE;
read_hilight_config();
settings_add_str("misc", "hilight_color", "8");
settings_add_bool("misc", "hilight_only_nick", TRUE);
- signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);
signal_add_first("print text stripped", (SIGNAL_FUNC) sig_print_text_stripped);
+ signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);
signal_add("setup reread", (SIGNAL_FUNC) read_hilight_config);
- signal_add_last("message public", (SIGNAL_FUNC) sig_message);
- signal_add_last("message private", (SIGNAL_FUNC) sig_message);
+
command_bind("hilight", NULL, (SIGNAL_FUNC) cmd_hilight);
command_bind("dehilight", NULL, (SIGNAL_FUNC) cmd_dehilight);
-
- command_set_options("hilight", "-color -level -channels nick nonick mask word regexp");
+ command_set_options("hilight", "-color -level -priority -channels nick nonick mask word regexp");
}
void hilight_text_deinit(void)
{
hilights_destroy_all();
- signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
signal_remove("print text stripped", (SIGNAL_FUNC) sig_print_text_stripped);
+ signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
signal_remove("setup reread", (SIGNAL_FUNC) read_hilight_config);
- signal_remove("message public", (SIGNAL_FUNC) sig_message);
- signal_remove("message private", (SIGNAL_FUNC) sig_message);
+
command_unbind("hilight", (SIGNAL_FUNC) cmd_hilight);
command_unbind("dehilight", (SIGNAL_FUNC) cmd_dehilight);
}
diff --git a/src/fe-common/core/hilight-text.h b/src/fe-common/core/hilight-text.h
index 83ab8f8c..f7666535 100644
--- a/src/fe-common/core/hilight-text.h
+++ b/src/fe-common/core/hilight-text.h
@@ -8,6 +8,7 @@ typedef struct {
int level; /* match only messages with this level, 0=default */
char *color; /* if starts with number, \003 is automatically
inserted before it. */
+ int priority;
unsigned int nick:1; /* hilight only the nick, not a full line - works only with msgs. */
unsigned int nickmask:1; /* `text 'is a nick mask - colorify the nick */
@@ -17,12 +18,12 @@ typedef struct {
extern GSList *hilights;
-char *hilight_match(const char *channel, const char *nickmask,
- int level, const char *str);
+HILIGHT_REC *hilight_match(const char *channel, const char *nickmask,
+ int level, const char *str);
+char *hilight_get_color(HILIGHT_REC *rec);
-char *hilight_find_nick(const char *channel, const char *nick,
- const char *address, int level, const char *msg);
-int hilight_last_nick_color(void);
+char *hilight_match_nick(const char *channel, const char *nick,
+ const char *address, int level, const char *msg);
void hilight_text_init(void);
void hilight_text_deinit(void);
diff --git a/src/fe-common/core/window-activity.c b/src/fe-common/core/window-activity.c
index 14f7fa43..1312a83b 100644
--- a/src/fe-common/core/window-activity.c
+++ b/src/fe-common/core/window-activity.c
@@ -32,162 +32,100 @@
#include "hilight-text.h"
#include "formats.h"
-static const char *noact_channels;
+static char **noact_channels;
static int hilight_level, activity_level;
-static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
+static void window_activity(WINDOW_REC *window,
+ int data_level, int hilight_color)
{
- int oldlevel, new_data;
-
- if (dest->window == active_win ||
- (dest->level & (MSGLEVEL_NEVER|MSGLEVEL_NO_ACT)))
- return;
-
- /* hilights and private messages get HILIGHT status,
- public messages get MSGS status and rest get TEXT */
- new_data = (dest->level & (MSGLEVEL_HILIGHT|hilight_level)) ?
- NEWDATA_HILIGHT :
- ((dest->level & activity_level) ? NEWDATA_MSG : NEWDATA_TEXT);
+ int old_data_level;
- /* check that channel isn't in "don't show activity" list */
- if (new_data < NEWDATA_HILIGHT &&
- dest->target != NULL && find_substr(noact_channels, dest->target))
- return;
-
- oldlevel = dest->window->new_data;
- if (dest->window->new_data < new_data) {
- dest->window->new_data = new_data;
- dest->window->last_color = hilight_last_nick_color();;
- signal_emit("window hilight", 1, dest->window);
+ old_data_level = window->data_level;
+ if (data_level == 0 || window->data_level < data_level) {
+ window->data_level = data_level;
+ window->hilight_color = hilight_color;
+ signal_emit("window hilight", 1, window);
}
- signal_emit("window activity", 2, dest->window, GINT_TO_POINTER(oldlevel));
+ signal_emit("window activity", 2, window,
+ GINT_TO_POINTER(old_data_level));
}
-static void sig_dehilight(WINDOW_REC *window, WI_ITEM_REC *item)
+static void window_item_activity(WI_ITEM_REC *item,
+ int data_level, int hilight_color)
{
- g_return_if_fail(window != NULL);
+ int old_data_level;
- if (item != NULL && item->new_data != 0) {
- item->new_data = 0;
- item->last_color = 0;
+ old_data_level = item->data_level;
+ if (data_level == 0 || item->data_level < data_level) {
+ item->data_level = data_level;
+ item->hilight_color = hilight_color;
signal_emit("window item hilight", 1, item);
}
+
+ signal_emit("window item activity", 2, item,
+ GINT_TO_POINTER(old_data_level));
}
-static void sig_dehilight_window(WINDOW_REC *window)
-{
- GSList *tmp;
- int oldlevel;
+#define hide_target_activity(data_level, target) \
+ ((data_level) < DATA_LEVEL_HILIGHT && (target) != NULL && \
+ (noact_channels) != NULL && \
+ strarray_find((noact_channels), target) != -1)
- g_return_if_fail(window != NULL);
+static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
+{
+ WI_ITEM_REC *item;
+ int data_level;
- if (window->new_data == 0)
+ if (dest->window == active_win ||
+ (dest->level & (MSGLEVEL_NEVER|MSGLEVEL_NO_ACT)))
return;
- if (window->new_data != 0) {
- oldlevel = window->new_data;
- window->new_data = 0;
- window->last_color = 0;
- signal_emit("window hilight", 2, window, GINT_TO_POINTER(oldlevel));
- }
- signal_emit("window activity", 2, window, GINT_TO_POINTER(oldlevel));
-
- for (tmp = window->items; tmp != NULL; tmp = tmp->next)
- sig_dehilight(window, tmp->data);
-}
+ data_level = (dest->level & hilight_level) ?
+ DATA_LEVEL_HILIGHT+dest->hilight_priority :
+ ((dest->level & activity_level) ?
+ DATA_LEVEL_MSG : DATA_LEVEL_TEXT);
-static void sig_hilight_window_item(WI_ITEM_REC *item)
-{
- WINDOW_REC *window;
- GSList *tmp;
- int level, oldlevel, color;
-
- if (item->new_data < NEWDATA_HILIGHT &&
- find_substr(noact_channels, item->name))
+ if (hide_target_activity(data_level, dest->target))
return;
- window = window_item_window(item); level = 0; color = 0;
- for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
- item = tmp->data;
-
- if (item->new_data > level) {
- level = item->new_data;
- color = item->last_color;
+ if (dest->target != NULL) {
+ item = window_item_find(dest->server, dest->target);
+ if (item != NULL) {
+ window_item_activity(item, data_level,
+ dest->hilight_color);
}
}
-
- oldlevel = window->new_data;
- if (level == NEWDATA_HILIGHT)
- window->last_color = color;
- if (window->new_data < level || level == 0) {
- window->new_data = level;
- signal_emit("window hilight", 2, window, GINT_TO_POINTER(oldlevel));
- }
- signal_emit("window activity", 2, window, GINT_TO_POINTER(oldlevel));
+ window_activity(dest->window, data_level, dest->hilight_color);
}
-static void sig_message(SERVER_REC *server, const char *msg,
- const char *nick, const char *addr,
- const char *target, int level)
+static void sig_dehilight_window(WINDOW_REC *window)
{
- WINDOW_REC *window;
- WI_ITEM_REC *item;
-
- /* get window and window item */
- item = window_item_find(server, target);
- window = item == NULL ?
- window_find_closest(server, target, level) :
- window_item_window(item);
+ GSList *tmp;
- if (window == active_win)
- return;
+ g_return_if_fail(window != NULL);
- /* hilight */
- if (item != NULL) item->last_color = hilight_last_nick_color();
- level = (item != NULL && item->last_color > 0) ||
- (level & hilight_level) ?
- NEWDATA_HILIGHT : NEWDATA_MSG;
- if (item != NULL && item->new_data < level) {
- item->new_data = level;
- signal_emit("window item hilight", 1, item);
- } else {
- int oldlevel = window->new_data;
-
- if (window->new_data < level) {
- window->new_data = level;
- window->last_color = hilight_last_nick_color();
- signal_emit("window hilight", 2, window,
- GINT_TO_POINTER(oldlevel));
- }
- signal_emit("window activity", 2, window,
- GINT_TO_POINTER(oldlevel));
+ if (window->data_level != 0) {
+ window_activity(window, 0, 0);
+ for (tmp = window->items; tmp != NULL; tmp = tmp->next)
+ window_item_activity(tmp->data, 0, 0);
}
}
-static void sig_message_public(SERVER_REC *server, const char *msg,
- const char *nick, const char *addr,
- const char *target)
+static void read_settings(void)
{
- int level = MSGLEVEL_PUBLIC;
+ const char *channels;
- if (nick_match_msg(channel_find(server, target), msg, server->nick))
- level |= MSGLEVEL_HILIGHT;
-
- sig_message(server, msg, nick, addr, target, level);
-}
+ if (noact_channels != NULL)
+ g_strfreev(noact_channels);
-static void sig_message_private(SERVER_REC *server, const char *msg,
- const char *nick, const char *addr)
-{
- sig_message(server, msg, nick, addr, nick, MSGLEVEL_MSGS);
-}
+ channels = settings_get_str("noact_channels");
+ noact_channels = *channels == '\0' ? NULL :
+ g_strsplit(channels, " ", -1);
-static void read_settings(void)
-{
- noact_channels = settings_get_str("noact_channels");
activity_level = level2bits(settings_get_str("activity_levels"));
- hilight_level = level2bits(settings_get_str("hilight_levels"));
+ hilight_level = MSGLEVEL_HILIGHT |
+ level2bits(settings_get_str("hilight_levels"));
}
void window_activity_init(void)
@@ -198,23 +136,18 @@ void window_activity_init(void)
read_settings();
signal_add("print text", (SIGNAL_FUNC) sig_hilight_text);
- signal_add("window item changed", (SIGNAL_FUNC) sig_dehilight);
signal_add("window changed", (SIGNAL_FUNC) sig_dehilight_window);
signal_add("window dehilight", (SIGNAL_FUNC) sig_dehilight_window);
- signal_add("window item hilight", (SIGNAL_FUNC) sig_hilight_window_item);
- signal_add("message public", (SIGNAL_FUNC) sig_message_public);
- signal_add("message private", (SIGNAL_FUNC) sig_message_private);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
}
void window_activity_deinit(void)
{
+ if (noact_channels != NULL)
+ g_strfreev(noact_channels);
+
signal_remove("print text", (SIGNAL_FUNC) sig_hilight_text);
- signal_remove("window item changed", (SIGNAL_FUNC) sig_dehilight);
signal_remove("window changed", (SIGNAL_FUNC) sig_dehilight_window);
signal_remove("window dehilight", (SIGNAL_FUNC) sig_dehilight_window);
- signal_remove("window item hilight", (SIGNAL_FUNC) sig_hilight_window_item);
- signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
- signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index f38a379e..a9d21710 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -103,8 +103,8 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
rec = tmp->data;
- if (rec->new_data && max_act < rec->new_data) {
- max_act = rec->new_data;
+ if (rec->data_level > 0 && max_act < rec->data_level) {
+ max_act = rec->data_level;
max_win = rec;
}
}
diff --git a/src/fe-text/mainwindow-activity.c b/src/fe-text/mainwindow-activity.c
index e0a7d6ae..cfee615a 100644
--- a/src/fe-text/mainwindow-activity.c
+++ b/src/fe-text/mainwindow-activity.c
@@ -26,9 +26,9 @@
static void sig_activity(WINDOW_REC *window)
{
- GSList *tmp;
+ /*GSList *tmp;
- if (!is_window_visible(window) || window->new_data == 0)
+ if (!is_window_visible(window) || window->data_level == 0)
return;
window->new_data = 0;
@@ -39,7 +39,7 @@ static void sig_activity(WINDOW_REC *window)
item->new_data = 0;
item->last_color = 0;
}
- signal_stop();
+ signal_stop();*/
}
void mainwindow_activity_init(void)
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 2e555581..7b3294be 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -328,7 +328,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
{
window = tmp->data;
- is_det = window->new_data >= NEWDATA_HILIGHT;
+ is_det = window->data_level >= DATA_LEVEL_HILIGHT;
if (is_det && !det) continue;
if (!is_det && !act) continue;
@@ -341,17 +341,19 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
}
ltoa(str, window->refnum);
- switch (window->new_data)
+ switch (window->data_level)
{
- case NEWDATA_TEXT:
+ case DATA_LEVEL_NONE:
+ break;
+ case DATA_LEVEL_TEXT:
set_color(stdscr, sbar_color_dim);
break;
- case NEWDATA_MSG:
+ case DATA_LEVEL_MSG:
set_color(stdscr, sbar_color_bold);
break;
- case NEWDATA_HILIGHT:
- if (window->last_color > 0)
- set_color(stdscr, sbar_color_background | mirc_colors[window->last_color]);
+ default:
+ if (window->hilight_color > 0)
+ set_color(stdscr, sbar_color_background | mirc_colors[window->hilight_color%16]);
else
set_color(stdscr, sbar_color_act_highlight);
break;
@@ -376,7 +378,7 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
size_needed += 1+ltoa(str, window->refnum);
- if (!use_colors && window->new_data >= NEWDATA_HILIGHT)
+ if (!use_colors && window->data_level >= DATA_LEVEL_HILIGHT)
det = TRUE;
else
act = TRUE;
@@ -418,7 +420,7 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
/* Move the window to the first in the activity list */
if (g_list_find(activity_list, window) != NULL)
activity_list = g_list_remove(activity_list, window);
- if (window->new_data != 0)
+ if (window->data_level != 0)
activity_list = g_list_prepend(activity_list, window);
statusbar_item_redraw(activity_item);
return;
@@ -427,14 +429,14 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
if (g_list_find(activity_list, window) != NULL)
{
/* already in activity list */
- if (window->new_data == 0)
+ if (window->data_level == 0)
{
/* remove from activity list */
activity_list = g_list_remove(activity_list, window);
statusbar_item_redraw(activity_item);
}
- else if (window->new_data != GPOINTER_TO_INT(oldlevel) ||
- window->last_color != 0)
+ else if (window->data_level != GPOINTER_TO_INT(oldlevel) ||
+ window->hilight_color != 0)
{
/* different level as last time (or maybe different
hilight color?), just redraw it. */
@@ -443,7 +445,7 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
return;
}
- if (window->new_data == 0)
+ if (window->data_level == 0)
return;
/* add window to activity list .. */
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index 500d6145..145b72c3 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -240,8 +240,8 @@ void perl_window_item_fill_hash(HV *hv, WI_ITEM_REC *item)
hv_store(hv, "name", 4, new_pv(item->name), 0);
hv_store(hv, "createtime", 10, newSViv(item->createtime), 0);
- hv_store(hv, "new_data", 8, newSViv(item->new_data), 0);
- hv_store(hv, "last_color", 10, newSViv(item->last_color), 0);
+ hv_store(hv, "data_level", 8, newSViv(item->data_level), 0);
+ hv_store(hv, "hilight_color", 10, newSViv(item->hilight_color), 0);
}
void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel)
@@ -403,8 +403,8 @@ void perl_window_fill_hash(HV *hv, WINDOW_REC *window)
hv_store(hv, "lines", 5, newSViv(window->lines), 0);
hv_store(hv, "level", 5, newSViv(window->level), 0);
- hv_store(hv, "new_data", 8, newSViv(window->new_data), 0);
- hv_store(hv, "last_color", 10, newSViv(window->last_color), 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, "last_timestamp", 14, newSViv(window->last_timestamp), 0);
hv_store(hv, "last_line", 9, newSViv(window->last_line), 0);
}