1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Better print /HILIGHT lines. Also cleanup for /IGNORE lines.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2947 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-10-14 12:03:37 +00:00 committed by cras
parent 45883d7f36
commit fae3ae2bfc
3 changed files with 34 additions and 9 deletions

View File

@ -53,16 +53,16 @@ static void ignore_print(int index, IGNORE_REC *rec)
levels = bits2level(rec->level); levels = bits2level(rec->level);
options = g_string_new(NULL); options = g_string_new(NULL);
if (rec->exception) g_string_sprintfa(options, "-except "); if (rec->exception) g_string_append(options, "-except ");
if (rec->regexp) { if (rec->regexp) {
g_string_sprintfa(options, "-regexp "); g_string_append(options, "-regexp ");
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (!rec->regexp_compiled) if (!rec->regexp_compiled)
g_string_sprintfa(options, "[INVALID!] "); g_string_append(options, "[INVALID!] ");
#endif #endif
} }
if (rec->fullword) g_string_sprintfa(options, "-full "); if (rec->fullword) g_string_append(options, "-full ");
if (rec->replies) g_string_sprintfa(options, "-replies "); if (rec->replies) g_string_append(options, "-replies ");
if (rec->pattern != NULL) if (rec->pattern != NULL)
g_string_sprintfa(options, "-pattern %s ", rec->pattern); g_string_sprintfa(options, "-pattern %s ", rec->pattern);

View File

@ -473,6 +473,32 @@ static void read_hilight_config(void)
static void hilight_print(int index, HILIGHT_REC *rec) static void hilight_print(int index, HILIGHT_REC *rec)
{ {
char *chans, *levelstr; char *chans, *levelstr;
GString *options;
options = g_string_new(NULL);
if (!rec->nick || !rec->word) {
if (rec->nick) g_string_append(options, "-nick ");
if (rec->word) g_string_append(options, "-word ");
}
if (rec->nickmask) g_string_append(options, "-nickmask ");
if (rec->fullword) g_string_append(options, "-fullword ");
if (rec->regexp) {
g_string_append(options, "-regexp ");
#ifdef HAVE_REGEX_H
if (!rec->regexp_compiled)
g_string_append(options, "[INVALID!] ");
#endif
}
if (options->len > 1) g_string_truncate(options, options->len-1);
if (rec->priority != 0)
g_string_sprintfa(options, "-priority %d ", rec->priority);
if (rec->color != NULL)
g_string_sprintfa(options, "-color %s ", rec->color);
if (rec->act_color != NULL)
g_string_sprintfa(options, "-actcolor %s ", rec->act_color);
chans = rec->channels == NULL ? NULL : chans = rec->channels == NULL ? NULL :
g_strjoinv(",", rec->channels); g_strjoinv(",", rec->channels);
@ -482,11 +508,10 @@ static void hilight_print(int index, HILIGHT_REC *rec)
TXT_HILIGHT_LINE, index, rec->text, TXT_HILIGHT_LINE, index, rec->text,
chans != NULL ? chans : "", chans != NULL ? chans : "",
levelstr != NULL ? levelstr : "", levelstr != NULL ? levelstr : "",
rec->nickmask ? " -mask" : "", options->str);
rec->fullword ? " -full" : "",
rec->regexp ? " -regexp" : "");
g_free_not_null(chans); g_free_not_null(chans);
g_free_not_null(levelstr); g_free_not_null(levelstr);
g_string_free(options, TRUE);
} }
static void cmd_hilight_show(void) static void cmd_hilight_show(void)

View File

@ -153,7 +153,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ NULL, "Highlighting", 0 }, { NULL, "Highlighting", 0 },
{ "hilight_header", "%#Highlights:", 0 }, { "hilight_header", "%#Highlights:", 0 },
{ "hilight_line", "%#$[-4]0 $1 $2 $3$4$5", 7, { 1, 0, 0, 0, 0, 0, 0 } }, { "hilight_line", "%#$[-4]0 $1 $2 $3$4", 5, { 1, 0, 0, 0, 0 } },
{ "hilight_footer", "", 0 }, { "hilight_footer", "", 0 },
{ "hilight_not_found", "Highlight not found: $0", 1, { 0 } }, { "hilight_not_found", "Highlight not found: $0", 1, { 0 } },
{ "hilight_removed", "Highlight removed: $0", 1, { 0 } }, { "hilight_removed", "Highlight removed: $0", 1, { 0 } },