Created
July 14, 2010 23:49
-
-
Save pyropeter/476285 to your computer and use it in GitHub Desktop.
Irssi bug FS#754
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/fe-common/core/hilight-text.c | |
=================================================================== | |
--- src/fe-common/core/hilight-text.c (revision 5186) | |
+++ src/fe-common/core/hilight-text.c (working copy) | |
@@ -78,6 +78,7 @@ | |
if (rec->nickmask) iconfig_node_set_bool(node, "mask", TRUE); | |
if (rec->fullword) iconfig_node_set_bool(node, "fullword", TRUE); | |
if (rec->regexp) iconfig_node_set_bool(node, "regexp", TRUE); | |
+ if (rec->except) iconfig_node_set_bool(node, "except", TRUE); | |
if (rec->channels != NULL && *rec->channels != NULL) { | |
node = config_node_section(node, "channels", NODE_TYPE_LIST); | |
@@ -459,6 +460,7 @@ | |
rec->nickmask = config_node_get_bool(node, "mask", FALSE); | |
rec->fullword = config_node_get_bool(node, "fullword", FALSE); | |
rec->regexp = config_node_get_bool(node, "regexp", FALSE); | |
+ rec->except = config_node_get_bool(node, "except", FALSE); | |
hilight_init_rec(rec); | |
@@ -489,6 +491,7 @@ | |
g_string_append(options, "[INVALID!] "); | |
#endif | |
} | |
+ if (rec->except) g_string_append(options, "-except "); | |
if (rec->priority != 0) | |
g_string_append_printf(options, "-priority %d ", rec->priority); | |
@@ -530,7 +533,8 @@ | |
/* SYNTAX: HILIGHT [-nick | -word | -line] [-mask | -full | -regexp] | |
[-color <color>] [-actcolor <color>] [-level <level>] | |
- [-channels <channels>] <text> */ | |
+ [-channels <channels>] [-priority <priority>] | |
+ [-except] <text> */ | |
static void cmd_hilight(const char *data) | |
{ | |
GHashTable *optlist; | |
@@ -595,6 +599,7 @@ | |
rec->nickmask = g_hash_table_lookup(optlist, "mask") != NULL; | |
rec->fullword = g_hash_table_lookup(optlist, "full") != NULL; | |
rec->regexp = g_hash_table_lookup(optlist, "regexp") != NULL; | |
+ rec->except = g_hash_table_lookup(optlist, "except") != NULL; | |
if (colorarg != NULL) { | |
g_free_and_null(rec->color); | |
@@ -696,7 +701,7 @@ | |
command_bind("hilight", NULL, (SIGNAL_FUNC) cmd_hilight); | |
command_bind("dehilight", NULL, (SIGNAL_FUNC) cmd_dehilight); | |
- command_set_options("hilight", "-color -actcolor -level -priority -channels nick word line mask full regexp"); | |
+ command_set_options("hilight", "-color -actcolor -level -priority -channels nick word line mask full regexp except"); | |
} | |
void hilight_text_deinit(void) | |
Index: src/fe-common/core/hilight-text.h | |
=================================================================== | |
--- src/fe-common/core/hilight-text.h (revision 5186) | |
+++ src/fe-common/core/hilight-text.h (working copy) | |
@@ -29,6 +29,7 @@ | |
unsigned int regexp_compiled:1; /* should always be TRUE, unless regexp is invalid */ | |
regex_t preg; | |
#endif | |
+ unsigned int except:1; /* do not hilight */ | |
}; | |
extern GSList *hilights; | |
Index: docs/help/in/hilight.in | |
=================================================================== | |
--- docs/help/in/hilight.in (revision 5186) | |
+++ docs/help/in/hilight.in (working copy) | |
@@ -3,6 +3,7 @@ | |
-mask: Match only for nick, <text> is a nick mask | |
-regexp: <text> is a regular expression | |
+ -except: Do not hilight (to be used with -priority) | |
-full: <text> must match to full words | |
-nick: Hilight only the nick, not the whole line (default) | |
-word: Hilight only the word (default with non-public messages) | |
@@ -15,6 +16,10 @@ | |
-channels: Match only in <channels> | |
-priority: Priority to use when multiple hilights match. Default is 0. | |
+TODO: -priority is not yet implemented. Hilights generally match in the order of | |
+definition, but the ones with -mask set are tested first. | |
+If multiple -mask entrys match, the most specific one is selected. | |
+ | |
Examples: | |
Hilight lines that have "mynick" word: | |
@@ -26,6 +31,10 @@ | |
Hilight lines that were written by nicks from *.fi with bold green | |
/HILIGHT -color %%G -mask *!*@*.fi | |
+Hilight lines that have "mynick" word, except the ones from "root": | |
+ /HILIGHT mynick | |
+ /HILIGHT -except -mask root!*@* | |
+ | |
For regular expressions, see `man 7 regex`. | |
See also: DEHILIGHT, SET HILIGHT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment