summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--doc/de/autogen/user/weechat_options.txt2
-rw-r--r--doc/en/autogen/user/weechat_options.txt2
-rw-r--r--doc/fr/autogen/user/weechat_options.txt2
-rw-r--r--doc/it/autogen/user/weechat_options.txt2
-rw-r--r--po/cs.po5
-rw-r--r--po/de.po6
-rw-r--r--po/es.po5
-rw-r--r--po/fr.po18
-rw-r--r--po/hu.po5
-rw-r--r--po/it.po6
-rw-r--r--po/pl.po5
-rw-r--r--po/pt_BR.po5
-rw-r--r--po/ru.po5
-rw-r--r--po/weechat.pot5
-rw-r--r--src/core/wee-config.c6
-rw-r--r--src/core/wee-util.c21
-rw-r--r--src/core/wee-util.h1
-rw-r--r--src/gui/curses/gui-curses-main.c2
-rw-r--r--src/gui/gui-chat.c41
-rw-r--r--src/gui/gui-chat.h1
-rw-r--r--src/gui/gui-color.c76
-rw-r--r--src/gui/gui-color.h1
23 files changed, 173 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 71d6bd98a..711f2c990 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.4-dev, 2010-12-06
+v0.3.4-dev, 2010-12-07
Version 0.3.4 (under dev!)
--------------------------
+* core: add color support in option weechat.look.buffer_time_format
* core: call to hook_config when config option is created
* core: add new option weechat.look.highlight_regex and function
string_has_highlight_regex in plugin API (task #10321)
diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt
index 7a85e296c..d5488d4d8 100644
--- a/doc/de/autogen/user/weechat_options.txt
+++ b/doc/de/autogen/user/weechat_options.txt
@@ -349,7 +349,7 @@
** Werte: none, highlight, message, all (Standardwert: `all`)
* *weechat.look.buffer_time_format*
-** Beschreibung: `Format für die Zeit die in jeder Zeile in einem Buffer dargestellt werden soll (siehe man strftime für Datum/Zeit Platzhalter)`
+** Beschreibung: `time format for each line displayed in buffers (see man strftime for date/time specifiers), colors are allowed with format "${color}", for example french time: "${lightblue}%H${white}%M${lightred}%S"`
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `"%H:%M:%S"`)
diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt
index 8779f96da..7814c45da 100644
--- a/doc/en/autogen/user/weechat_options.txt
+++ b/doc/en/autogen/user/weechat_options.txt
@@ -349,7 +349,7 @@
** values: none, highlight, message, all (default value: `all`)
* *weechat.look.buffer_time_format*
-** description: `time format for each line displayed in buffers (see man strftime for date/time specifiers)`
+** description: `time format for each line displayed in buffers (see man strftime for date/time specifiers), colors are allowed with format "${color}", for example french time: "${lightblue}%H${white}%M${lightred}%S"`
** type: string
** values: any string (default value: `"%H:%M:%S"`)
diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt
index a8e4053a2..a3529eaaf 100644
--- a/doc/fr/autogen/user/weechat_options.txt
+++ b/doc/fr/autogen/user/weechat_options.txt
@@ -349,7 +349,7 @@
** valeurs: none, highlight, message, all (valeur par défaut: `all`)
* *weechat.look.buffer_time_format*
-** description: `format de date/heure pour chaque ligne affichée dans les tampons (voir man strftime pour le format de date/heure)`
+** description: `format de date/heure pour chaque ligne affichée dans les tampons (voir man strftime pour le format de date/heure), les couleurs sont autorisées avec le format "${couleur}", par exemple l'heure française: "${lightblue}%H${white}%M${lightred}%S"`
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `"%H:%M:%S"`)
diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt
index 71ba6a4b9..fd2d92afd 100644
--- a/doc/it/autogen/user/weechat_options.txt
+++ b/doc/it/autogen/user/weechat_options.txt
@@ -349,7 +349,7 @@
** valori: none, highlight, message, all (valore predefinito: `all`)
* *weechat.look.buffer_time_format*
-** descrizione: `formato dell'ora per ogni riga visualizzata nei buffer (consultare man strftime per gli specificatori data/ora)`
+** descrizione: `time format for each line displayed in buffers (see man strftime for date/time specifiers), colors are allowed with format "${color}", for example french time: "${lightblue}%H${white}%M${lightred}%S"`
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `"%H:%M:%S"`)
diff --git a/po/cs.po b/po/cs.po
index 16d302eb5..3d4d7ab0d 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-06 11:55+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1795,7 +1795,8 @@ msgstr ""
#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"časová známka použita v logovacích souborech (použijte manuálovou stránku "
"strftime pro spcifikátory data/času)"
diff --git a/po/de.po b/po/de.po
index 8fb89857e..869d5b07b 100644
--- a/po/de.po
+++ b/po/de.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-12-02 18:18+0100\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1861,9 +1861,11 @@ msgstr ""
"Nachrichten (Standard), message=Nachrichten+Highlights, highlights=nur "
"Highlights, none=Hotlist wird niemals angezeigt."
+#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"Format für die Zeit die in jeder Zeile in einem Buffer dargestellt werden "
"soll (siehe man strftime für Datum/Zeit Platzhalter)"
diff --git a/po/es.po b/po/es.po
index 5d1568110..76967c79f 100644
--- a/po/es.po
+++ b/po/es.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1810,7 +1810,8 @@ msgstr ""
#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"formato de hora en el registro (ver el manual de strftime para los "
"especificadores de fecha/hora)"
diff --git a/po/fr.po b/po/fr.po
index 33d2ae313..85c7d5aee 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
-"PO-Revision-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
+"PO-Revision-Date: 2010-12-07 08:39+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -1828,10 +1828,13 @@ msgstr ""
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"format de date/heure pour chaque ligne affichée dans les tampons (voir man "
-"strftime pour le format de date/heure)"
+"strftime pour le format de date/heure), les couleurs sont autorisées avec le "
+"format \"${couleur}\", par exemple l'heure française: \"${lightblue}%H"
+"${white}%M${lightred}%S\""
msgid "number of colors to use for nicks colors"
msgstr "nombre de couleurs à utiliser pour les couleurs des pseudos"
@@ -7331,6 +7334,13 @@ msgstr "Hashtable (sortie)"
msgid "Pointer"
msgstr "Pointeur"
+#~ msgid ""
+#~ "time format for each line displayed in buffers (see man strftime for date/"
+#~ "time specifiers)"
+#~ msgstr ""
+#~ "format de date/heure pour chaque ligne affichée dans les tampons (voir "
+#~ "man strftime pour le format de date/heure)"
+
#~ msgid "[-server server] receiver[,receiver] text"
#~ msgstr "[-server serveur] cible[,cible] texte"
diff --git a/po/hu.po b/po/hu.po
index 12b60c238..b8e99a066 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1615,7 +1615,8 @@ msgstr ""
#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr "új nap kezdetével megjelenő időbélyeg"
msgid "number of colors to use for nicks colors"
diff --git a/po/it.po b/po/it.po
index 4c3085ae7..25ec97780 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-12-04 11:57+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1816,9 +1816,11 @@ msgstr ""
"message=messaggi+eventi, highlight=solo eventi, none=non viene mai "
"visualizzato nella hotlist"
+#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"formato dell'ora per ogni riga visualizzata nei buffer (consultare man "
"strftime per gli specificatori data/ora)"
diff --git a/po/pl.po b/po/pl.po
index f202ade4a..905735332 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1819,7 +1819,8 @@ msgstr ""
#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
"format czasu użyty w plikach z logami (zobacz man strftime dla "
"specyfikatorów daty/czasu)"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 0427c6993..0a64a281e 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-13 09:26+0100\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1443,7 +1443,8 @@ msgstr ""
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
msgid "number of colors to use for nicks colors"
diff --git a/po/ru.po b/po/ru.po
index 21509f5a3..8e21f6a1a 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1624,7 +1624,8 @@ msgstr ""
#, fuzzy
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr "отображение маркера даты при смене дня"
msgid "number of colors to use for nicks colors"
diff --git a/po/weechat.pot b/po/weechat.pot
index 23005b18d..4fa85a851 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-12-05 12:08+0100\n"
+"POT-Creation-Date: 2010-12-07 19:35+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1383,7 +1383,8 @@ msgstr ""
msgid ""
"time format for each line displayed in buffers (see man strftime for date/"
-"time specifiers)"
+"time specifiers), colors are allowed with format \"${color}\", for example "
+"french time: \"${lightblue}%H${white}%M${lightred}%S\""
msgstr ""
msgid "number of colors to use for nicks colors"
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 07865c785..e101fbd04 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -280,7 +280,7 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
(void) data;
(void) option;
- gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
+ gui_chat_time_length = gui_chat_get_time_length ();
gui_chat_change_time_format ();
if (gui_ok)
gui_window_ask_refresh (1);
@@ -1327,7 +1327,9 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"buffer_time_format", "string",
N_("time format for each line displayed in buffers (see man strftime "
- "for date/time specifiers)"),
+ "for date/time specifiers), colors are allowed with format "
+ "\"${color}\", for example french time: "
+ "\"${lightblue}%H${white}%M${lightred}%S\""),
NULL, 0, 0, "%H:%M:%S", NULL, 0, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL);
config_look_color_nicks_number = config_file_new_option (
weechat_config_file, ptr_section,
diff --git a/src/core/wee-util.c b/src/core/wee-util.c
index 8d8fe4429..a1eaf29fa 100644
--- a/src/core/wee-util.c
+++ b/src/core/wee-util.c
@@ -106,27 +106,6 @@ util_timeval_add (struct timeval *tv, long interval)
}
/*
- * util_get_time_length: calculates time length with a time format
- */
-
-int
-util_get_time_length (const char *time_format)
-{
- time_t date;
- struct tm *local_time;
- char text_time[1024];
-
- if (!time_format || !time_format[0])
- return 0;
-
- date = time (NULL);
- local_time = localtime (&date);
- strftime (text_time, sizeof (text_time),
- time_format, local_time);
- return strlen (text_time);
-}
-
-/*
* util_get_time_string: converts date to a string, using format of option
* weechat.look.time_format (can be localized)
*/
diff --git a/src/core/wee-util.h b/src/core/wee-util.h
index 497e43aa2..9f87f1c52 100644
--- a/src/core/wee-util.h
+++ b/src/core/wee-util.h
@@ -23,7 +23,6 @@
extern int util_timeval_cmp (struct timeval *tv1, struct timeval *tv2);
extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2);
extern void util_timeval_add (struct timeval *tv, long interval);
-extern int util_get_time_length (const char *time_format);
extern char *util_get_time_string (const time_t *date);
extern void util_catch_signal (int signum, void (*handler)(int));
extern int util_mkdir_home (const char *directory, int mode);
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 051408d35..2ca5469e6 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -112,7 +112,7 @@ gui_main_init ()
gui_input_clipboard = NULL;
/* get time length */
- gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
+ gui_chat_time_length = gui_chat_get_time_length ();
/* init bar items */
gui_bar_item_init ();
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index c2568271a..ca5f02e5d 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -289,6 +289,7 @@ char *
gui_chat_get_time_string (time_t date)
{
char text_time[128], text_time2[(128*3)+16], text_time_char[2];
+ char *text_with_color;
int i, time_first_digit, time_last_digit, last_color;
struct tm *local_time;
@@ -302,6 +303,17 @@ gui_chat_get_time_string (time_t date)
local_time) == 0)
return NULL;
+ if (strstr (text_time, "${"))
+ {
+ text_with_color = gui_color_string_replace_colors (text_time);
+ if (text_with_color)
+ {
+ if (strcmp (text_time, text_with_color) != 0)
+ return text_with_color;
+ free (text_with_color);
+ }
+ }
+
time_first_digit = -1;
time_last_digit = -1;
i = 0;
@@ -373,6 +385,35 @@ gui_chat_get_time_string (time_t date)
}
/*
+ * gui_chat_get_time_length: calculates time length with a time format
+ * (format can include color codes with format ${name})
+ */
+
+int
+gui_chat_get_time_length ()
+{
+ time_t date;
+ char *text_time;
+ int length;
+
+ if (!CONFIG_STRING(config_look_buffer_time_format)
+ || !CONFIG_STRING(config_look_buffer_time_format)[0])
+ return 0;
+
+ length = 0;
+ date = time (NULL);
+ text_time = gui_chat_get_time_string (date);
+
+ if (text_time)
+ {
+ length = gui_chat_strlen_screen (text_time);
+ free (text_time);
+ }
+
+ return length;
+}
+
+/*
* gui_chat_change_time_format: change time format for all lines of all buffers
*/
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index 0f6ed04b7..57d74337d 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -67,6 +67,7 @@ extern void gui_chat_get_word_info (struct t_gui_window *window,
int *word_length_with_spaces,
int *word_length);
extern char *gui_chat_get_time_string (time_t date);
+extern int gui_chat_get_time_length ();
extern void gui_chat_change_time_format ();
extern char *gui_chat_build_string_prefix_message (struct t_gui_line *line);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index 5e170d214..99c8bc065 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -348,6 +348,82 @@ gui_color_decode (const char *string, const char *replacement)
}
/*
+ * gui_color_string_replace_colors: replace colors in string with color codes
+ * colors are using format: ${name} where name
+ * is a color name
+ */
+
+char *
+gui_color_string_replace_colors (const char *string)
+{
+ int length, length_color, index_string, index_result;
+ char *result, *color_name;
+ const char *pos_end_name, *ptr_color;
+
+ if (!string)
+ return NULL;
+
+ length = strlen (string) + 1;
+ result = malloc (length);
+ if (result)
+ {
+ index_string = 0;
+ index_result = 0;
+ while (string[index_string])
+ {
+ if ((string[index_string] == '\\')
+ && (string[index_string + 1] == '$'))
+ {
+ index_string++;
+ result[index_result++] = string[index_string++];
+ }
+ else if ((string[index_string] == '$')
+ && (string[index_string + 1] == '{'))
+ {
+ pos_end_name = strchr (string + index_string + 2, '}');
+ if (pos_end_name)
+ {
+ color_name = string_strndup (string + index_string + 2,
+ pos_end_name - (string + index_string + 2));
+ if (color_name)
+ {
+ ptr_color = gui_color_get_custom (color_name);
+ if (ptr_color)
+ {
+ length_color = strlen (ptr_color);
+ length += length_color;
+ result = realloc (result, length);
+ if (!result)
+ {
+ free (color_name);
+ return NULL;
+ }
+ strcpy (result + index_result, ptr_color);
+ index_result += length_color;
+ index_string += pos_end_name - string -
+ index_string + 1;
+ }
+ else
+ result[index_result++] = string[index_string++];
+
+ free (color_name);
+ }
+ else
+ result[index_result++] = string[index_string++];
+ }
+ else
+ result[index_result++] = string[index_string++];
+ }
+ else
+ result[index_result++] = string[index_string++];
+ }
+ result[index_result] = '\0';
+ }
+
+ return result;
+}
+
+/*
* gui_color_free: free a color
*/
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 4b0263591..0d8872b19 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -131,6 +131,7 @@ extern struct t_gui_color *gui_color[];
extern const char *gui_color_search_config (const char *color_name);
extern const char *gui_color_get_custom (const char *color_name);
extern char *gui_color_decode (const char *string, const char *replacement);
+extern char *gui_color_string_replace_colors (const char *string);
extern void gui_color_free (struct t_gui_color *color);
/* color functions (GUI dependent) */