summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-chat.c43
-rw-r--r--src/gui/curses/gui-curses-color.c121
-rw-r--r--src/gui/curses/gui-curses-infobar.c8
-rw-r--r--src/gui/curses/gui-curses-input.c3
-rw-r--r--src/gui/curses/gui-curses-keyboard.c5
-rw-r--r--src/gui/curses/gui-curses-main.c17
-rw-r--r--src/gui/curses/gui-curses-nicklist.c75
-rw-r--r--src/gui/curses/gui-curses-status.c20
-rw-r--r--src/gui/curses/gui-curses-window.c123
-rw-r--r--src/gui/gtk/gui-gtk-chat.c1
-rw-r--r--src/gui/gtk/gui-gtk-color.c1
-rw-r--r--src/gui/gtk/gui-gtk-infobar.c2
-rw-r--r--src/gui/gtk/gui-gtk-input.c2
-rw-r--r--src/gui/gtk/gui-gtk-main.c4
-rw-r--r--src/gui/gtk/gui-gtk-window.c8
-rw-r--r--src/gui/gui-action.c5
-rw-r--r--src/gui/gui-buffer.c3
-rw-r--r--src/gui/gui-chat.c35
-rw-r--r--src/gui/gui-color.c16
-rw-r--r--src/gui/gui-completion.c118
-rw-r--r--src/gui/gui-history.c80
-rw-r--r--src/gui/gui-history.h4
-rw-r--r--src/gui/gui-hotlist.c15
-rw-r--r--src/gui/gui-input.c12
-rw-r--r--src/gui/gui-main.h5
-rw-r--r--src/gui/gui-window.c1
-rw-r--r--src/gui/gui-window.h3
27 files changed, 393 insertions, 337 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index dd0e86c69..1558c4708 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -32,6 +32,7 @@
#include "../../core/wee-string.h"
#include "../../core/wee-utf8.h"
#include "../gui-chat.h"
+#include "../gui-color.h"
#include "../gui-main.h"
#include "../gui-window.h"
#include "gui-curses.h"
@@ -248,7 +249,7 @@ int
gui_chat_get_real_width (struct t_gui_window *window)
{
if (window->buffer->nicklist
- && (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT))
+ && (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_RIGHT))
return window->win_chat_width - 1;
else
return window->win_chat_width;
@@ -478,12 +479,13 @@ gui_chat_display_word (struct t_gui_window *window,
}
window->win_chat_cursor_x += length_align;
if (!simulate
- && (cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)
- && (cfg_look_prefix_suffix && cfg_look_prefix_suffix[0]))
+ && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
+ && (CONFIG_STRING(config_look_prefix_suffix)
+ && CONFIG_STRING(config_look_prefix_suffix)[0]))
{
gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_SUFFIX);
- gui_chat_display_word_raw (window, cfg_look_prefix_suffix, 1);
- window->win_chat_cursor_x += gui_chat_strlen_screen (cfg_look_prefix_suffix);
+ gui_chat_display_word_raw (window, CONFIG_STRING(config_look_prefix_suffix), 1);
+ window->win_chat_cursor_x += gui_chat_strlen_screen (CONFIG_STRING(config_look_prefix_suffix));
gui_chat_display_word_raw (window, str_space, 1);
window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
gui_chat_set_weechat_color (window, GUI_COLOR_CHAT);
@@ -572,23 +574,23 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
/* display prefix */
if (line->prefix
&& (line->prefix[0]
- || (cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)))
+ || (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)))
{
if (!simulate)
gui_chat_reset_style (window);
- if (cfg_look_prefix_align_max > 0)
+ if (CONFIG_INTEGER(config_look_prefix_align_max) > 0)
{
length_allowed =
- (window->buffer->prefix_max_length <= cfg_look_prefix_align_max) ?
- window->buffer->prefix_max_length : cfg_look_prefix_align_max;
+ (window->buffer->prefix_max_length <= CONFIG_INTEGER(config_look_prefix_align_max)) ?
+ window->buffer->prefix_max_length : CONFIG_INTEGER(config_look_prefix_align_max);
}
else
length_allowed = window->buffer->prefix_max_length;
num_spaces = length_allowed - line->prefix_length;
- if (cfg_look_prefix_align == CFG_LOOK_PREFIX_ALIGN_RIGHT)
+ if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_RIGHT)
{
for (i = 0; i < num_spaces; i++)
{
@@ -598,7 +600,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
}
}
/* not enough space to display full prefix ? => truncate it! */
- if ((cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)
+ if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
&& (num_spaces < 0))
{
gui_chat_display_word (window, line, line->prefix,
@@ -618,7 +620,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
if (!simulate)
gui_chat_reset_style (window);
- if (cfg_look_prefix_align == CFG_LOOK_PREFIX_ALIGN_LEFT)
+ if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_LEFT)
{
for (i = 0; i < num_spaces; i++)
{
@@ -627,7 +629,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
simulate);
}
}
- if ((cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)
+ if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
&& (num_spaces < 0))
{
if (!simulate)
@@ -642,12 +644,14 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
NULL, 1, num_lines, count, lines_displayed,
simulate);
}
- if ((cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)
- && (cfg_look_prefix_suffix && cfg_look_prefix_suffix[0]))
+ if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
+ && (CONFIG_STRING(config_look_prefix_suffix)
+ && CONFIG_STRING(config_look_prefix_suffix)[0]))
{
if (!simulate)
gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_SUFFIX);
- gui_chat_display_word (window, line, cfg_look_prefix_suffix,
+ gui_chat_display_word (window, line,
+ CONFIG_STRING(config_look_prefix_suffix),
NULL, 1, num_lines, count,
lines_displayed, simulate);
gui_chat_display_word (window, line, str_space,
@@ -809,7 +813,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
}
else
{
- if (cfg_look_read_marker && cfg_look_read_marker[0])
+ if (CONFIG_STRING(config_look_read_marker)
+ && CONFIG_STRING(config_look_read_marker)[0])
{
/* display marker if line is matching user search */
if (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
@@ -821,7 +826,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
GUI_COLOR_CHAT_READ_MARKER);
mvwprintw (GUI_CURSES(window)->win_chat,
read_marker_y, read_marker_x,
- "%c", cfg_look_read_marker[0]);
+ "%c", CONFIG_STRING(config_look_read_marker)[0]);
}
}
else
@@ -834,7 +839,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
GUI_COLOR_CHAT_READ_MARKER);
mvwprintw (GUI_CURSES(window)->win_chat,
read_marker_y, read_marker_x,
- "%c", cfg_look_read_marker[0]);
+ "%c", CONFIG_STRING(config_look_read_marker)[0]);
}
}
}
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 35bee21a4..71a9c63f4 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -32,6 +32,7 @@
#include "../../core/wee-string.h"
#include "../../core/wee-utf8.h"
#include "../gui-color.h"
+#include "../gui-chat.h"
#include "gui-curses.h"
@@ -330,7 +331,7 @@ gui_color_init_pairs ()
init_pair (63, -1, -1);
/* white on default bg is default (-1) */
- if (!cfg_look_color_real_white)
+ if (!CONFIG_BOOLEAN(config_look_color_real_white))
init_pair (COLOR_WHITE, -1, -1);
}
}
@@ -344,75 +345,75 @@ gui_color_init_weechat ()
{
int i;
- gui_color[GUI_COLOR_SEPARATOR] = gui_color_build (GUI_COLOR_SEPARATOR, cfg_col_separator, cfg_col_separator);
+ gui_color[GUI_COLOR_SEPARATOR] = gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_separator));
- gui_color[GUI_COLOR_TITLE] = gui_color_build (GUI_COLOR_TITLE, cfg_col_title, cfg_col_title_bg);
- gui_color[GUI_COLOR_TITLE_MORE] = gui_color_build (GUI_COLOR_TITLE_MORE, cfg_col_title_more, cfg_col_title_bg);
+ gui_color[GUI_COLOR_TITLE] = gui_color_build (GUI_COLOR_TITLE, CONFIG_COLOR(config_color_title), CONFIG_COLOR(config_color_title_bg));
+ gui_color[GUI_COLOR_TITLE_MORE] = gui_color_build (GUI_COLOR_TITLE_MORE, CONFIG_COLOR(config_color_title_more), CONFIG_COLOR(config_color_title_bg));
- gui_color[GUI_COLOR_CHAT] = gui_color_build (GUI_COLOR_CHAT, cfg_col_chat, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_TIME] = gui_color_build (GUI_COLOR_CHAT_TIME, cfg_col_chat_time, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_TIME_DELIMITERS] = gui_color_build (GUI_COLOR_CHAT_TIME_DELIMITERS, cfg_col_chat_time_delimiters, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_INFO] = gui_color_build (GUI_COLOR_CHAT_PREFIX_INFO, cfg_col_chat_prefix[GUI_CHAT_PREFIX_INFO], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_ERROR] = gui_color_build (GUI_COLOR_CHAT_PREFIX_ERROR, cfg_col_chat_prefix[GUI_CHAT_PREFIX_ERROR], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_NETWORK] = gui_color_build (GUI_COLOR_CHAT_PREFIX_NETWORK, cfg_col_chat_prefix[GUI_CHAT_PREFIX_NETWORK], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_ACTION] = gui_color_build (GUI_COLOR_CHAT_PREFIX_ACTION, cfg_col_chat_prefix[GUI_CHAT_PREFIX_ACTION], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_JOIN] = gui_color_build (GUI_COLOR_CHAT_PREFIX_JOIN, cfg_col_chat_prefix[GUI_CHAT_PREFIX_JOIN], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_QUIT] = gui_color_build (GUI_COLOR_CHAT_PREFIX_QUIT, cfg_col_chat_prefix[GUI_CHAT_PREFIX_QUIT], cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_MORE] = gui_color_build (GUI_COLOR_CHAT_PREFIX_MORE, cfg_col_chat_prefix_more, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_PREFIX_SUFFIX] = gui_color_build (GUI_COLOR_CHAT_PREFIX_SUFFIX, cfg_col_chat_prefix_suffix, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_BUFFER] = gui_color_build (GUI_COLOR_CHAT_BUFFER, cfg_col_chat_buffer, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_SERVER] = gui_color_build (GUI_COLOR_CHAT_SERVER, cfg_col_chat_server, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_CHANNEL] = gui_color_build (GUI_COLOR_CHAT_CHANNEL, cfg_col_chat_channel, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_NICK] = gui_color_build (GUI_COLOR_CHAT_NICK, cfg_col_chat_nick, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_NICK_SELF] = gui_color_build (GUI_COLOR_CHAT_NICK_SELF, cfg_col_chat_nick_self, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_NICK_OTHER] = gui_color_build (GUI_COLOR_CHAT_NICK_OTHER, cfg_col_chat_nick_other, cfg_col_chat_bg);
+ gui_color[GUI_COLOR_CHAT] = gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_TIME] = gui_color_build (GUI_COLOR_CHAT_TIME, CONFIG_COLOR(config_color_chat_time), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_TIME_DELIMITERS] = gui_color_build (GUI_COLOR_CHAT_TIME_DELIMITERS, CONFIG_COLOR(config_color_chat_time_delimiters), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_INFO] = gui_color_build (GUI_COLOR_CHAT_PREFIX_INFO, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_INFO]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_ERROR] = gui_color_build (GUI_COLOR_CHAT_PREFIX_ERROR, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_ERROR]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_NETWORK] = gui_color_build (GUI_COLOR_CHAT_PREFIX_NETWORK, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_NETWORK]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_ACTION] = gui_color_build (GUI_COLOR_CHAT_PREFIX_ACTION, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_ACTION]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_JOIN] = gui_color_build (GUI_COLOR_CHAT_PREFIX_JOIN, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_JOIN]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_QUIT] = gui_color_build (GUI_COLOR_CHAT_PREFIX_QUIT, CONFIG_COLOR(config_color_chat_prefix[GUI_CHAT_PREFIX_QUIT]), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_MORE] = gui_color_build (GUI_COLOR_CHAT_PREFIX_MORE, CONFIG_COLOR(config_color_chat_prefix_more), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_PREFIX_SUFFIX] = gui_color_build (GUI_COLOR_CHAT_PREFIX_SUFFIX, CONFIG_COLOR(config_color_chat_prefix_suffix), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_BUFFER] = gui_color_build (GUI_COLOR_CHAT_BUFFER, CONFIG_COLOR(config_color_chat_buffer), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_SERVER] = gui_color_build (GUI_COLOR_CHAT_SERVER, CONFIG_COLOR(config_color_chat_server), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_CHANNEL] = gui_color_build (GUI_COLOR_CHAT_CHANNEL, CONFIG_COLOR(config_color_chat_channel), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_NICK] = gui_color_build (GUI_COLOR_CHAT_NICK, CONFIG_COLOR(config_color_chat_nick), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_NICK_SELF] = gui_color_build (GUI_COLOR_CHAT_NICK_SELF, CONFIG_COLOR(config_color_chat_nick_self), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_NICK_OTHER] = gui_color_build (GUI_COLOR_CHAT_NICK_OTHER, CONFIG_COLOR(config_color_chat_nick_other), CONFIG_COLOR(config_color_chat_bg));
for (i = 0; i < GUI_COLOR_NICK_NUMBER; i++)
{
- gui_color[GUI_COLOR_CHAT_NICK1 + i] = gui_color_build (GUI_COLOR_CHAT_NICK1 + i, cfg_col_chat_nick_colors[i], cfg_col_chat_bg);
+ gui_color[GUI_COLOR_CHAT_NICK1 + i] = gui_color_build (GUI_COLOR_CHAT_NICK1 + i, CONFIG_COLOR(config_color_chat_nick_colors[i]), CONFIG_COLOR(config_color_chat_bg));
}
- gui_color[GUI_COLOR_CHAT_HOST] = gui_color_build (GUI_COLOR_CHAT_HOST, cfg_col_chat_host, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_DELIMITERS] = gui_color_build (GUI_COLOR_CHAT_DELIMITERS, cfg_col_chat_delimiters, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_HIGHLIGHT] = gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, cfg_col_chat_highlight, cfg_col_chat_bg);
- gui_color[GUI_COLOR_CHAT_READ_MARKER] = gui_color_build (GUI_COLOR_CHAT_READ_MARKER, cfg_col_chat_read_marker, cfg_col_chat_read_marker_bg);
+ gui_color[GUI_COLOR_CHAT_HOST] = gui_color_build (GUI_COLOR_CHAT_HOST, CONFIG_COLOR(config_color_chat_host), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_DELIMITERS] = gui_color_build (GUI_COLOR_CHAT_DELIMITERS, CONFIG_COLOR(config_color_chat_delimiters), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_HIGHLIGHT] = gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_bg));
+ gui_color[GUI_COLOR_CHAT_READ_MARKER] = gui_color_build (GUI_COLOR_CHAT_READ_MARKER, CONFIG_COLOR(config_color_chat_read_marker), CONFIG_COLOR(config_color_chat_read_marker_bg));
- gui_color[GUI_COLOR_STATUS] = gui_color_build (GUI_COLOR_STATUS, cfg_col_status, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_DELIMITERS] = gui_color_build (GUI_COLOR_STATUS_DELIMITERS, cfg_col_status_delimiters, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_CHANNEL] = gui_color_build (GUI_COLOR_STATUS_CHANNEL, cfg_col_status_channel, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_DATA_MSG] = gui_color_build (GUI_COLOR_STATUS_DATA_MSG, cfg_col_status_data_msg, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_DATA_PRIVATE] = gui_color_build (GUI_COLOR_STATUS_DATA_PRIVATE, cfg_col_status_data_private, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_DATA_HIGHLIGHT] = gui_color_build (GUI_COLOR_STATUS_DATA_HIGHLIGHT, cfg_col_status_data_highlight, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_DATA_OTHER] = gui_color_build (GUI_COLOR_STATUS_DATA_OTHER, cfg_col_status_data_other, cfg_col_status_bg);
- gui_color[GUI_COLOR_STATUS_MORE] = gui_color_build (GUI_COLOR_STATUS_MORE, cfg_col_status_more, cfg_col_status_bg);
+ gui_color[GUI_COLOR_STATUS] = gui_color_build (GUI_COLOR_STATUS, CONFIG_COLOR(config_color_status), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_DELIMITERS] = gui_color_build (GUI_COLOR_STATUS_DELIMITERS, CONFIG_COLOR(config_color_status_delimiters), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_CHANNEL] = gui_color_build (GUI_COLOR_STATUS_CHANNEL, CONFIG_COLOR(config_color_status_channel), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_DATA_MSG] = gui_color_build (GUI_COLOR_STATUS_DATA_MSG, CONFIG_COLOR(config_color_status_data_msg), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_DATA_PRIVATE] = gui_color_build (GUI_COLOR_STATUS_DATA_PRIVATE, CONFIG_COLOR(config_color_status_data_private), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_DATA_HIGHLIGHT] = gui_color_build (GUI_COLOR_STATUS_DATA_HIGHLIGHT, CONFIG_COLOR(config_color_status_data_highlight), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_DATA_OTHER] = gui_color_build (GUI_COLOR_STATUS_DATA_OTHER, CONFIG_COLOR(config_color_status_data_other), CONFIG_COLOR(config_color_status_bg));
+ gui_color[GUI_COLOR_STATUS_MORE] = gui_color_build (GUI_COLOR_STATUS_MORE, CONFIG_COLOR(config_color_status_more), CONFIG_COLOR(config_color_status_bg));
- gui_color[GUI_COLOR_INFOBAR] = gui_color_build (GUI_COLOR_INFOBAR, cfg_col_infobar, cfg_col_infobar_bg);
- gui_color[GUI_COLOR_INFOBAR_DELIMITERS] = gui_color_build (GUI_COLOR_INFOBAR_DELIMITERS, cfg_col_infobar_delimiters, cfg_col_infobar_bg);
- gui_color[GUI_COLOR_INFOBAR_HIGHLIGHT] = gui_color_build (GUI_COLOR_INFOBAR_HIGHLIGHT, cfg_col_infobar_highlight, cfg_col_infobar_bg);
+ gui_color[GUI_COLOR_INFOBAR] = gui_color_build (GUI_COLOR_INFOBAR, CONFIG_COLOR(config_color_infobar), CONFIG_COLOR(config_color_infobar_bg));
+ gui_color[GUI_COLOR_INFOBAR_DELIMITERS] = gui_color_build (GUI_COLOR_INFOBAR_DELIMITERS, CONFIG_COLOR(config_color_infobar_delimiters), CONFIG_COLOR(config_color_infobar_bg));
+ gui_color[GUI_COLOR_INFOBAR_HIGHLIGHT] = gui_color_build (GUI_COLOR_INFOBAR_HIGHLIGHT, CONFIG_COLOR(config_color_infobar_highlight), CONFIG_COLOR(config_color_infobar_bg));
- gui_color[GUI_COLOR_INPUT] = gui_color_build (GUI_COLOR_INPUT, cfg_col_input, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_SERVER] = gui_color_build (GUI_COLOR_INPUT_SERVER, cfg_col_input_server, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_CHANNEL] = gui_color_build (GUI_COLOR_INPUT_CHANNEL, cfg_col_input_channel, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_NICK] = gui_color_build (GUI_COLOR_INPUT_NICK, cfg_col_input_nick, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_DELIMITERS] = gui_color_build (GUI_COLOR_INPUT_DELIMITERS, cfg_col_input_delimiters, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_TEXT_NOT_FOUND] = gui_color_build (GUI_COLOR_INPUT_TEXT_NOT_FOUND, cfg_col_input_text_not_found, cfg_col_input_bg);
- gui_color[GUI_COLOR_INPUT_ACTIONS] = gui_color_build (GUI_COLOR_INPUT_ACTIONS, cfg_col_input_actions, cfg_col_input_bg);
+ gui_color[GUI_COLOR_INPUT] = gui_color_build (GUI_COLOR_INPUT, CONFIG_COLOR(config_color_input), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_SERVER] = gui_color_build (GUI_COLOR_INPUT_SERVER, CONFIG_COLOR(config_color_input_server), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_CHANNEL] = gui_color_build (GUI_COLOR_INPUT_CHANNEL, CONFIG_COLOR(config_color_input_channel), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_NICK] = gui_color_build (GUI_COLOR_INPUT_NICK, CONFIG_COLOR(config_color_input_nick), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_DELIMITERS] = gui_color_build (GUI_COLOR_INPUT_DELIMITERS, CONFIG_COLOR(config_color_input_delimiters), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_TEXT_NOT_FOUND] = gui_color_build (GUI_COLOR_INPUT_TEXT_NOT_FOUND, CONFIG_COLOR(config_color_input_text_not_found), CONFIG_COLOR(config_color_input_bg));
+ gui_color[GUI_COLOR_INPUT_ACTIONS] = gui_color_build (GUI_COLOR_INPUT_ACTIONS, CONFIG_COLOR(config_color_input_actions), CONFIG_COLOR(config_color_input_bg));
- gui_color[GUI_COLOR_NICKLIST] = gui_color_build (GUI_COLOR_NICKLIST, cfg_col_nicklist, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_AWAY] = gui_color_build (GUI_COLOR_NICKLIST_AWAY, cfg_col_nicklist_away, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_PREFIX1] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX1, cfg_col_nicklist_prefix1, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_PREFIX2] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX2, cfg_col_nicklist_prefix2, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_PREFIX3] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX3, cfg_col_nicklist_prefix3, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_PREFIX4] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX4, cfg_col_nicklist_prefix4, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_PREFIX5] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX5, cfg_col_nicklist_prefix5, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_MORE] = gui_color_build (GUI_COLOR_NICKLIST_MORE, cfg_col_nicklist_more, cfg_col_nicklist_bg);
- gui_color[GUI_COLOR_NICKLIST_SEPARATOR] = gui_color_build (GUI_COLOR_NICKLIST_SEPARATOR, cfg_col_nicklist_separator, cfg_col_nicklist_bg);
+ gui_color[GUI_COLOR_NICKLIST] = gui_color_build (GUI_COLOR_NICKLIST, CONFIG_COLOR(config_color_nicklist), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_AWAY] = gui_color_build (GUI_COLOR_NICKLIST_AWAY, CONFIG_COLOR(config_color_nicklist_away), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_PREFIX1] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX1, CONFIG_COLOR(config_color_nicklist_prefix1), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_PREFIX2] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX2, CONFIG_COLOR(config_color_nicklist_prefix2), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_PREFIX3] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX3, CONFIG_COLOR(config_color_nicklist_prefix3), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_PREFIX4] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX4, CONFIG_COLOR(config_color_nicklist_prefix4), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_PREFIX5] = gui_color_build (GUI_COLOR_NICKLIST_PREFIX5, CONFIG_COLOR(config_color_nicklist_prefix5), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_MORE] = gui_color_build (GUI_COLOR_NICKLIST_MORE, CONFIG_COLOR(config_color_nicklist_more), CONFIG_COLOR(config_color_nicklist_bg));
+ gui_color[GUI_COLOR_NICKLIST_SEPARATOR] = gui_color_build (GUI_COLOR_NICKLIST_SEPARATOR, CONFIG_COLOR(config_color_nicklist_separator), CONFIG_COLOR(config_color_nicklist_bg));
- gui_color[GUI_COLOR_INFO] = gui_color_build (GUI_COLOR_INFO, cfg_col_info, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_WAITING] = gui_color_build (GUI_COLOR_INFO_WAITING, cfg_col_info_waiting, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_CONNECTING] = gui_color_build (GUI_COLOR_INFO_CONNECTING, cfg_col_info_connecting, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_ACTIVE] = gui_color_build (GUI_COLOR_INFO_ACTIVE, cfg_col_info_active, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_DONE] = gui_color_build (GUI_COLOR_INFO_DONE, cfg_col_info_done, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_FAILED] = gui_color_build (GUI_COLOR_INFO_FAILED, cfg_col_info_failed, cfg_col_info_bg);
- gui_color[GUI_COLOR_INFO_ABORTED] = gui_color_build (GUI_COLOR_INFO_ABORTED, cfg_col_info_aborted, cfg_col_info_bg);
+ gui_color[GUI_COLOR_INFO] = gui_color_build (GUI_COLOR_INFO, CONFIG_COLOR(config_color_info), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_WAITING] = gui_color_build (GUI_COLOR_INFO_WAITING, CONFIG_COLOR(config_color_info_waiting), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_CONNECTING] = gui_color_build (GUI_COLOR_INFO_CONNECTING, CONFIG_COLOR(config_color_info_connecting), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_ACTIVE] = gui_color_build (GUI_COLOR_INFO_ACTIVE, CONFIG_COLOR(config_color_info_active), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_DONE] = gui_color_build (GUI_COLOR_INFO_DONE, CONFIG_COLOR(config_color_info_done), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_FAILED] = gui_color_build (GUI_COLOR_INFO_FAILED, CONFIG_COLOR(config_color_info_failed), CONFIG_COLOR(config_color_info_bg));
+ gui_color[GUI_COLOR_INFO_ABORTED] = gui_color_build (GUI_COLOR_INFO_ABORTED, CONFIG_COLOR(config_color_info_aborted), CONFIG_COLOR(config_color_info_bg));
}
/*
diff --git a/src/gui/curses/gui-curses-infobar.c b/src/gui/curses/gui-curses-infobar.c
index 1ff4dc925..eec538c4b 100644
--- a/src/gui/curses/gui-curses-infobar.c
+++ b/src/gui/curses/gui-curses-infobar.c
@@ -30,6 +30,7 @@
#include "../../core/wee-config.h"
#include "../../core/wee-string.h"
#include "../gui-infobar.h"
+#include "../gui-color.h"
#include "../gui-main.h"
#include "../gui-window.h"
#include "gui-curses.h"
@@ -64,7 +65,7 @@ gui_infobar_draw_time (struct t_gui_buffer *buffer)
0, 1,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
- if (cfg_look_infobar_seconds)
+ if (CONFIG_BOOLEAN(config_look_infobar_seconds))
wprintw (GUI_CURSES(ptr_win)->win_infobar,
":%02d",
local_time->tm_sec);
@@ -105,7 +106,8 @@ gui_infobar_draw (struct t_gui_buffer *buffer, int erase)
if (local_time)
{
strftime (text_time, sizeof (text_time),
- cfg_look_infobar_time_format, local_time);
+ CONFIG_STRING(config_look_infobar_time_format),
+ local_time);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_infobar,
GUI_COLOR_INFOBAR_DELIMITERS);
wprintw (GUI_CURSES(ptr_win)->win_infobar, "[");
@@ -114,7 +116,7 @@ gui_infobar_draw (struct t_gui_buffer *buffer, int erase)
wprintw (GUI_CURSES(ptr_win)->win_infobar,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
- if (cfg_look_infobar_seconds)
+ if (CONFIG_BOOLEAN(config_look_infobar_seconds))
wprintw (GUI_CURSES(ptr_win)->win_infobar,
":%02d",
local_time->tm_sec);
diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c
index 174865096..68eefc5a8 100644
--- a/src/gui/curses/gui-curses-input.c
+++ b/src/gui/curses/gui-curses-input.c
@@ -32,6 +32,7 @@
#include "../../core/wee-utf8.h"
#include "../../plugins/plugin.h"
#include "../gui-input.h"
+#include "../gui-color.h"
#include "../gui-keyboard.h"
#include "../gui-main.h"
#include "../gui-window.h"
@@ -90,7 +91,7 @@ gui_input_draw_prompt (struct t_gui_window *window)
return;
}
- pos = cfg_look_input_format;
+ pos = CONFIG_STRING(config_look_input_format);
while (pos && pos[0])
{
switch (pos[0])
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index 19b91add1..86f542606 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -31,6 +31,7 @@
#include "../../core/wee-utf8.h"
#include "../../core/wee-string.h"
#include "../gui-keyboard.h"
+#include "../gui-color.h"
#include "../gui-input.h"
#include "../gui-completion.h"
#include "../gui-window.h"
@@ -218,10 +219,10 @@ gui_keyboard_read ()
{
/* detect user paste or large amount of text
if so, ask user what to do */
- if (cfg_look_paste_max_lines > 0)
+ if (CONFIG_INTEGER(config_look_paste_max_lines) > 0)
{
paste_lines = gui_keyboard_get_paste_lines ();
- if (paste_lines > cfg_look_paste_max_lines)
+ if (paste_lines > CONFIG_INTEGER(config_look_paste_max_lines))
{
gui_keyboard_paste_pending = 1;
gui_input_draw (gui_current_window->buffer, 1);
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 7fbcd40cc..a885dafc5 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -36,12 +36,14 @@
#include "../../core/wee-utf8.h"
#include "../../core/wee-util.h"
#include "../../plugins/plugin.h"
+#include "../gui-main.h"
+#include "../gui-chat.h"
+#include "../gui-color.h"
#include "../gui-infobar.h"
#include "../gui-input.h"
#include "../gui-history.h"
#include "../gui-hotlist.h"
#include "../gui-keyboard.h"
-#include "../gui-main.h"
#include "../gui-window.h"
#include "gui-curses.h"
@@ -87,7 +89,7 @@ gui_main_init ()
gui_input_clipboard = NULL;
/* get time length */
- gui_chat_time_length = util_get_time_length (cfg_look_buffer_time_format);
+ gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
/* create new window/buffer */
if (gui_window_new (NULL, 0, 0, COLS, LINES, 100, 100))
@@ -105,7 +107,7 @@ gui_main_init ()
else
gui_init_ok = 0;
- if (cfg_look_set_title)
+ if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_set ();
signal (SIGWINCH, gui_window_refresh_screen_sigwinch);
@@ -179,11 +181,12 @@ gui_main_loop ()
old_min = local_time->tm_min;
gui_infobar_draw (gui_current_window->buffer, 1);
- if (cfg_look_day_change
+ if (CONFIG_BOOLEAN(config_look_day_change)
&& (local_time->tm_mday != old_day))
{
strftime (text_time, sizeof (text_time),
- cfg_look_day_change_time_format, local_time);
+ CONFIG_STRING(config_look_day_change_time_format),
+ local_time);
text_time2 = string_iconv_to_internal (NULL, text_time);
gui_add_hotlist = 0;
for (ptr_buffer = gui_buffers; ptr_buffer;
@@ -208,7 +211,7 @@ gui_main_loop ()
old_sec = local_time->tm_sec;
/* display time in infobar (if seconds displayed) */
- if (cfg_look_infobar_seconds)
+ if (CONFIG_BOOLEAN(config_look_infobar_seconds))
{
gui_infobar_draw_time (gui_current_window->buffer);
wmove (GUI_CURSES(gui_current_window)->win_input,
@@ -305,7 +308,7 @@ gui_main_end ()
gui_infobar_remove ();
/* reset title */
- if (cfg_look_set_title)
+ if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
/* end of Curses output */
diff --git a/src/gui/curses/gui-curses-nicklist.c b/src/gui/curses/gui-curses-nicklist.c
index 5be8c4984..a0a253609 100644
--- a/src/gui/curses/gui-curses-nicklist.c
+++ b/src/gui/curses/gui-curses-nicklist.c
@@ -30,6 +30,8 @@
#include "../../core/wee-string.h"
#include "../../core/wee-utf8.h"
#include "../gui-nicklist.h"
+#include "../gui-chat.h"
+#include "../gui-color.h"
#include "../gui-main.h"
#include "../gui-window.h"
#include "gui-curses.h"
@@ -91,39 +93,39 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
}
}
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
+ if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) ||
+ (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM))
max_chars = max_length;
else
- max_chars = ((cfg_look_nicklist_min_size > 0)
- && (max_length < cfg_look_nicklist_min_size)) ?
- cfg_look_nicklist_min_size :
- (((cfg_look_nicklist_max_size > 0)
- && (max_length > cfg_look_nicklist_max_size)) ?
- cfg_look_nicklist_max_size : max_length);
+ max_chars = ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0)
+ && (max_length < CONFIG_INTEGER(config_look_nicklist_min_size))) ?
+ CONFIG_INTEGER(config_look_nicklist_min_size) :
+ (((CONFIG_INTEGER(config_look_nicklist_max_size) > 0)
+ && (max_length > CONFIG_INTEGER(config_look_nicklist_max_size))) ?
+ CONFIG_INTEGER(config_look_nicklist_max_size) : max_length);
- if (cfg_look_nicklist_separator && has_colors ())
+ if (CONFIG_BOOLEAN(config_look_nicklist_separator) && has_colors ())
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick,
GUI_COLOR_NICKLIST_SEPARATOR);
- switch (cfg_look_nicklist_position)
+ switch (CONFIG_INTEGER(config_look_nicklist_position))
{
- case CFG_LOOK_NICKLIST_LEFT:
+ case CONFIG_LOOK_NICKLIST_LEFT:
mvwvline (GUI_CURSES(ptr_win)->win_nick,
0, ptr_win->win_nick_width - 1, ACS_VLINE,
ptr_win->win_chat_height);
break;
- case CFG_LOOK_NICKLIST_RIGHT:
+ case CONFIG_LOOK_NICKLIST_RIGHT:
mvwvline (GUI_CURSES(ptr_win)->win_nick,
0, 0, ACS_VLINE,
ptr_win->win_chat_height);
break;
- case CFG_LOOK_NICKLIST_TOP:
+ case CONFIG_LOOK_NICKLIST_TOP:
mvwhline (GUI_CURSES(ptr_win)->win_nick,
ptr_win->win_nick_height - 1, 0, ACS_HLINE,
ptr_win->win_chat_width);
break;
- case CFG_LOOK_NICKLIST_BOTTOM:
+ case CONFIG_LOOK_NICKLIST_BOTTOM:
mvwhline (GUI_CURSES(ptr_win)->win_nick,
0, 0, ACS_HLINE,
ptr_win->win_chat_width);
@@ -134,30 +136,31 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick,
GUI_COLOR_NICKLIST);
x = 0;
- y = (cfg_look_nicklist_separator
- && (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM)) ?
+ y = (CONFIG_BOOLEAN(config_look_nicklist_separator)
+ && (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) ?
1 : 0;
max_y = 0;
- switch (cfg_look_nicklist_position)
+ switch (CONFIG_INTEGER(config_look_nicklist_position))
{
- case CFG_LOOK_NICKLIST_LEFT:
- case CFG_LOOK_NICKLIST_RIGHT:
+ case CONFIG_LOOK_NICKLIST_LEFT:
+ case CONFIG_LOOK_NICKLIST_RIGHT:
max_y = 0;
break;
- case CFG_LOOK_NICKLIST_TOP:
+ case CONFIG_LOOK_NICKLIST_TOP:
max_y = ptr_win->win_nick_height -
- cfg_look_nicklist_separator;
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
break;
- case CFG_LOOK_NICKLIST_BOTTOM:
+ case CONFIG_LOOK_NICKLIST_BOTTOM:
max_y = ptr_win->win_nick_height;
break;
}
column = 0;
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
+ if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) ||
+ (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM))
nicks_displayed = (ptr_win->win_width / (max_length + 2)) *
- (ptr_win->win_nick_height - cfg_look_nicklist_separator);
+ (ptr_win->win_nick_height -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0));
else
nicks_displayed = ptr_win->win_nick_height;
@@ -172,16 +175,16 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
{
for (i = 0; i < nicks_displayed; i++)
{
- switch (cfg_look_nicklist_position)
+ switch (CONFIG_INTEGER(config_look_nicklist_position))
{
- case CFG_LOOK_NICKLIST_LEFT:
+ case CONFIG_LOOK_NICKLIST_LEFT:
x = 0;
break;
- case CFG_LOOK_NICKLIST_RIGHT:
- x = cfg_look_nicklist_separator;
+ case CONFIG_LOOK_NICKLIST_RIGHT:
+ x = (CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0;
break;
- case CFG_LOOK_NICKLIST_TOP:
- case CFG_LOOK_NICKLIST_BOTTOM:
+ case CONFIG_LOOK_NICKLIST_TOP:
+ case CONFIG_LOOK_NICKLIST_BOTTOM:
x = column;
break;
}
@@ -253,7 +256,7 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
x++;
}
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick,
- ((cfg_irc_away_check > 0) && (ptr_nick->flags & IRC_NICK_AWAY)) ?
+ ((config_irc_away_check > 0) && (ptr_nick->flags & IRC_NICK_AWAY)) ?
GUI_COLOR_WIN_NICK_AWAY : GUI_COLOR_WIN_NICK);*/
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick,
@@ -291,14 +294,14 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
break;
}
y++;
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
+ if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) ||
+ (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM))
{
if (y >= max_y)
{
column += max_length + 2;
- y = (cfg_look_nicklist_separator
- && (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM)) ?
+ y = (CONFIG_BOOLEAN(config_look_nicklist_separator)
+ && (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) ?
1 : 0;
}
}
diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c
index 6b975edda..9ced1e317 100644
--- a/src/gui/curses/gui-curses-status.c
+++ b/src/gui/curses/gui-curses-status.c
@@ -30,6 +30,7 @@
#include "../../core/wee-config.h"
#include "../../core/wee-utf8.h"
#include "../gui-status.h"
+#include "../gui-color.h"
#include "../gui-main.h"
#include "../gui-hotlist.h"
#include "../gui-window.h"
@@ -121,22 +122,22 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
case GUI_HOTLIST_LOW:
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS_DATA_OTHER);
- display_name = ((cfg_look_hotlist_names_level & 1) != 0);
+ display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 1) != 0);
break;
case GUI_HOTLIST_MSG:
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS_DATA_MSG);
- display_name = ((cfg_look_hotlist_names_level & 2) != 0);
+ display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 2) != 0);
break;
case GUI_HOTLIST_PRIVATE:
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS_DATA_PRIVATE);
- display_name = ((cfg_look_hotlist_names_level & 4) != 0);
+ display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 4) != 0);
break;
case GUI_HOTLIST_HIGHLIGHT:
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS_DATA_HIGHLIGHT);
- display_name = ((cfg_look_hotlist_names_level & 8) != 0);
+ display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 8) != 0);
break;
default:
display_name = 0;
@@ -146,8 +147,9 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
wprintw (GUI_CURSES(ptr_win)->win_status, "%d",
ptr_hotlist->buffer->number);
- if (display_name && (cfg_look_hotlist_names_count != 0)
- && (names_count < cfg_look_hotlist_names_count))
+ if (display_name
+ && (CONFIG_INTEGER(config_look_hotlist_names_count) != 0)
+ && (names_count < CONFIG_INTEGER(config_look_hotlist_names_count)))
{
names_count++;
@@ -157,12 +159,12 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS);
- if (cfg_look_hotlist_names_length == 0)
+ if (CONFIG_INTEGER(config_look_hotlist_names_length) == 0)
snprintf (format, sizeof (format) - 1, "%%s");
else
snprintf (format, sizeof (format) - 1,
"%%.%ds",
- cfg_look_hotlist_names_length);
+ CONFIG_INTEGER(config_look_hotlist_names_length));
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
format,
ptr_hotlist->buffer->name);
@@ -179,7 +181,7 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
/* display lag */
/*if (GUI_SERVER(ptr_win->buffer))
{
- if (GUI_SERVER(ptr_win->buffer)->lag / 1000 >= cfg_irc_lag_min_show)
+ if (GUI_SERVER(ptr_win->buffer)->lag / 1000 >= config_irc_lag_min_show)
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
GUI_COLOR_STATUS_DELIMITERS);
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index a2619a652..004a0ef7e 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -34,6 +34,8 @@
#include "../../core/wee-log.h"
#include "../../core/wee-string.h"
#include "../gui-window.h"
+#include "../gui-chat.h"
+#include "../gui-color.h"
#include "../gui-hotlist.h"
#include "../gui-infobar.h"
#include "../gui-input.h"
@@ -206,18 +208,18 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
lines = 0;
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_LEFT) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT))
+ if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_LEFT) ||
+ (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_RIGHT))
{
- if ((cfg_look_nicklist_min_size > 0)
- && (max_length < cfg_look_nicklist_min_size))
- max_length = cfg_look_nicklist_min_size;
- else if ((cfg_look_nicklist_max_size > 0)
- && (max_length > cfg_look_nicklist_max_size))
- max_length = cfg_look_nicklist_max_size;
+ if ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0)
+ && (max_length < CONFIG_INTEGER(config_look_nicklist_min_size)))
+ max_length = CONFIG_INTEGER(config_look_nicklist_min_size);
+ else if ((CONFIG_INTEGER(config_look_nicklist_max_size) > 0)
+ && (max_length > CONFIG_INTEGER(config_look_nicklist_max_size)))
+ max_length = CONFIG_INTEGER(config_look_nicklist_max_size);
if (!force_calculate
&& (window->win_nick_width ==
- max_length + 1 + cfg_look_nicklist_separator))
+ max_length + 1 + ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0)))
return 0;
}
else
@@ -227,33 +229,36 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
lines = ((max_length + 2) * window->buffer->nicks_count) / width_used;
else
lines = (((max_length + 2) * window->buffer->nicks_count) / width_used) + 1;
- if ((cfg_look_nicklist_max_size > 0)
- && (lines > cfg_look_nicklist_max_size))
- lines = cfg_look_nicklist_max_size;
- if ((cfg_look_nicklist_min_size > 0)
- && (lines < cfg_look_nicklist_min_size))
- lines = cfg_look_nicklist_min_size;
- max_height = (cfg_look_infobar) ?
+ if ((CONFIG_INTEGER(config_look_nicklist_max_size) > 0)
+ && (lines > CONFIG_INTEGER(config_look_nicklist_max_size)))
+ lines = CONFIG_INTEGER(config_look_nicklist_max_size);
+ if ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0)
+ && (lines < CONFIG_INTEGER(config_look_nicklist_min_size)))
+ lines = CONFIG_INTEGER(config_look_nicklist_min_size);
+ max_height = (CONFIG_BOOLEAN(config_look_infobar)) ?
window->win_height - 3 - 4 :
window->win_height - 2 - 4;
if (lines > max_height)
lines = max_height;
if (!force_calculate
&& (window->win_nick_height ==
- lines + cfg_look_nicklist_separator))
+ lines + ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0)))
return 0;
}
- switch (cfg_look_nicklist_position)
+ switch (CONFIG_INTEGER(config_look_nicklist_position))
{
- case CFG_LOOK_NICKLIST_LEFT:
- window->win_chat_x = window->win_x + max_length + 1 + cfg_look_nicklist_separator;
+ case CONFIG_LOOK_NICKLIST_LEFT:
+ window->win_chat_x = window->win_x + max_length + 1 +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_chat_y = window->win_y + 1;
- window->win_chat_width = window->win_width - max_length - 1 - cfg_look_nicklist_separator;
+ window->win_chat_width = window->win_width - max_length - 1 -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_x = window->win_x + 0;
window->win_nick_y = window->win_y + 1;
- window->win_nick_width = max_length + 1 + cfg_look_nicklist_separator;
- if (cfg_look_infobar)
+ window->win_nick_width = max_length + 1 +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
+ if (CONFIG_BOOLEAN(config_look_infobar))
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
@@ -265,14 +270,18 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
}
window->win_nick_num_max = window->win_nick_height;
break;
- case CFG_LOOK_NICKLIST_RIGHT:
+ case CONFIG_LOOK_NICKLIST_RIGHT:
window->win_chat_x = window->win_x;
window->win_chat_y = window->win_y + 1;
- window->win_chat_width = window->win_width - max_length - 1 - cfg_look_nicklist_separator;
- window->win_nick_x = window->win_x + window->win_width - max_length - 1 - cfg_look_nicklist_separator;
+ window->win_chat_width = window->win_width - max_length - 1 -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
+ window->win_nick_x = window->win_x + window->win_width -
+ max_length - 1 -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_y = window->win_y + 1;
- window->win_nick_width = max_length + 1 + cfg_look_nicklist_separator;
- if (cfg_look_infobar)
+ window->win_nick_width = max_length + 1 +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
+ if (CONFIG_BOOLEAN(config_look_infobar))
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
@@ -284,35 +293,46 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
}
window->win_nick_num_max = window->win_nick_height;
break;
- case CFG_LOOK_NICKLIST_TOP:
+ case CONFIG_LOOK_NICKLIST_TOP:
window->win_chat_x = window->win_x;
- window->win_chat_y = window->win_y + 1 + lines + cfg_look_nicklist_separator;
+ window->win_chat_y = window->win_y + 1 + lines +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_chat_width = window->win_width;
- if (cfg_look_infobar)
- window->win_chat_height = window->win_height - 3 - lines - cfg_look_nicklist_separator - 1;
+ if (CONFIG_BOOLEAN(config_look_infobar))
+ window->win_chat_height = window->win_height - 3 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0) - 1;
else
- window->win_chat_height = window->win_height - 3 - lines - cfg_look_nicklist_separator;
+ window->win_chat_height = window->win_height - 3 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_x = window->win_x;
window->win_nick_y = window->win_y + 1;
window->win_nick_width = window->win_width;
- window->win_nick_height = lines + cfg_look_nicklist_separator;
+ window->win_nick_height = lines +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
- case CFG_LOOK_NICKLIST_BOTTOM:
+ case CONFIG_LOOK_NICKLIST_BOTTOM:
window->win_chat_x = window->win_x;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width;
- if (cfg_look_infobar)
- window->win_chat_height = window->win_height - 3 - lines - cfg_look_nicklist_separator - 1;
+ if (CONFIG_BOOLEAN(config_look_infobar))
+ window->win_chat_height = window->win_height - 3 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0) - 1;
else
- window->win_chat_height = window->win_height - 3 - lines - cfg_look_nicklist_separator;
+ window->win_chat_height = window->win_height - 3 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_x = window->win_x;
- if (cfg_look_infobar)
- window->win_nick_y = window->win_y + window->win_height - 2 - lines - cfg_look_nicklist_separator - 1;
+ if (CONFIG_BOOLEAN(config_look_infobar))
+ window->win_nick_y = window->win_y + window->win_height -
+ 2 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0) - 1;
else
- window->win_nick_y = window->win_y + window->win_height - 2 - lines - cfg_look_nicklist_separator;
+ window->win_nick_y = window->win_y + window->win_height -
+ 2 - lines -
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_width = window->win_width;
- window->win_nick_height = lines + cfg_look_nicklist_separator;
+ window->win_nick_height = lines +
+ ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0);
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
}
@@ -325,7 +345,7 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
window->win_chat_x = window->win_x;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width;
- if (cfg_look_infobar)
+ if (CONFIG_BOOLEAN(config_look_infobar))
window->win_chat_height = window->win_height - 4;
else
window->win_chat_height = window->win_height - 3;
@@ -346,7 +366,7 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
/* status window */
window->win_status_x = window->win_x;
- if (cfg_look_infobar)
+ if (CONFIG_BOOLEAN(config_look_infobar))
window->win_status_y = window->win_y + window->win_height - 3;
else
window->win_status_y = window->win_y + window->win_height - 2;
@@ -354,7 +374,7 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate)
window->win_status_height = 1;
/* infobar window */
- if (cfg_look_infobar)
+ if (CONFIG_BOOLEAN(config_look_infobar))
{
window->win_infobar_x = window->win_x;
window->win_infobar_y = window->win_y + window->win_height - 2;
@@ -424,7 +444,7 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer)
if (GUI_CURSES(ptr_win)->win_nick)
gui_nicklist_draw (buffer, 1);
gui_status_draw (buffer, 1);
- if (cfg_look_infobar)
+ if (CONFIG_BOOLEAN(config_look_infobar))
gui_infobar_draw (buffer, 1);
gui_input_draw (buffer, 1);
}
@@ -494,7 +514,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
window->win_chat_width,
window->win_chat_y,
window->win_chat_x);
- if (cfg_look_nicklist)
+ if (CONFIG_BOOLEAN(config_look_nicklist))
GUI_CURSES(window)->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
@@ -513,7 +533,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
}
/* create status/infobar windows */
- if (cfg_look_infobar)
+ if (CONFIG_BOOLEAN(config_look_infobar))
GUI_CURSES(window)->win_infobar = newwin (window->win_infobar_height,
window->win_infobar_width,
window->win_infobar_y,
@@ -616,8 +636,9 @@ gui_window_scroll_up (struct t_gui_window *window)
gui_chat_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
(window->start_line) ?
- (-1) * cfg_look_scroll_amount :
- (-1) * ( (window->win_chat_height - 1) + cfg_look_scroll_amount));
+ (-1) * CONFIG_INTEGER(config_look_scroll_amount) :
+ (-1) * ( (window->win_chat_height - 1) +
+ CONFIG_INTEGER(config_look_scroll_amount)));
gui_chat_draw (window->buffer, 0);
if (!window->scroll)
{
@@ -645,7 +666,7 @@ gui_window_scroll_down (struct t_gui_window *window)
{
gui_chat_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
- cfg_look_scroll_amount);
+ CONFIG_INTEGER(config_look_scroll_amount));
/* check if we can display all */
ptr_line = window->start_line;
diff --git a/src/gui/gtk/gui-gtk-chat.c b/src/gui/gtk/gui-gtk-chat.c
index c3f6f409f..97a11ddb8 100644
--- a/src/gui/gtk/gui-gtk-chat.c
+++ b/src/gui/gtk/gui-gtk-chat.c
@@ -31,6 +31,7 @@
#include "../../core/wee-config.h"
#include "../../core/wee-utf8.h"
#include "../gui-chat.h"
+#include "../gui-color.h"
#include "../gui-main.h"
#include "../gui-window.h"
#include "gui-gtk.h"
diff --git a/src/gui/gtk/gui-gtk-color.c b/src/gui/gtk/gui-gtk-color.c
index 3107ae391..e4a52b214 100644
--- a/src/gui/gtk/gui-gtk-color.c
+++ b/src/gui/gtk/gui-gtk-color.c
@@ -31,6 +31,7 @@
#include "../../core/wee-config.h"
#include "../../core/wee-string.h"
#include "../gui-color.h"
+#include "../gui-chat.h"
#include "gui-gtk.h"
diff --git a/src/gui/gtk/gui-gtk-infobar.c b/src/gui/gtk/gui-gtk-infobar.c
index f546cbf97..b6bcafd33 100644
--- a/src/gui/gtk/gui-gtk-infobar.c
+++ b/src/gui/gtk/gui-gtk-infobar.c
@@ -29,7 +29,7 @@
#include "../../core/weechat.h"
#include "../../core/wee-config.h"
#include "../gui-infobar.h"
-#include "../gui-main.h"
+#include "../gui-window.h"
#include "gui-gtk.h"
diff --git a/src/gui/gtk/gui-gtk-input.c b/src/gui/gtk/gui-gtk-input.c
index 35111c01c..16347735b 100644
--- a/src/gui/gtk/gui-gtk-input.c
+++ b/src/gui/gtk/gui-gtk-input.c
@@ -30,7 +30,7 @@
#include "../../core/wee-utf8.h"
#include "../../plugins/plugin.h"
#include "../gui-input.h"
-#include "../gui-main.h"
+#include "../gui-window.h"
#include "gui-gtk.h"
diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c
index 46fd7380c..33d1fc9b2 100644
--- a/src/gui/gtk/gui-gtk-main.c
+++ b/src/gui/gtk/gui-gtk-main.c
@@ -174,7 +174,7 @@ gui_main_init ()
else
gui_init_ok = 0;
- if (cfg_look_set_title)
+ if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_set ();
}
}
@@ -226,6 +226,6 @@ gui_main_end ()
gui_infobar_remove ();
/* reset title */
- if (cfg_look_set_title)
+ if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
}
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index e6f00e873..73c310bf8 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -30,6 +30,7 @@
#include "../../core/wee-config.h"
#include "../../core/wee-log.h"
#include "../gui-window.h"
+#include "../gui-chat.h"
#include "../gui-hotlist.h"
#include "../gui-nicklist.h"
#include "../gui-main.h"
@@ -300,8 +301,9 @@ gui_window_scroll_up (struct t_gui_window *window)
gui_chat_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
(window->start_line) ?
- (-1) * cfg_look_scroll_amount :
- (-1) * ( (window->win_chat_height - 1) + cfg_look_scroll_amount));
+ (-1) * CONFIG_INTEGER(config_look_scroll_amount) :
+ (-1) * ( (window->win_chat_height - 1) +
+ CONFIG_INTEGER(config_look_scroll_amount)));
gui_chat_draw (window->buffer, 0);
gui_status_draw (window->buffer, 0);
}
@@ -324,7 +326,7 @@ gui_window_scroll_down (struct t_gui_window *window)
{
gui_chat_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
- cfg_look_scroll_amount);
+ CONFIG_INTEGER(config_look_scroll_amount));
/* check if we can display all */
ptr_line = window->start_line;
diff --git a/src/gui/gui-action.c b/src/gui/gui-action.c
index 55b45e44a..55324c507 100644
--- a/src/gui/gui-action.c
+++ b/src/gui/gui-action.c
@@ -39,6 +39,7 @@
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
#include "gui-buffer.h"
+#include "gui-chat.h"
#include "gui-completion.h"
#include "gui-history.h"
#include "gui-hotlist.h"
@@ -1387,8 +1388,8 @@ gui_action_scroll_unread (char *args)
if (gui_current_window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
{
- if (cfg_look_read_marker &&
- cfg_look_read_marker[0] &&
+ if (CONFIG_STRING(config_look_read_marker) &&
+ CONFIG_STRING(config_look_read_marker)[0] &&
(gui_current_window->buffer->type == GUI_BUFFER_TYPE_FORMATED) &&
gui_current_window->buffer->last_read_line &&
gui_current_window->buffer->last_read_line != gui_current_window->buffer->last_line)
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index f4719d572..0f2abb410 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -33,6 +33,9 @@
#include <ctype.h>
#include "../core/weechat.h"
+#include "gui-buffer.h"
+#include "gui-chat.h"
+#include "gui-color.h"
#include "gui-completion.h"
#include "gui-history.h"
#include "gui-hotlist.h"
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 3c4ee4099..911946c90 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -35,6 +35,7 @@
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
#include "gui-chat.h"
+#include "gui-color.h"
#include "gui-hotlist.h"
#include "gui-main.h"
#include "gui-status.h"
@@ -56,32 +57,32 @@ gui_chat_prefix_build ()
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_INFO),
- cfg_look_prefix[GUI_CHAT_PREFIX_INFO]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_INFO]));
gui_chat_prefix[GUI_CHAT_PREFIX_INFO] = strdup (prefix);
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ERROR),
- cfg_look_prefix[GUI_CHAT_PREFIX_ERROR]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ERROR]));
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR] = strdup (prefix);
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_NETWORK),
- cfg_look_prefix[GUI_CHAT_PREFIX_NETWORK]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_NETWORK]));
gui_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = strdup (prefix);
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ACTION),
- cfg_look_prefix[GUI_CHAT_PREFIX_ACTION]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ACTION]));
gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = strdup (prefix);
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_JOIN),
- cfg_look_prefix[GUI_CHAT_PREFIX_JOIN]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_JOIN]));
gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = strdup (prefix);
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_QUIT),
- cfg_look_prefix[GUI_CHAT_PREFIX_QUIT]);
+ CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_QUIT]));
gui_chat_prefix[GUI_CHAT_PREFIX_QUIT] = strdup (prefix);
}
@@ -210,13 +211,14 @@ gui_chat_get_time_string (time_t date)
int i, time_first_digit, time_last_digit, last_color;
struct tm *local_time;
- if (!cfg_look_buffer_time_format
- || !cfg_look_buffer_time_format[0])
+ if (!CONFIG_STRING(config_look_buffer_time_format)
+ || !CONFIG_STRING(config_look_buffer_time_format)[0])
return NULL;
local_time = localtime (&date);
if (strftime (text_time, sizeof (text_time),
- cfg_look_buffer_time_format, local_time) == 0)
+ CONFIG_STRING(config_look_buffer_time_format),
+ local_time) == 0)
return NULL;
time_first_digit = -1;
@@ -325,17 +327,18 @@ gui_chat_get_line_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
{
int length_suffix;
- if (cfg_look_prefix_align == CFG_LOOK_PREFIX_ALIGN_NONE)
+ if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE)
return gui_chat_time_length + 1 + line->prefix_length + 2;
length_suffix = 0;
if (with_suffix)
{
- if (cfg_look_prefix_suffix && cfg_look_prefix_suffix[0])
- length_suffix = gui_chat_strlen_screen (cfg_look_prefix_suffix) + 1;
+ if (CONFIG_STRING(config_look_prefix_suffix)
+ && CONFIG_STRING(config_look_prefix_suffix)[0])
+ length_suffix = gui_chat_strlen_screen (CONFIG_STRING(config_look_prefix_suffix)) + 1;
}
- if (cfg_look_prefix_align_max > 0)
- return gui_chat_time_length + 1 + cfg_look_prefix_align_max +
+ if (CONFIG_INTEGER(config_look_prefix_align_max) > 0)
+ return gui_chat_time_length + 1 + CONFIG_INTEGER(config_look_prefix_align_max) +
length_suffix + 1;
else
return gui_chat_time_length + 1 + buffer->prefix_max_length +
@@ -434,8 +437,8 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
buffer->lines_count++;
/* remove one line if necessary */
- if ((cfg_history_max_lines > 0)
- && (buffer->lines_count > cfg_history_max_lines))
+ if ((CONFIG_INTEGER(config_history_max_lines) > 0)
+ && (buffer->lines_count > CONFIG_INTEGER(config_history_max_lines)))
{
if (buffer->last_line == buffer->lines)
buffer->last_line = NULL;
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index ad391c0e3..09fa063e7 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -47,16 +47,20 @@
int
gui_color_search_config (char *color_name)
{
- int i;
+ struct t_config_section *ptr_section;
+ struct t_config_option *ptr_option;
if (color_name)
{
- i = 0;
- while (weechat_options_colors[i].name)
+ ptr_section = config_file_search_section (weechat_config, "colors");
+ if (ptr_section)
{
- if (string_strcasecmp (weechat_options_colors[i].name, color_name) == 0)
- return weechat_options_colors[i].default_int;
- i++;
+ for (ptr_option = ptr_section->options; ptr_option;
+ ptr_option = ptr_option->next_option)
+ {
+ if (string_strcasecmp (ptr_option->name, color_name) == 0)
+ return ptr_option->min;
+ }
}
}
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 44e56832a..f7869e34e 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -42,6 +42,7 @@
#include "../plugins/plugin.h"
#include "../plugins/plugin-config.h"
#include "gui-completion.h"
+#include "gui-color.h"
#include "gui-keyboard.h"
@@ -203,7 +204,8 @@ gui_completion_is_only_alphanum (char *string)
{
while (string[0])
{
- if (strchr (cfg_look_nick_completion_ignore, string[0]))
+ if (strchr (CONFIG_STRING(config_look_nick_completion_ignore),
+ string[0]))
return 0;
string++;
}
@@ -223,7 +225,8 @@ gui_completion_strdup_alphanum (char *string)
pos = result;
while (string[0])
{
- if (!strchr (cfg_look_nick_completion_ignore, string[0]))
+ if (!strchr (CONFIG_STRING(config_look_nick_completion_ignore),
+ string[0]))
{
pos[0] = string[0];
pos++;
@@ -245,8 +248,8 @@ gui_completion_nickncmp (char *base_word, char *nick, int max)
char *base_word2, *nick2;
int return_cmp;
- if (!cfg_look_nick_completion_ignore
- || !cfg_look_nick_completion_ignore[0]
+ if (!CONFIG_STRING(config_look_nick_completion_ignore)
+ || !CONFIG_STRING(config_look_nick_completion_ignore)[0]
|| !base_word || !nick || !base_word[0] || !nick[0]
|| (!gui_completion_is_only_alphanum (base_word)))
return string_strncasecmp (base_word, nick, max);
@@ -600,7 +603,7 @@ gui_completion_list_add_channel_nicks (struct t_gui_completion *completion)
}
// add nicks speaking recently on this channel
- if (cfg_look_nick_completion_smart)
+ if (CONFIG_BOOLEAN(config_look_nick_completion_smart))
{
for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking;
ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
@@ -684,19 +687,18 @@ gui_completion_list_add_channel_nicks_hosts (struct t_gui_completion *completion
void
gui_completion_list_add_option (struct t_gui_completion *completion)
{
- int i, j;
-
- /* WeeChat options */
- for (i = 0; weechat_config_sections[i]; i++)
+ struct t_config_section *ptr_section;
+ struct t_config_option *ptr_option;
+
+ for (ptr_section = weechat_config->sections; ptr_section;
+ ptr_section = ptr_section->next_section)
{
- if (weechat_config_options[i])
+ for (ptr_option = ptr_section->options; ptr_option;
+ ptr_option = ptr_option->next_option)
{
- for (j = 0; weechat_config_options[i][j].name; j++)
- {
- gui_completion_list_add (completion,
- weechat_config_options[i][j].name,
- 0, WEELIST_POS_SORT);
- }
+ gui_completion_list_add (completion,
+ ptr_option->name,
+ 0, WEELIST_POS_SORT);
}
}
}
@@ -708,12 +710,13 @@ gui_completion_list_add_option (struct t_gui_completion *completion)
void
gui_completion_list_add_plugin_option (struct t_gui_completion *completion)
{
- struct t_plugin_option *ptr_option;
+ struct t_config_option *ptr_option;
for (ptr_option = plugin_options; ptr_option;
ptr_option = ptr_option->next_option)
{
- gui_completion_list_add (completion, ptr_option->name, 0, WEELIST_POS_SORT);
+ gui_completion_list_add (completion, ptr_option->name,
+ 0, WEELIST_POS_SORT);
}
}
@@ -725,8 +728,8 @@ void
gui_completion_list_add_part (struct t_gui_completion *completion)
{
(void) completion;
- /*if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
- gui_completion_list_add (completion, cfg_irc_default_msg_part,
+ /*if (config_irc_default_msg_part && config_irc_default_msg_part[0])
+ gui_completion_list_add (completion, config_irc_default_msg_part,
0, WEELIST_POS_SORT);*/
}
@@ -755,8 +758,8 @@ void
gui_completion_list_add_quit (struct t_gui_completion *completion)
{
(void) completion;
- /*if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
- gui_completion_list_add (completion, cfg_irc_default_msg_quit,
+ /*if (config_irc_default_msg_quit && config_irc_default_msg_quit[0])
+ gui_completion_list_add (completion, config_irc_default_msg_quit,
0, WEELIST_POS_SORT);*/
}
@@ -806,7 +809,7 @@ gui_completion_list_add_topic (struct t_gui_completion *completion)
&& ((t_irc_channel *)(completion->channel))->topic
&& ((t_irc_channel *)(completion->channel))->topic[0])
{
- if (cfg_irc_colors_send)
+ if (config_irc_colors_send)
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
else
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0, 0);
@@ -826,65 +829,54 @@ gui_completion_list_add_topic (struct t_gui_completion *completion)
void
gui_completion_list_add_option_value (struct t_gui_completion *completion)
{
- char *pos;
- struct t_config_option *option;
- void *option_value;
- char option_string[2048];
+ char *pos, *color_name, option_string[2048];
+ struct t_config_option *ptr_option;
if (completion->args)
{
pos = strchr (completion->args, ' ');
if (pos)
pos[0] = '\0';
- option = NULL;
- option_value = NULL;
- //config_option_search_option_value (completion->args, &option, &option_value);
- config_option_section_option_search_get_value (weechat_config_sections,
- weechat_config_options,
- completion->args,
- &option,
- &option_value);
- if (option && option_value)
+ ptr_option = config_file_search_option (weechat_config,
+ NULL,
+ completion->args);
+ if (ptr_option)
{
- switch (option->type)
+ switch (ptr_option->type)
{
- case OPTION_TYPE_BOOLEAN:
- if (option_value && (*((int *)(option_value))))
+ case CONFIG_OPTION_BOOLEAN:
+ if (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE)
gui_completion_list_add (completion, "on",
0, WEELIST_POS_SORT);
else
gui_completion_list_add (completion, "off",
0, WEELIST_POS_SORT);
break;
- case OPTION_TYPE_INT:
- snprintf (option_string, sizeof (option_string) - 1,
- "%d", (option_value) ? *((int *)(option_value)) : option->default_int);
+ case CONFIG_OPTION_INTEGER:
+ if (ptr_option->string_values)
+ snprintf (option_string, sizeof (option_string) - 1,
+ "%s",
+ ptr_option->string_values[CONFIG_INTEGER(ptr_option)]);
+ else
+ snprintf (option_string, sizeof (option_string) - 1,
+ "%d", CONFIG_INTEGER(ptr_option));
gui_completion_list_add (completion, option_string,
0, WEELIST_POS_SORT);
break;
- case OPTION_TYPE_INT_WITH_STRING:
- gui_completion_list_add (completion,
- (option_value) ?
- option->array_values[*((int *)(option_value))] :
- option->array_values[option->default_int],
- 0, WEELIST_POS_SORT);
- break;
- case OPTION_TYPE_COLOR:
- gui_completion_list_add (completion,
- (option_value) ?
- gui_color_get_name (*((int *)(option_value))) :
- option->default_string,
- 0, WEELIST_POS_SORT);
- break;
- case OPTION_TYPE_STRING:
+ case CONFIG_OPTION_STRING:
snprintf (option_string, sizeof (option_string) - 1,
"\"%s\"",
- ((option_value) && (*((char **)(option_value)))) ?
- *((char **)(option_value)) :
- option->default_string);
+ CONFIG_STRING(ptr_option));
gui_completion_list_add (completion, option_string,
0, WEELIST_POS_SORT);
break;
+ case CONFIG_OPTION_COLOR:
+ color_name = gui_color_get_name (CONFIG_INTEGER(ptr_option));
+ if (color_name)
+ gui_completion_list_add (completion,
+ color_name,
+ 0, WEELIST_POS_SORT);
+ break;
}
}
if (pos)
@@ -900,7 +892,7 @@ void
gui_completion_list_add_plugin_option_value (struct t_gui_completion *completion)
{
char *pos;
- struct t_plugin_option *ptr_option;
+ struct t_config_option *ptr_option;
if (completion->args)
{
@@ -1443,7 +1435,7 @@ gui_completion_nick (struct t_gui_completion *completion)
}
// add nicks speaking recently on this channel
- if (cfg_look_nick_completion_smart)
+ if (CONFIG_BOOLEAN(config_look_nick_completion_smart))
{
for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking;
ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
@@ -1485,7 +1477,7 @@ gui_completion_nick (struct t_gui_completion *completion)
if (completion->word_found)
free (completion->word_found);
completion->word_found = strdup (ptr_weelist->data);
- if (cfg_look_nick_complete_first)
+ if (CONFIG_BOOLEAN(config_look_nick_complete_first))
{
completion->position = -1;
return;
diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c
index 3ce9f0022..216ee7e6b 100644
--- a/src/gui/gui-history.c
+++ b/src/gui/gui-history.c
@@ -30,6 +30,7 @@
#include "../core/wee-config.h"
#include "../core/wee-string.h"
#include "gui-history.h"
+#include "gui-buffer.h"
struct t_gui_history *history_global = NULL;
@@ -43,46 +44,50 @@ int num_history_global = 0;
*/
void
-gui_history_buffer_add (struct t_gui_buffer *buffer, char *string)
+gui_history_buffer_add (void *buffer, char *string)
{
+ struct t_gui_buffer *ptr_buffer;
struct t_gui_history *new_history, *ptr_history;
+ ptr_buffer = (struct t_gui_buffer *)buffer;
+
if (!string)
return;
- if (!buffer->history
- || (buffer->history
- && (string_strcasecmp (buffer->history->text, string) != 0)))
+ if (!ptr_buffer->history
+ || (ptr_buffer->history
+ && (string_strcasecmp (ptr_buffer->history->text,
+ string) != 0)))
{
new_history = (struct t_gui_history *)malloc (sizeof (struct t_gui_history));
if (new_history)
{
new_history->text = strdup (string);
- /*if (cfg_log_hide_nickserv_pwd)
+ /*if (config_log_hide_nickserv_pwd)
irc_display_hide_password (new_history->text, 1);*/
- if (buffer->history)
- buffer->history->prev_history = new_history;
+ if (ptr_buffer->history)
+ ptr_buffer->history->prev_history = new_history;
else
- buffer->last_history = new_history;
- new_history->next_history = buffer->history;
+ ptr_buffer->last_history = new_history;
+ new_history->next_history = ptr_buffer->history;
new_history->prev_history = NULL;
- buffer->history = new_history;
- buffer->num_history++;
+ ptr_buffer->history = new_history;
+ ptr_buffer->num_history++;
/* remove one command if necessary */
- if ((cfg_history_max_commands > 0)
- && (buffer->num_history > cfg_history_max_commands))
+ if ((CONFIG_INTEGER(config_history_max_commands) > 0)
+ && (ptr_buffer->num_history > CONFIG_INTEGER(config_history_max_commands)))
{
- ptr_history = buffer->last_history->prev_history;
- if (buffer->ptr_history == buffer->last_history)
- buffer->ptr_history = ptr_history;
- buffer->last_history->prev_history->next_history = NULL;
- if (buffer->last_history->text)
- free (buffer->last_history->text);
- free (buffer->last_history);
- buffer->last_history = ptr_history;
- buffer->num_history++;
+ ptr_history = ptr_buffer->last_history->prev_history;
+ if (ptr_buffer->ptr_history == ptr_buffer->last_history)
+ ptr_buffer->ptr_history = ptr_history;
+ ptr_buffer->last_history->prev_history->next_history = NULL;
+ if (ptr_buffer->last_history->text)
+ free (ptr_buffer->last_history->text);
+ free (ptr_buffer->last_history);
+ ptr_buffer->last_history = ptr_history;
+ ptr_buffer->num_history++;
}
}
}
@@ -108,7 +113,7 @@ gui_history_global_add (char *string)
if (new_history)
{
new_history->text = strdup (string);
- /*if (cfg_log_hide_nickserv_pwd)
+ /*if (config_log_hide_nickserv_pwd)
irc_display_hide_password (new_history->text, 1);*/
if (history_global)
@@ -121,8 +126,8 @@ gui_history_global_add (char *string)
num_history_global++;
/* remove one command if necessary */
- if ((cfg_history_max_commands > 0)
- && (num_history_global > cfg_history_max_commands))
+ if ((CONFIG_INTEGER(config_history_max_commands) > 0)
+ && (num_history_global > CONFIG_INTEGER(config_history_max_commands)))
{
ptr_history = history_global_last->prev_history;
if (history_global_ptr == history_global_last)
@@ -167,20 +172,23 @@ gui_history_global_free ()
*/
void
-gui_history_buffer_free (struct t_gui_buffer *buffer)
+gui_history_buffer_free (void *buffer)
{
+ struct t_gui_buffer *ptr_buffer;
struct t_gui_history *ptr_history;
- while (buffer->history)
+ ptr_buffer = (struct t_gui_buffer *)buffer;
+
+ while (ptr_buffer->history)
{
- ptr_history = buffer->history->next_history;
- if (buffer->history->text)
- free (buffer->history->text);
- free (buffer->history);
- buffer->history = ptr_history;
+ ptr_history = ptr_buffer->history->next_history;
+ if (ptr_buffer->history->text)
+ free (ptr_buffer->history->text);
+ free (ptr_buffer->history);
+ ptr_buffer->history = ptr_history;
}
- buffer->history = NULL;
- buffer->last_history = NULL;
- buffer->ptr_history = NULL;
- buffer->num_history = 0;
+ ptr_buffer->history = NULL;
+ ptr_buffer->last_history = NULL;
+ ptr_buffer->ptr_history = NULL;
+ ptr_buffer->num_history = 0;
}
diff --git a/src/gui/gui-history.h b/src/gui/gui-history.h
index aa9296813..40fedc71b 100644
--- a/src/gui/gui-history.h
+++ b/src/gui/gui-history.h
@@ -32,9 +32,9 @@ extern struct t_gui_history *history_global_last;
extern struct t_gui_history *history_global_ptr;
/* history functions (gui-history.c) */
-extern void gui_history_buffer_add (struct t_gui_buffer *, char *);
+extern void gui_history_buffer_add (void *, char *);
extern void gui_history_global_add (char *);
extern void gui_history_global_free ();
-extern void gui_history_buffer_free (struct t_gui_buffer *);
+extern void gui_history_buffer_free (void *);
#endif /* gui-history.h */
diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c
index b969768be..f0c2c3c46 100644
--- a/src/gui/gui-hotlist.c
+++ b/src/gui/gui-hotlist.c
@@ -31,6 +31,7 @@
#include "../core/wee-log.h"
#include "../core/wee-util.h"
#include "gui-hotlist.h"
+#include "gui-buffer.h"
#include "gui-window.h"
@@ -70,9 +71,9 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
{
struct t_gui_hotlist *ptr_hotlist;
- switch (cfg_look_hotlist_sort)
+ switch (CONFIG_INTEGER(config_look_hotlist_sort))
{
- case CFG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC:
+ case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -83,7 +84,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
return ptr_hotlist;
}
break;
- case CFG_LOOK_HOTLIST_SORT_GROUP_TIME_DESC:
+ case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_DESC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -94,7 +95,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
return ptr_hotlist;
}
break;
- case CFG_LOOK_HOTLIST_SORT_GROUP_NUMBER_ASC:
+ case CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_ASC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -104,7 +105,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
return ptr_hotlist;
}
break;
- case CFG_LOOK_HOTLIST_SORT_GROUP_NUMBER_DESC:
+ case CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_DESC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -114,7 +115,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
return ptr_hotlist;
}
break;
- case CFG_LOOK_HOTLIST_SORT_NUMBER_ASC:
+ case CONFIG_LOOK_HOTLIST_SORT_NUMBER_ASC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -122,7 +123,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h
return ptr_hotlist;
}
break;
- case CFG_LOOK_HOTLIST_SORT_NUMBER_DESC:
+ case CONFIG_LOOK_HOTLIST_SORT_NUMBER_DESC:
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index cec1b2eb3..3144e25c7 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -242,13 +242,15 @@ gui_input_complete (struct t_gui_buffer *buffer)
{
if (strncmp (utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos),
- cfg_look_nick_completor, strlen (cfg_look_nick_completor)) != 0)
- gui_input_insert_string (buffer, cfg_look_nick_completor,
+ CONFIG_STRING(config_look_nick_completor),
+ strlen (CONFIG_STRING(config_look_nick_completor))) != 0)
+ gui_input_insert_string (buffer,
+ CONFIG_STRING(config_look_nick_completor),
buffer->input_buffer_pos);
else
- buffer->input_buffer_pos += utf8_strlen (cfg_look_nick_completor);
+ buffer->input_buffer_pos += utf8_strlen (CONFIG_STRING(config_look_nick_completor));
if (buffer->completion->position >= 0)
- buffer->completion->position += strlen (cfg_look_nick_completor);
+ buffer->completion->position += strlen (CONFIG_STRING(config_look_nick_completor));
if (buffer->input_buffer[utf8_real_pos (buffer->input_buffer,
buffer->input_buffer_pos)] != ' ')
gui_input_insert_string (buffer, " ",
@@ -315,7 +317,7 @@ gui_input_get_prompt_length (struct t_gui_buffer *buffer)
}
length = 0;
- pos = cfg_look_input_format;
+ pos = CONFIG_STRING(config_look_input_format);
while (pos && pos[0])
{
switch (pos[0])
diff --git a/src/gui/gui-main.h b/src/gui/gui-main.h
index f657db0cf..04c3f2e24 100644
--- a/src/gui/gui-main.h
+++ b/src/gui/gui-main.h
@@ -20,11 +20,6 @@
#ifndef __WEECHAT_GUI_MAIN_H
#define __WEECHAT_GUI_MAIN_H 1
-/* main variables */
-
-extern int gui_init_ok;
-extern int gui_ok;
-
/* main functions (GUI dependent) */
extern void gui_main_loop ();
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index f7baa1bad..c8cba5124 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -38,6 +38,7 @@
#include "../core/wee-log.h"
#include "../core/wee-utf8.h"
#include "gui-window.h"
+#include "gui-chat.h"
#include "gui-input.h"
#include "gui-hotlist.h"
#include "gui-status.h"
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index af29faba5..e1aab192c 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -20,6 +20,9 @@
#ifndef __WEECHAT_GUI_WINDOW_H
#define __WEECHAT_GUI_WINDOW_H 1
+extern int gui_init_ok;
+extern int gui_ok;
+
/* window structures */
struct t_gui_window