summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-10-14 12:03:37 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-10-14 12:03:37 +0000
commitfae3ae2bfcab714da40bcf1315fb990e14ec3645 (patch)
treede935f91d1564ab84e2ea3e63352fa743266fcf1
parent45883d7f3690bad5c8ac22692022bbfdd79262ed (diff)
downloadirssi-fae3ae2bfcab714da40bcf1315fb990e14ec3645.zip
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
-rw-r--r--src/fe-common/core/fe-ignore.c10
-rw-r--r--src/fe-common/core/hilight-text.c31
-rw-r--r--src/fe-common/core/module-formats.c2
3 files changed, 34 insertions, 9 deletions
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c
index 44a378a7..3c757b49 100644
--- a/src/fe-common/core/fe-ignore.c
+++ b/src/fe-common/core/fe-ignore.c
@@ -53,16 +53,16 @@ static void ignore_print(int index, IGNORE_REC *rec)
levels = bits2level(rec->level);
options = g_string_new(NULL);
- if (rec->exception) g_string_sprintfa(options, "-except ");
+ if (rec->exception) g_string_append(options, "-except ");
if (rec->regexp) {
- g_string_sprintfa(options, "-regexp ");
+ g_string_append(options, "-regexp ");
#ifdef HAVE_REGEX_H
if (!rec->regexp_compiled)
- g_string_sprintfa(options, "[INVALID!] ");
+ g_string_append(options, "[INVALID!] ");
#endif
}
- if (rec->fullword) g_string_sprintfa(options, "-full ");
- if (rec->replies) g_string_sprintfa(options, "-replies ");
+ if (rec->fullword) g_string_append(options, "-full ");
+ if (rec->replies) g_string_append(options, "-replies ");
if (rec->pattern != NULL)
g_string_sprintfa(options, "-pattern %s ", rec->pattern);
diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c
index 1648e26d..9749504b 100644
--- a/src/fe-common/core/hilight-text.c
+++ b/src/fe-common/core/hilight-text.c
@@ -473,6 +473,32 @@ static void read_hilight_config(void)
static void hilight_print(int index, HILIGHT_REC *rec)
{
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 :
g_strjoinv(",", rec->channels);
@@ -482,11 +508,10 @@ static void hilight_print(int index, HILIGHT_REC *rec)
TXT_HILIGHT_LINE, index, rec->text,
chans != NULL ? chans : "",
levelstr != NULL ? levelstr : "",
- rec->nickmask ? " -mask" : "",
- rec->fullword ? " -full" : "",
- rec->regexp ? " -regexp" : "");
+ options->str);
g_free_not_null(chans);
g_free_not_null(levelstr);
+ g_string_free(options, TRUE);
}
static void cmd_hilight_show(void)
diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c
index f0cf789d..a7fb20d0 100644
--- a/src/fe-common/core/module-formats.c
+++ b/src/fe-common/core/module-formats.c
@@ -153,7 +153,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ NULL, "Highlighting", 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_not_found", "Highlight not found: $0", 1, { 0 } },
{ "hilight_removed", "Highlight removed: $0", 1, { 0 } },