From b2c5a94e5dde1aa5775b9fa18616b901736ae928 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 1 Feb 2008 16:45:43 +0100 Subject: [PATCH] Fixed bug with prefixes in config file --- src/core/wee-config.c | 7 ------- src/gui/gui-chat.c | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index a486f9701..49ace9b49 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -279,13 +279,6 @@ config_change_read_marker () void config_change_prefix () { - int i; - - for (i = 0; i < GUI_CHAT_PREFIX_NUMBER; i++) - { - if (gui_chat_prefix[i]) - free (gui_chat_prefix[i]); - } gui_chat_prefix_build (); } diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index ac7338b34..1910c0f03 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -56,12 +56,12 @@ int gui_chat_time_length = 0; /* length of time for each line (in chars) */ void gui_chat_prefix_build_empty () { - gui_chat_prefix[GUI_CHAT_PREFIX_INFO] = gui_chat_prefix_empty; - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR] = gui_chat_prefix_empty; - gui_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = gui_chat_prefix_empty; - gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = gui_chat_prefix_empty; - gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = gui_chat_prefix_empty; - gui_chat_prefix[GUI_CHAT_PREFIX_QUIT] = gui_chat_prefix_empty; + gui_chat_prefix[GUI_CHAT_PREFIX_INFO] = strdup (gui_chat_prefix_empty); + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR] = strdup (gui_chat_prefix_empty); + gui_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = strdup (gui_chat_prefix_empty); + gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = strdup (gui_chat_prefix_empty); + gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = strdup (gui_chat_prefix_empty); + gui_chat_prefix[GUI_CHAT_PREFIX_QUIT] = strdup (gui_chat_prefix_empty); } /* @@ -73,6 +73,16 @@ void gui_chat_prefix_build () { char prefix[128]; + int i; + + for (i = 0; i < GUI_CHAT_PREFIX_NUMBER; i++) + { + if (gui_chat_prefix[i]) + { + free (gui_chat_prefix[i]); + gui_chat_prefix[i] = NULL; + } + } snprintf (prefix, sizeof (prefix), "%s%s\t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_INFO),