diff -r -U4 irssi-0.8.10/src/fe-common/core/hilight-text.c irssi-0.8.10+byte/src/fe-common/core/hilight-text.c --- irssi-0.8.10/src/fe-common/core/hilight-text.c 2005-10-19 03:13:20.000000000 +0100 +++ irssi-0.8.10+byte/src/fe-common/core/hilight-text.c 2006-02-15 15:55:27.000000000 +0000 @@ -38,8 +38,9 @@ static NICKMATCH_REC *nickmatch; static int never_hilight_level, default_hilight_level; GSList *hilights; +static char **ignore_sources; static void reset_cache(void) { GSList *tmp; @@ -226,8 +227,26 @@ #define hilight_match_channel(rec, channel) \ ((rec)->channels == NULL || ((channel) != NULL && \ strarray_find((rec)->channels, (channel)) != -1)) +static int ignore_hilight(const char *server_tag, const char *nick, const char *address) { + if (ignore_sources != NULL) { + char *data; + char **tmp; + + data = g_strdup_printf("%s/%s!%s", server_tag, nick, address); + + for (tmp = ignore_sources; *tmp != NULL; tmp++) + if (match_wildcards(*tmp, data)) { + g_free(data); + return -1; + } + + g_free(data); + } + return 0; +} + HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel, const char *nick, const char *address, int level, const char *str, int *match_beg, int *match_end) @@ -252,20 +271,25 @@ if (nickrec->host == NULL) nicklist_set_host(chanrec, nickrec, address); rec = nickmatch_find(nickmatch, nickrec); - if (rec != NULL && hilight_match_level(rec, level)) + if (rec != NULL && hilight_match_level(rec, level)) { + if (ignore_hilight(server->tag, nick, address)) return NULL; return rec; + } } } for (tmp = hilights; tmp != NULL; tmp = tmp->next) { HILIGHT_REC *rec = tmp->data; if (!rec->nickmask && hilight_match_level(rec, level) && hilight_match_channel(rec, channel) && - hilight_match_text(rec, str, match_beg, match_end)) + hilight_match_text(rec, str, match_beg, match_end)) { + + if (ignore_hilight(server->tag, nick, address)) return NULL; return rec; + } } return NULL; } @@ -673,16 +697,25 @@ } static void read_settings(void) { + const char *sources; + default_hilight_level = settings_get_level("hilight_level"); + + if (ignore_sources != NULL) + g_strfreev(ignore_sources); + + sources = settings_get_str("hilight_ignore_sources"); + ignore_sources = *sources == '\0' ? NULL : g_strsplit(sources, " ", -1); } void hilight_text_init(void) { settings_add_str("lookandfeel", "hilight_color", "%Y"); settings_add_str("lookandfeel", "hilight_act_color", "%M"); settings_add_level("lookandfeel", "hilight_level", "PUBLIC DCCMSGS"); + settings_add_str("lookandfeel", "hilight_ignore_sources", ""); read_settings(); nickmatch = nickmatch_init(hilight_nick_cache); @@ -705,7 +738,10 @@ signal_remove("print text", (SIGNAL_FUNC) sig_print_text); signal_remove("setup reread", (SIGNAL_FUNC) read_hilight_config); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); + if (ignore_sources != NULL) + g_strfreev(ignore_sources); + command_unbind("hilight", (SIGNAL_FUNC) cmd_hilight); command_unbind("dehilight", (SIGNAL_FUNC) cmd_dehilight); }