diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-07-06 21:16:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-07-08 13:29:45 +0200 |
commit | 481e8f197d1e713ed94d1603c0af272fb202a65b (patch) | |
tree | 4b349348e4aa86a85b21202d1550c7f0d059bc1e /src | |
parent | 66cb9f6ea2e534887e73c885d3f131710c48382d (diff) | |
download | weechat-481e8f197d1e713ed94d1603c0af272fb202a65b.zip |
core: use type "enum" in options
Diffstat (limited to 'src')
37 files changed, 215 insertions, 215 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 47518fb2f..6dd608ad4 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -173,15 +173,15 @@ command_bar_list (int full) GUI_COLOR(GUI_COLOR_CHAT), (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) ? _("(hidden)") : "", (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) ? " " : "", - gui_bar_type_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE])], + gui_bar_type_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE])], (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS]) && CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])[0]) ? CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS]) : "-", - gui_bar_position_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION])], - gui_bar_filling_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM])], - gui_bar_filling_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT])], - ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) - || (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) ? + gui_bar_position_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION])], + gui_bar_filling_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM])], + gui_bar_filling_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT])], + ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) + || (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) ? _("height") : _("width"), (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]) == 0) ? _("auto") : str_size); gui_chat_printf (NULL, @@ -205,10 +205,10 @@ command_bar_list (int full) GUI_COLOR(GUI_COLOR_CHAT), (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) ? _("(hidden)") : "", (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) ? " " : "", - gui_bar_type_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE])], - gui_bar_position_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION])], - ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) - || (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) ? + gui_bar_type_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE])], + gui_bar_position_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION])], + ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) + || (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) ? _("height") : _("width"), (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]) == 0) ? _("auto") : str_size); } @@ -5373,7 +5373,7 @@ command_proxy_list () GUI_COLOR(GUI_COLOR_CHAT_BUFFER), ptr_proxy->name, GUI_COLOR(GUI_COLOR_CHAT), - proxy_type_string[CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])], + proxy_type_string[CONFIG_ENUM(ptr_proxy->options[PROXY_OPTION_TYPE])], CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS]), CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]), (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_IPV6])) ? "IPv6" : "IPv4", diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 97d7a6c3f..0a7068315 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -391,7 +391,7 @@ void config_change_save_config_layout_on_exit () { if (gui_init_ok && !CONFIG_BOOLEAN(config_look_save_config_on_exit) - && (CONFIG_INTEGER(config_look_save_layout_on_exit) != CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE)) + && (CONFIG_ENUM(config_look_save_layout_on_exit) != CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE)) { gui_chat_printf (NULL, _("Warning: option weechat.look.save_config_on_exit " @@ -2546,7 +2546,8 @@ config_weechat_notify_create_option_cb (const void *pointer, void *data, { ptr_option = config_file_new_option ( config_file, section, - option_name, "integer", _("Notify level for buffer"), + option_name, "enum", + _("Notify level for buffer"), "none|highlight|message|all", 0, 0, "", value, 0, &config_weechat_notify_check_cb, NULL, NULL, @@ -2901,7 +2902,7 @@ config_weechat_init_options () { config_look_align_end_of_lines = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "align_end_of_lines", "integer", + "align_end_of_lines", "enum", N_("alignment for end of lines (all lines after the first): they " "are starting under this data (time, buffer, prefix, suffix, " "message (default))"), @@ -2984,7 +2985,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_buffer_notify_default = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "buffer_notify_default", "integer", + "buffer_notify_default", "enum", N_("default notify level for buffers (used to tell WeeChat if " "buffer must be displayed in hotlist or not, according to " "importance of message): all=all messages (default), " @@ -2996,7 +2997,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_buffer_position = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "buffer_position", "integer", + "buffer_position", "enum", N_("position of a new buffer: end = after the end of list (number = " "last number + 1) (default), first_gap = at first available " "number in the list (after the end of list if no number is " @@ -3026,7 +3027,7 @@ config_weechat_init_options () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); config_look_buffer_search_where = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "buffer_search_where", "integer", + "buffer_search_where", "enum", N_("default text search in buffer: in message, prefix, prefix and " "message"), "prefix|message|prefix_message", 0, 0, "prefix_message", @@ -3392,7 +3393,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_hotlist_remove = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "hotlist_remove", "integer", + "hotlist_remove", "enum", N_("remove buffers in hotlist: buffer = remove buffer by buffer, " "merged = remove all visible merged buffers at once"), "buffer|merged", @@ -3409,7 +3410,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_hotlist_sort = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "hotlist_sort", "integer", + "hotlist_sort", "enum", N_("sort of hotlist: group_time_*: group by notify level " "(highlights first) then sort by time, group_number_*: group " "by notify level (highlights first) then sort by number, " @@ -3460,7 +3461,7 @@ config_weechat_init_options () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); config_look_input_share = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "input_share", "integer", + "input_share", "enum", N_("share commands, text, or both in input for all buffers (there " "is still local history for each buffer)"), "none|commands|text|all", @@ -3592,7 +3593,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_nick_color_hash = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "nick_color_hash", "integer", + "nick_color_hash", "enum", N_("hash algorithm used to find the color for a nick: djb2 = variant " "of djb2 (position of letters matters: anagrams of a nick have " "different color), djb2_32 = variant of djb2 using 32-bit instead " @@ -3721,7 +3722,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_prefix_align = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "prefix_align", "integer", + "prefix_align", "enum", N_("prefix alignment (none, left, right (default))"), "none|left|right", 0, 0, "right", NULL, 0, NULL, NULL, NULL, @@ -3764,7 +3765,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_prefix_buffer_align = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "prefix_buffer_align", "integer", + "prefix_buffer_align", "enum", N_("prefix alignment for buffer name, when many buffers are merged " "with same number (none, left, right (default))"), "none|left|right", 0, 0, "right", NULL, 0, @@ -3852,7 +3853,7 @@ config_weechat_init_options () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); config_look_read_marker = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "read_marker", "integer", + "read_marker", "enum", N_("use a marker (line or char) on buffers to show first unread " "line"), "none|line|char", @@ -3902,7 +3903,7 @@ config_weechat_init_options () NULL, NULL, NULL); config_look_save_layout_on_exit = config_file_new_option ( weechat_config_file, weechat_config_section_look, - "save_layout_on_exit", "integer", + "save_layout_on_exit", "enum", N_("save layout on exit (buffers, windows, or both)"), "none|buffers|windows|all", 0, 0, "none", NULL, 0, NULL, NULL, NULL, diff --git a/src/core/wee-network.c b/src/core/wee-network.c index 726779110..0e68d2bb1 100644 --- a/src/core/wee-network.c +++ b/src/core/wee-network.c @@ -767,7 +767,7 @@ network_pass_proxy (const char *proxy, int sock, const char *address, int port) ptr_proxy = proxy_search (proxy); if (ptr_proxy) { - switch (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])) + switch (CONFIG_ENUM(ptr_proxy->options[PROXY_OPTION_TYPE])) { case PROXY_TYPE_HTTP: rc = network_pass_httpproxy (ptr_proxy, sock, address, port); diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c index c35fea5d4..b8a5a046f 100644 --- a/src/core/wee-proxy.c +++ b/src/core/wee-proxy.c @@ -272,7 +272,7 @@ proxy_create_option (const char *proxy_name, int index_option, case PROXY_OPTION_TYPE: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_proxy, - option_name, "integer", + option_name, "enum", N_("proxy type (http (default), socks4, socks5)"), "http|socks4|socks5", 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -633,9 +633,9 @@ proxy_add_to_infolist (struct t_infolist *infolist, struct t_proxy *proxy) if (!infolist_new_var_string (ptr_item, "name", proxy->name)) return 0; - if (!infolist_new_var_integer (ptr_item, "type", CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE]))) + if (!infolist_new_var_integer (ptr_item, "type", CONFIG_ENUM(proxy->options[PROXY_OPTION_TYPE]))) return 0; - if (!infolist_new_var_string (ptr_item, "type_string", proxy_type_string[CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE])])) + if (!infolist_new_var_string (ptr_item, "type_string", proxy_type_string[CONFIG_ENUM(proxy->options[PROXY_OPTION_TYPE])])) return 0; if (!infolist_new_var_integer (ptr_item, "ipv6", CONFIG_INTEGER(proxy->options[PROXY_OPTION_IPV6]))) return 0; @@ -667,8 +667,8 @@ proxy_print_log () log_printf ("[proxy (addr:0x%lx)]", ptr_proxy); log_printf (" name . . . . . . . . . : '%s'", ptr_proxy->name); log_printf (" type . . . . . . . . . : %d (%s)", - CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE]), - proxy_type_string[CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])]); + CONFIG_ENUM(ptr_proxy->options[PROXY_OPTION_TYPE]), + proxy_type_string[CONFIG_ENUM(ptr_proxy->options[PROXY_OPTION_TYPE])]); log_printf (" ipv6 . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_IPV6])); log_printf (" address. . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS])); log_printf (" port . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT])); diff --git a/src/core/wee-secure-buffer.c b/src/core/wee-secure-buffer.c index 78a3e9db7..6152fe66e 100644 --- a/src/core/wee-secure-buffer.c +++ b/src/core/wee-secure-buffer.c @@ -101,8 +101,8 @@ secure_buffer_display () gui_chat_printf_y (secure_buffer, line++, "Hash algo: %s Cipher: %s Salt: %s", - secure_hash_algo_string[CONFIG_INTEGER(secure_config_crypt_hash_algo)], - secure_cipher_string[CONFIG_INTEGER(secure_config_crypt_cipher)], + secure_hash_algo_string[CONFIG_ENUM(secure_config_crypt_hash_algo)], + secure_cipher_string[CONFIG_ENUM(secure_config_crypt_cipher)], (CONFIG_BOOLEAN(secure_config_crypt_salt)) ? _("on") : _("off")); /* display passphrase */ diff --git a/src/core/wee-secure-config.c b/src/core/wee-secure-config.c index d55c61464..767cbe390 100644 --- a/src/core/wee-secure-config.c +++ b/src/core/wee-secure-config.c @@ -250,8 +250,8 @@ secure_config_data_read_cb (const void *pointer, void *data, rc = secure_decrypt_data ( buffer, length_buffer, - secure_hash_algo[CONFIG_INTEGER(secure_config_crypt_hash_algo)], - secure_cipher[CONFIG_INTEGER(secure_config_crypt_cipher)], + secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)], + secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)], secure_passphrase, &decrypted, &length_decrypted); @@ -326,8 +326,8 @@ secure_config_data_write_map_cb (void *data, /* encrypt password using passphrase */ rc = secure_encrypt_data ( value, strlen (value) + 1, - secure_hash_algo[CONFIG_INTEGER(secure_config_crypt_hash_algo)], - secure_cipher[CONFIG_INTEGER(secure_config_crypt_cipher)], + secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)], + secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)], secure_passphrase, &buffer, &length_buffer); @@ -465,14 +465,14 @@ secure_config_init_options () { secure_config_crypt_cipher = config_file_new_option ( secure_config_file, secure_config_section_crypt, - "cipher", "integer", + "cipher", "enum", N_("cipher used to crypt data (the number after algorithm is the " "size of the key in bits)"), "aes128|aes192|aes256", 0, 0, "aes256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); secure_config_crypt_hash_algo = config_file_new_option ( secure_config_file, secure_config_section_crypt, - "hash_algo", "integer", + "hash_algo", "enum", N_("hash algorithm used to check the decrypted data"), "sha224|sha256|sha384|sha512", 0, 0, "sha256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/src/core/wee-secure.c b/src/core/wee-secure.c index 39ff5d199..f2c68f16f 100644 --- a/src/core/wee-secure.c +++ b/src/core/wee-secure.c @@ -469,8 +469,8 @@ secure_decrypt_data_not_decrypted (const char *passphrase) rc = secure_decrypt_data ( buffer, length_buffer, - secure_hash_algo[CONFIG_INTEGER(secure_config_crypt_hash_algo)], - secure_cipher[CONFIG_INTEGER(secure_config_crypt_cipher)], + secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)], + secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)], passphrase, &decrypted, &length_decrypted); diff --git a/src/core/wee-url.c b/src/core/wee-url.c index 3d64b3219..2c6be1f4f 100644 --- a/src/core/wee-url.c +++ b/src/core/wee-url.c @@ -1249,7 +1249,7 @@ weeurl_set_proxy (CURL *curl, struct t_proxy *proxy) return; /* set proxy type */ - switch (CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE])) + switch (CONFIG_ENUM(proxy->options[PROXY_OPTION_TYPE])) { case PROXY_TYPE_HTTP: curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 666bab33b..95fea9f31 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -128,7 +128,7 @@ gui_bar_window_create_win (struct t_gui_bar_window *bar_window) if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR])) { - switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) + switch (CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) { case GUI_BAR_POSITION_BOTTOM: GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator = @@ -184,7 +184,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, wmove (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, *y, *x); - color_bg = ((CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + color_bg = ((CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) && (window != gui_current_window)) ? GUI_BAR_OPTION_COLOR_BG_INACTIVE : GUI_BAR_OPTION_COLOR_BG; @@ -556,7 +556,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, if (!bar_window || (bar_window->x < 0) || (bar_window->y < 0)) return; - color_bg = ((CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + color_bg = ((CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) && (window != gui_current_window)) ? GUI_BAR_OPTION_COLOR_BG_INACTIVE : GUI_BAR_OPTION_COLOR_BG; @@ -595,7 +595,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, gui_window_current_emphasis = 0; - bar_position = CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]); + bar_position = CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION]); bar_filling = gui_bar_get_filling (bar_window->bar); bar_size = CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SIZE]); diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index f045b876d..bc2fb99c6 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -84,7 +84,7 @@ gui_chat_marker_for_line (struct t_gui_buffer *buffer, struct t_gui_line *line) struct t_gui_line *last_read_line; /* marker is disabled in config? */ - if (CONFIG_INTEGER(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_LINE) + if (CONFIG_ENUM(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_LINE) return 0; /* marker is not set for buffer? */ @@ -204,7 +204,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate) return; gui_window_coords_init_line (window, window->win_chat_cursor_y); - if (CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_LINE) + if (CONFIG_ENUM(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_LINE) { read_marker_string = CONFIG_STRING(config_look_read_marker_string); if (!read_marker_string || !read_marker_string[0]) @@ -526,8 +526,8 @@ gui_chat_display_prefix_suffix (struct t_gui_window *window, { window->win_chat_cursor_x += length_align; - if ((CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_MESSAGE) - && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) + if ((CONFIG_ENUM(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_MESSAGE) + && (CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) && CONFIG_STRING(config_look_prefix_suffix) && CONFIG_STRING(config_look_prefix_suffix)[0] && line->data->date > 0) @@ -892,7 +892,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, if (mixed_lines && (line->data->buffer->active != 2)) { if ((CONFIG_INTEGER(config_look_prefix_buffer_align_max) > 0) - && (CONFIG_INTEGER(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE)) + && (CONFIG_ENUM(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE)) { length_allowed = (mixed_lines->buffer_max_length <= CONFIG_INTEGER(config_look_prefix_buffer_align_max)) ? @@ -905,7 +905,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, length = gui_chat_strlen_screen (short_name); num_spaces = length_allowed - length; - if (CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_RIGHT) + if (CONFIG_ENUM(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_RIGHT) { if (!simulate) { @@ -941,7 +941,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, window->coords[window->win_chat_cursor_y].buffer_x1 = window->win_chat_cursor_x; /* not enough space to display full buffer name? => truncate it! */ - if ((CONFIG_INTEGER(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) + if ((CONFIG_ENUM(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) && (num_spaces < 0)) { chars_to_display = length_allowed; @@ -976,7 +976,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, if (window->win_chat_cursor_y < window->coords_size) window->coords[window->win_chat_cursor_y].buffer_x2 = window->win_chat_cursor_x - 1; - if ((CONFIG_INTEGER(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) + if ((CONFIG_ENUM(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) && (num_spaces < 0)) { if (!simulate) @@ -1017,9 +1017,9 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, GUI_COLOR_CHAT_INACTIVE_BUFFER, GUI_COLOR_CHAT); } - if ((CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_LEFT) - || ((CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) - && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE))) + if ((CONFIG_ENUM(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_LEFT) + || ((CONFIG_ENUM(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) + && (CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE))) { for (i = 0; i < num_spaces; i++) { @@ -1083,7 +1083,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, /* display prefix */ if (ptr_prefix && (ptr_prefix[0] - || (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE))) + || (CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE))) { if (!simulate) { @@ -1116,7 +1116,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, num_spaces = length_allowed - prefix_length - length_nick_prefix_suffix; - if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_RIGHT) + if (CONFIG_ENUM(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_RIGHT) { for (i = 0; i < num_spaces; i++) { @@ -1195,7 +1195,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, /* not enough space to display full prefix? => truncate it! */ extra_spaces = 0; - if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) + if ((CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) && (num_spaces < 0)) { chars_to_display = length_allowed - length_nick_prefix_suffix; @@ -1256,7 +1256,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, } if (!CONFIG_BOOLEAN(config_look_prefix_align_more_after) - && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) + && (CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) && (num_spaces < 0)) { if (!simulate) @@ -1288,7 +1288,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, simulate, 0, 0); } - if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_LEFT) + if (CONFIG_ENUM(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_LEFT) { if (!simulate) { @@ -1309,7 +1309,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, } if (CONFIG_BOOLEAN(config_look_prefix_align_more_after) - && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) + && (CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) && (num_spaces < 0)) { if (!simulate) @@ -1345,7 +1345,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window, } } - if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) + if ((CONFIG_ENUM(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE) && CONFIG_STRING(config_look_prefix_suffix) && CONFIG_STRING(config_look_prefix_suffix)[0]) { @@ -1709,7 +1709,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, else { /* display read marker if needed */ - if ((CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_CHAR) + if ((CONFIG_ENUM(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_CHAR) && window->buffer->lines->last_read_line && (window->buffer->lines->last_read_line == gui_line_get_prev_displayed (line))) { diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index e1e4cf77a..b1f6d2e6c 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -1826,7 +1826,7 @@ gui_window_refresh_windows () for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) && ptr_bar->bar_window && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) { diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 6b6a05362..3dc63d64b 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -587,7 +587,7 @@ gui_bar_item_update (const char *item_name) if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) check_bar_conditions = 1; - if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { if (ptr_bar->bar_window) { @@ -621,7 +621,7 @@ gui_bar_item_update (const char *item_name) */ if (check_bar_conditions) { - if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { condition_ok = gui_bar_check_conditions (ptr_bar, NULL); if ((condition_ok && !ptr_bar->bar_window) diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 230822813..c34496d03 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -168,7 +168,7 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y, if (*bar_window) { filling = gui_bar_get_filling ((*bar_window)->bar); - position = CONFIG_INTEGER((*bar_window)->bar->options[GUI_BAR_OPTION_POSITION]); + position = CONFIG_ENUM((*bar_window)->bar->options[GUI_BAR_OPTION_POSITION]); *bar_item_line = y - (*bar_window)->y + (*bar_window)->scroll_y; *bar_item_col = x - (*bar_window)->x + (*bar_window)->scroll_x; @@ -300,8 +300,8 @@ gui_bar_window_get_size (struct t_gui_bar *bar, struct t_gui_window *window, if (!CONFIG_BOOLEAN(ptr_bar_window->bar->options[GUI_BAR_OPTION_HIDDEN])) { - if ((CONFIG_INTEGER(ptr_bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) - && (CONFIG_INTEGER(ptr_bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == (int)position)) + if ((CONFIG_ENUM(ptr_bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + && (CONFIG_ENUM(ptr_bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == (int)position)) { switch (position) { @@ -365,7 +365,7 @@ gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window, add_right = gui_bar_root_get_size (bar_window->bar, GUI_BAR_POSITION_RIGHT); } - switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) + switch (CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) { case GUI_BAR_POSITION_BOTTOM: bar_window->x = x1 + add_left; @@ -880,8 +880,8 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window, else split_items[i] = NULL; } - if ((CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) - || (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) + if ((CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) + || (CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) { columns = bar_window->width / (max_length_screen + 1); if (columns == 0) @@ -1008,7 +1008,7 @@ gui_bar_window_can_use_spacer (struct t_gui_bar_window *bar_window) if (!bar_window) return 0; - position = CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]); + position = CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION]); filling = gui_bar_get_filling (bar_window->bar); bar_size = CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SIZE]); @@ -1194,7 +1194,7 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window) if (window) { - if ((CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) + if ((CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) && (!gui_bar_check_conditions (bar, window))) return; } @@ -1272,7 +1272,7 @@ gui_bar_window_get_max_size_in_window (struct t_gui_bar_window *bar_window, if (bar_window && window) { - switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) + switch (CONFIG_ENUM(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) { case GUI_BAR_POSITION_BOTTOM: case GUI_BAR_POSITION_TOP: @@ -1439,7 +1439,7 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window) { next_bar_win = ptr_bar_win->next_bar_window; - if ((CONFIG_INTEGER(ptr_bar_win->bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) + if ((CONFIG_ENUM(ptr_bar_win->bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) && (!gui_bar_check_conditions (ptr_bar_win->bar, window))) { gui_bar_window_free (ptr_bar_win, window); @@ -1454,7 +1454,7 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window) /* remove unused root bars */ for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) && ptr_bar->bar_window && (!gui_bar_check_conditions (ptr_bar, NULL))) { @@ -1491,7 +1491,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window) /* add missing window bars in window */ for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) + if ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW) && (!gui_bar_window_search_bar (window, ptr_bar)) && (gui_bar_check_conditions (ptr_bar, window))) { @@ -1505,7 +1505,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window) /* add missing root bars */ for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) && !ptr_bar->bar_window && (gui_bar_check_conditions (ptr_bar, NULL))) { diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 8015f5694..bd1539069 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -239,7 +239,7 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size) sub_width = 0; sub_height = 0; - switch (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION])) + switch (CONFIG_ENUM(bar->options[GUI_BAR_OPTION_POSITION])) { case GUI_BAR_POSITION_BOTTOM: case GUI_BAR_POSITION_TOP: @@ -256,7 +256,7 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size) for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window) { - if ((CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if ((CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) || (gui_bar_window_search_bar (ptr_window, bar))) { if ((ptr_window->win_chat_width - sub_width < 1) @@ -277,11 +277,11 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size) enum t_gui_bar_filling gui_bar_get_filling (struct t_gui_bar *bar) { - if ((CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) - || (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) - return CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]); + if ((CONFIG_ENUM(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM) + || (CONFIG_ENUM(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP)) + return CONFIG_ENUM(bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]); - return CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]); + return CONFIG_ENUM(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]); } /* @@ -474,8 +474,8 @@ gui_bar_root_get_size (struct t_gui_bar *bar, enum t_gui_bar_position position) if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) && ptr_bar->bar_window) { - if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) - && (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == (int)position)) + if ((CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + && (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]) == (int)position)) { total_size += gui_bar_window_get_current_size (ptr_bar->bar_window); if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SEPARATOR])) @@ -596,7 +596,7 @@ gui_bar_refresh (struct t_gui_bar *bar) { struct t_gui_window *ptr_win; - if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) gui_window_ask_refresh (1); else { @@ -654,7 +654,7 @@ gui_bar_apply_current_size (struct t_gui_bar *bar) struct t_gui_window *ptr_win; struct t_gui_bar_window *ptr_bar_win; - if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { gui_bar_window_set_current_size (bar->bar_window, NULL, @@ -853,7 +853,7 @@ gui_bar_config_change_hidden (const void *pointer, void *data, ptr_bar = gui_bar_search_with_option_name (option->name); if (ptr_bar) { - if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { if (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) { @@ -1374,7 +1374,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value case GUI_BAR_OPTION_TYPE: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_bar, - option_name, "integer", + option_name, "enum", N_("bar type (root, window, window_active, window_inactive)"), "root|window|window_active|window_inactive", 0, 0, default_value, value, 0, @@ -1401,7 +1401,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value case GUI_BAR_OPTION_POSITION: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_bar, - option_name, "integer", + option_name, "enum", N_("bar position (bottom, top, left, right)"), "bottom|top|left|right", 0, 0, default_value, value, 0, NULL, NULL, NULL, @@ -1411,7 +1411,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value case GUI_BAR_OPTION_FILLING_TOP_BOTTOM: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_bar, - option_name, "integer", + option_name, "enum", N_("bar filling direction (\"horizontal\" (from left to right) " "or \"vertical\" (from top to bottom)) when bar position is " "top or bottom"), @@ -1424,7 +1424,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value case GUI_BAR_OPTION_FILLING_LEFT_RIGHT: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_bar, - option_name, "integer", + option_name, "enum", N_("bar filling direction (\"horizontal\" (from left to right) " "or \"vertical\" (from top to bottom)) when bar position is " "left or right"), @@ -1669,7 +1669,7 @@ gui_bar_new_with_options (const char *name, gui_bar_insert (new_bar); /* add window bar */ - if (CONFIG_INTEGER(new_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(new_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { /* create only one window for bar */ gui_bar_window_new (new_bar, NULL); @@ -2172,7 +2172,7 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window, } } - if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT) { gui_bar_window_scroll (bar->bar_window, NULL, add_x, scroll_beginning, scroll_end, @@ -2352,15 +2352,15 @@ gui_bar_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_integer (ptr_item, "priority", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_PRIORITY]))) return 0; - if (!infolist_new_var_integer (ptr_item, "type", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]))) + if (!infolist_new_var_integer (ptr_item, "type", CONFIG_ENUM(bar->options[GUI_BAR_OPTION_TYPE]))) return 0; if (!infolist_new_var_string (ptr_item, "conditions", CONFIG_STRING(bar->options[GUI_BAR_OPTION_CONDITIONS]))) return 0; - if (!infolist_new_var_integer (ptr_item, "position", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]))) + if (!infolist_new_var_integer (ptr_item, "position", CONFIG_ENUM(bar->options[GUI_BAR_OPTION_POSITION]))) return 0; - if (!infolist_new_var_integer (ptr_item, "filling_top_bottom", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]))) + if (!infolist_new_var_integer (ptr_item, "filling_top_bottom", CONFIG_ENUM(bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]))) return 0; - if (!infolist_new_var_integer (ptr_item, "filling_left_right", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]))) + if (!infolist_new_var_integer (ptr_item, "filling_left_right", CONFIG_ENUM(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]))) return 0; if (!infolist_new_var_integer (ptr_item, "size", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_SIZE]))) return 0; @@ -2430,18 +2430,18 @@ gui_bar_print_log () log_printf (" hidden . . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])); log_printf (" priority . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_PRIORITY])); log_printf (" type . . . . . . . . . : %d (%s)", - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]), - gui_bar_type_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE])]); + CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]), + gui_bar_type_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE])]); log_printf (" conditions . . . . . . : '%s'", CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])); log_printf (" position . . . . . . . : %d (%s)", - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION]), - gui_bar_position_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_POSITION])]); + CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION]), + gui_bar_position_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_POSITION])]); log_printf (" filling_top_bottom . . : %d (%s)", - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]), - gui_bar_filling_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM])]); + CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]), + gui_bar_filling_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM])]); log_printf (" filling_left_right . . : %d (%s)", - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]), - gui_bar_filling_string[CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT])]); + CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]), + gui_bar_filling_string[CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT])]); log_printf (" size . . . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE])); log_printf (" size_max . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE_MAX])); log_printf (" color_fg . . . . . . . : %d (%s)", diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 88a0248ff..e492d72eb 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -306,7 +306,7 @@ gui_buffer_notify_get (struct t_gui_buffer *buffer) struct t_config_option *ptr_option; if (!buffer) - return CONFIG_INTEGER(config_look_buffer_notify_default); + return CONFIG_ENUM(config_look_buffer_notify_default); length = strlen (buffer->full_name) + 1; option_name = malloc (length); @@ -344,7 +344,7 @@ gui_buffer_notify_get (struct t_gui_buffer *buffer) } /* notify level not found */ - return CONFIG_INTEGER(config_look_buffer_notify_default); + return CONFIG_ENUM(config_look_buffer_notify_default); } /* @@ -480,7 +480,7 @@ gui_buffer_insert (struct t_gui_buffer *buffer) */ if (!pos_buffer && (buffer->layout_number == 0) - && (CONFIG_INTEGER(config_look_buffer_position) == CONFIG_LOOK_BUFFER_POSITION_FIRST_GAP)) + && (CONFIG_ENUM(config_look_buffer_position) == CONFIG_LOOK_BUFFER_POSITION_FIRST_GAP)) { for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) @@ -719,7 +719,7 @@ gui_buffer_new_props (struct t_weechat_plugin *plugin, gui_buffer_build_full_name (new_buffer); new_buffer->short_name = NULL; new_buffer->type = GUI_BUFFER_TYPE_DEFAULT; - new_buffer->notify = CONFIG_INTEGER(config_look_buffer_notify_default); + new_buffer->notify = CONFIG_ENUM(config_look_buffer_notify_default); new_buffer->num_displayed = 0; new_buffer->active = 1; new_buffer->hidden = 0; @@ -2371,7 +2371,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, if (number < GUI_BUFFER_NUM_NOTIFY) { if (number < 0) - number = CONFIG_INTEGER(config_look_buffer_notify_default); + number = CONFIG_ENUM(config_look_buffer_notify_default); ptr_notify = gui_buffer_notify_string[number]; } } @@ -4622,7 +4622,7 @@ gui_buffer_input_move_to_buffer (struct t_gui_buffer *from_buffer, * - input buffer in first buffer is not empty */ if (!from_buffer || !to_buffer || (from_buffer == to_buffer) - || (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_NONE) + || (CONFIG_ENUM(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_NONE) || !from_buffer->input_buffer || !from_buffer->input_buffer[0]) return; @@ -4632,8 +4632,8 @@ gui_buffer_input_move_to_buffer (struct t_gui_buffer *from_buffer, * then do nothing */ is_command = (string_input_for_buffer (from_buffer->input_buffer) == NULL) ? 1 : 0; - if ((is_command && (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_TEXT)) - || (!is_command && (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_COMMANDS))) + if ((is_command && (CONFIG_ENUM(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_TEXT)) + || (!is_command && (CONFIG_ENUM(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_COMMANDS))) return; /* diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index 0506d409f..ba8747121 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -238,7 +238,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, { struct t_gui_hotlist *ptr_hotlist; - switch (CONFIG_INTEGER(config_look_hotlist_sort)) + switch (CONFIG_ENUM(config_look_hotlist_sort)) { case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC: for (ptr_hotlist = hotlist; ptr_hotlist; @@ -691,7 +691,7 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer, hotlist_changed = 0; - hotlist_remove = CONFIG_INTEGER(config_look_hotlist_remove); + hotlist_remove = CONFIG_ENUM(config_look_hotlist_remove); ptr_hotlist = gui_hotlist; while (ptr_hotlist) diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c index e72438161..dd744ba0d 100644 --- a/src/gui/gui-layout.c +++ b/src/gui/gui-layout.c @@ -770,7 +770,7 @@ gui_layout_store_on_exit () { struct t_gui_layout *ptr_layout; - if (CONFIG_BOOLEAN(config_look_save_layout_on_exit) == CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE) + if (CONFIG_ENUM(config_look_save_layout_on_exit) == CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE) return; ptr_layout = gui_layout_current; @@ -788,7 +788,7 @@ gui_layout_store_on_exit () } /* store current layout */ - switch (CONFIG_BOOLEAN(config_look_save_layout_on_exit)) + switch (CONFIG_ENUM(config_look_save_layout_on_exit)) { case CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_BUFFERS: gui_layout_buffer_store (ptr_layout); diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index b5cc9b98e..efef30959 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -304,7 +304,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line, /* return immediately if alignment for end of lines is "time" */ if (!first_line - && (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_TIME)) + && (CONFIG_ENUM(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_TIME)) { return 0; } @@ -319,7 +319,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line, /* return immediately if alignment for end of lines is "buffer" */ if (!first_line - && (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_BUFFER)) + && (CONFIG_ENUM(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_BUFFER)) { return length_time; } @@ -327,12 +327,12 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line, /* length of buffer name (when many buffers are merged) */ if (buffer->mixed_lines && (buffer->active != 2)) { - if ((CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) - && (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE)) + if ((CONFIG_ENUM(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) + && (CONFIG_ENUM(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE)) length_buffer = gui_chat_strlen_screen (gui_buffer_get_short_name (line->data->buffer)) + 1; else { - if (CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) + if (CONFIG_ENUM(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE) length_buffer = buffer->mixed_lines->buffer_max_length + 1; else length_buffer = ((CONFIG_INTEGER(config_look_prefix_buffer_align_max) > 0) @@ -345,7 +345,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line, /* return immediately if alignment for end of lines is "prefix" */ if (!first_line - && (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_PREFIX)) + && (CONFIG_ENUM(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_PREFIX)) { return length_time + length_buffer; } @@ -356,7 +356,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line, if (prefix_is_nick) prefix_length += config_length_nick_prefix_suffix; - if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE) + if (CONFIG_ENUM(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE) { return length_time + length_buffer + prefix_length + ((prefix_length > 0) ? 1 : 0); } diff --git a/src/gui/gui-nick.c b/src/gui/gui-nick.c index 04f7213c9..75712a654 100644 --- a/src/gui/gui-nick.c +++ b/src/gui/gui-nick.c @@ -129,7 +129,7 @@ gui_nick_hash_color (const char *nickname, int num_colors) color_64 = 0; - switch (CONFIG_INTEGER(config_look_nick_color_hash)) + switch (CONFIG_ENUM(config_look_nick_color_hash)) { case CONFIG_LOOK_NICK_COLOR_HASH_DJB2: /* variant of djb2 hash, using 64-bit integer */ diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 013704f41..76a585f1d 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -736,7 +736,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer, /* create bar windows */ for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + if (CONFIG_ENUM(ptr_bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) gui_bar_window_new (ptr_bar, new_window); } @@ -1691,7 +1691,7 @@ gui_window_search_start (struct t_gui_window *window, window->buffer->text_search_regex = CONFIG_BOOLEAN(config_look_buffer_search_regex); if (window->buffer->type == GUI_BUFFER_TYPE_FORMATTED) { - switch (CONFIG_INTEGER(config_look_buffer_search_where)) + switch (CONFIG_ENUM(config_look_buffer_search_where)) { case CONFIG_LOOK_BUFFER_SEARCH_PREFIX: window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_PREFIX; diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 607f49ac5..39b0cc04a 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -69,7 +69,7 @@ irc_bar_item_buffer_plugin (const void *pointer, void *data, if (ptr_plugin == weechat_irc_plugin) { irc_buffer_get_server_and_channel (buffer, &server, &channel); - if (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN) + if (weechat_config_enum (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN) { if (server && channel) { @@ -127,7 +127,7 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) buf_name[0] = '\0'; - display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME); + display_server = (weechat_config_enum (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME); irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server || channel) @@ -330,7 +330,7 @@ irc_bar_item_channel (const void *pointer, void *data, buf_name[0] = '\0'; modes[0] = '\0'; - display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME); + display_server = (weechat_config_enum (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME); irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server || channel) diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index e95c442ea..f288d6ba2 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -145,7 +145,7 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type, } if ((number_found == 0) - && (weechat_config_integer (irc_config_look_server_buffer) == + && (weechat_config_enum (irc_config_look_server_buffer) == IRC_CONFIG_LOOK_SERVER_BUFFER_INDEPENDENT)) { number_found = weechat_buffer_get_integer (server->buffer, "number") + 1; @@ -333,7 +333,7 @@ irc_channel_create_buffer (struct t_irc_server *server, ptr_buffer_for_merge = NULL; if (channel_type == IRC_CHANNEL_TYPE_PRIVATE) { - switch (weechat_config_integer (irc_config_look_pv_buffer)) + switch (weechat_config_enum (irc_config_look_pv_buffer)) { case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER: /* merge private buffers by server */ @@ -359,8 +359,8 @@ irc_channel_create_buffer (struct t_irc_server *server, if (weechat_buffer_get_integer (ptr_buffer, "layout_number") < 1) { buffer_position = (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ? - weechat_config_integer (irc_config_look_new_channel_position) : - weechat_config_integer (irc_config_look_new_pv_position); + weechat_config_enum (irc_config_look_new_channel_position) : + weechat_config_enum (irc_config_look_new_pv_position); switch (buffer_position) { case IRC_CONFIG_LOOK_BUFFER_POSITION_NONE: diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 56c49ee10..a0faacc5e 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1008,7 +1008,7 @@ IRC_COMMAND_CALLBACK(auth) if (weechat_hashtable_has_key (ptr_server->cap_list, "sasl")) { /* SASL capability already enabled, authenticate */ - sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + sasl_mechanism = IRC_SERVER_OPTION_ENUM( ptr_server, IRC_SERVER_OPTION_SASL_MECHANISM); if ((sasl_mechanism >= 0) && (sasl_mechanism < IRC_NUM_SASL_MECHANISMS)) @@ -1278,11 +1278,11 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments, server->away_time = time (NULL); irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "AWAY :%s", arguments); - if (weechat_config_integer (irc_config_look_display_away) != IRC_CONFIG_DISPLAY_AWAY_OFF) + if (weechat_config_enum (irc_config_look_display_away) != IRC_CONFIG_DISPLAY_AWAY_OFF) { string = irc_color_decode (arguments, weechat_config_boolean (irc_config_network_colors_send)); - if (weechat_config_integer (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_LOCAL) + if (weechat_config_enum (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_LOCAL) { irc_command_display_away (server, "away", (string) ? string : arguments); @@ -1350,9 +1350,9 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments, elapsed = (time_now >= server->away_time) ? time_now - server->away_time : 0; server->away_time = 0; - if (weechat_config_integer (irc_config_look_display_away) != IRC_CONFIG_DISPLAY_AWAY_OFF) + if (weechat_config_enum (irc_config_look_display_away) != IRC_CONFIG_DISPLAY_AWAY_OFF) { - if (weechat_config_integer (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_LOCAL) + if (weechat_config_enum (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_LOCAL) { snprintf (buffer, sizeof (buffer), "gone %.2ld:%.2ld:%.2ld", @@ -5124,11 +5124,11 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) /* sasl_mechanism */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SASL_MECHANISM])) weechat_printf (NULL, " sasl_mechanism . . . : ('%s')", - irc_sasl_mechanism_string[IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_MECHANISM)]); + irc_sasl_mechanism_string[IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_MECHANISM)]); else weechat_printf (NULL, " sasl_mechanism . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - irc_sasl_mechanism_string[weechat_config_integer (server->options[IRC_SERVER_OPTION_SASL_MECHANISM])]); + irc_sasl_mechanism_string[weechat_config_enum (server->options[IRC_SERVER_OPTION_SASL_MECHANISM])]); /* sasl_username */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SASL_USERNAME])) weechat_printf (NULL, " sasl_username. . . . : ('%s')", @@ -5166,11 +5166,11 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) /* sasl_fail */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SASL_FAIL])) weechat_printf (NULL, " sasl_fail. . . . . . : ('%s')", - irc_server_sasl_fail_string[IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_FAIL)]); + irc_server_sasl_fail_string[IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_FAIL)]); else weechat_printf (NULL, " sasl_fail. . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - irc_server_sasl_fail_string[weechat_config_integer (server->options[IRC_SERVER_OPTION_SASL_FAIL])]); + irc_server_sasl_fail_string[weechat_config_enum (server->options[IRC_SERVER_OPTION_SASL_FAIL])]); /* autoconnect */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOCONNECT])) weechat_printf (NULL, " autoconnect. . . . . : (%s)", diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index 3805643b0..1df549157 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -329,12 +329,12 @@ irc_completion_channel_nicks_cb (const void *pointer, void *data, WEECHAT_LIST_POS_SORT); } /* add recent speakers on channel */ - if (weechat_config_integer (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS) + if (weechat_config_enum (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS) { irc_completion_channel_nicks_add_speakers (completion, ptr_server, ptr_channel, 0); } /* add nicks whose make highlights on me recently on this channel */ - if (weechat_config_integer (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS) + if (weechat_config_enum (irc_config_look_nick_completion_smart) == IRC_CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS) { irc_completion_channel_nicks_add_speakers (completion, ptr_server, ptr_channel, 1); } diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 0c40f86c7..cc4164f83 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -344,7 +344,7 @@ irc_config_change_look_display_away (const void *pointer, void *data, (void) option; if (!irc_config_loading - && (weechat_config_integer (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_CHANNEL)) + && (weechat_config_enum (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_CHANNEL)) { weechat_printf ( NULL, @@ -428,13 +428,13 @@ irc_config_change_look_server_buffer (const void *pointer, void *data, } /* merge IRC server buffers with core buffer or another buffer */ - if ((weechat_config_integer (irc_config_look_server_buffer) == + if ((weechat_config_enum (irc_config_look_server_buffer) == IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE) - || (weechat_config_integer (irc_config_look_server_buffer) == + || (weechat_config_enum (irc_config_look_server_buffer) == IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITHOUT_CORE)) { ptr_buffer = - (weechat_config_integer (irc_config_look_server_buffer) == + (weechat_config_enum (irc_config_look_server_buffer) == IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE) ? weechat_buffer_search_main () : irc_buffer_search_server_lowest_number (); @@ -483,8 +483,8 @@ irc_config_change_look_pv_buffer (const void *pointer, void *data, } /* merge IRC private buffers */ - if ((weechat_config_integer (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER) - || (weechat_config_integer (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL)) + if ((weechat_config_enum (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER) + || (weechat_config_enum (irc_config_look_pv_buffer) == IRC_CONFIG_LOOK_PV_BUFFER_MERGE_ALL)) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) @@ -496,7 +496,7 @@ irc_config_change_look_pv_buffer (const void *pointer, void *data, && ptr_channel->buffer) { ptr_buffer = NULL; - switch (weechat_config_integer (irc_config_look_pv_buffer)) + switch (weechat_config_enum (irc_config_look_pv_buffer)) { case IRC_CONFIG_LOOK_PV_BUFFER_MERGE_BY_SERVER: /* merge private buffers by server */ @@ -1474,7 +1474,7 @@ irc_config_msgbuffer_create_option (const void *pointer, void *data, ptr_option = weechat_config_new_option ( config_file, section, - option_name, "integer", + option_name, "enum", _("buffer used to display message received from IRC " "server"), "weechat|server|current|private", 0, 0, value, value, 0, @@ -1951,7 +1951,7 @@ irc_config_server_new_option (struct t_config_file *config_file, case IRC_SERVER_OPTION_SASL_MECHANISM: new_option = weechat_config_new_option ( config_file, section, - option_name, "integer", + option_name, "enum", N_("mechanism for SASL authentication: " "\"plain\" for plain text password, " "\"scram-sha-1\" for SCRAM authentication with SHA-1 " @@ -2057,7 +2057,7 @@ irc_config_server_new_option (struct t_config_file *config_file, case IRC_SERVER_OPTION_SASL_FAIL: new_option = weechat_config_new_option ( config_file, section, - option_name, "integer", + option_name, "enum", N_("action to perform if SASL authentication fails: " "\"continue\" to ignore the authentication problem, " "\"reconnect\" to schedule a reconnection to the server, " @@ -2555,7 +2555,7 @@ irc_config_server_new_option (struct t_config_file *config_file, case IRC_SERVER_OPTION_CHARSET_MESSAGE: new_option = weechat_config_new_option ( config_file, section, - option_name, "integer", + option_name, "enum", N_("part of the IRC message (received or sent) which is " "decoded/encoded to the target charset; " "message = the whole IRC message (default), " @@ -2968,7 +2968,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_display_away = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "display_away", "integer", + "display_away", "enum", N_("display message when (un)marking as away (off: do not " "display/send anything, local: display locally, channel: send " "action to channels)"), @@ -3132,7 +3132,7 @@ irc_config_init () NULL, NULL, NULL); irc_config_look_item_display_server = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "item_display_server", "integer", + "item_display_server", "enum", N_("name of bar item where IRC server is displayed (for status bar)"), "buffer_plugin|buffer_name", 0, 0, "buffer_plugin", NULL, 0, NULL, NULL, NULL, @@ -3165,14 +3165,14 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_msgbuffer_fallback = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "msgbuffer_fallback", "integer", + "msgbuffer_fallback", "enum", N_("default target buffer for msgbuffer options when target is " "private and that private buffer is not found"), "current|server", 0, 0, "current", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_new_channel_position = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "new_channel_position", "integer", + "new_channel_position", "enum", N_("force position of new channel in list of buffers " "(none = default position (should be last buffer), " "next = current buffer + 1, near_server = after last channel/pv " @@ -3181,7 +3181,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_new_pv_position = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "new_pv_position", "integer", + "new_pv_position", "enum", N_("force position of new private in list of buffers " "(none = default position (should be last buffer), " "next = current buffer + 1, near_server = after last channel/pv " @@ -3190,7 +3190,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_completion_smart = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "nick_completion_smart", "integer", + "nick_completion_smart", "enum", N_("smart completion for nicks (completes first with last speakers): " "speakers = all speakers (including highlights), " "speakers_highlights = only speakers with highlight"), @@ -3198,7 +3198,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_mode = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "nick_mode", "integer", + "nick_mode", "enum", N_("display nick mode (op, voice, ...) before nick (none = never, " "prefix = in prefix only (default), action = in action messages " "only, both = prefix + action messages)"), @@ -3226,7 +3226,7 @@ irc_config_init () NULL, NULL, NULL); irc_config_look_notice_as_pv = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "notice_as_pv", "integer", + "notice_as_pv", "enum", N_("display notices as private messages (if auto, use private " "buffer if found)"), "auto|never|always", 0, 0, "auto", NULL, 0, @@ -3274,7 +3274,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_pv_buffer = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "pv_buffer", "integer", + "pv_buffer", "enum", N_("merge private buffers"), "independent|merge_by_server|merge_all", 0, 0, "independent", NULL, 0, NULL, NULL, NULL, @@ -3315,7 +3315,7 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_server_buffer = weechat_config_new_option ( irc_config_file, irc_config_section_look, - "server_buffer", "integer", + "server_buffer", "enum", N_("merge server buffers; this option has no effect if a layout " "is saved and is conflicting with this value (see /help layout)"), "merge_with_core|merge_without_core|independent", 0, 0, "merge_with_core", diff --git a/src/plugins/irc/irc-msgbuffer.c b/src/plugins/irc/irc-msgbuffer.c index 02c5f3c4d..7c56a7c2c 100644 --- a/src/plugins/irc/irc-msgbuffer.c +++ b/src/plugins/irc/irc-msgbuffer.c @@ -122,7 +122,7 @@ irc_msgbuffer_get_target_buffer (struct t_irc_server *server, const char *nick, ptr_channel = irc_channel_search (server, nick); if (ptr_channel) return ptr_channel->buffer; - if (weechat_config_integer (irc_config_look_msgbuffer_fallback) == + if (weechat_config_enum (irc_config_look_msgbuffer_fallback) == IRC_CONFIG_LOOK_MSGBUFFER_FALLBACK_SERVER) { return (server) ? server->buffer : NULL; diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index d32198e2c..509171af7 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -913,7 +913,7 @@ irc_nick_mode_for_display (struct t_irc_server *server, struct t_irc_nick *nick, str_prefix[0] = (nick) ? nick->prefix[0] : '\0'; str_prefix[1] = '\0'; - nick_mode = weechat_config_integer (irc_config_look_nick_mode); + nick_mode = weechat_config_enum (irc_config_look_nick_mode); if ((nick_mode == IRC_CONFIG_LOOK_NICK_MODE_BOTH) || (prefix && (nick_mode == IRC_CONFIG_LOOK_NICK_MODE_PREFIX)) || (!prefix && (nick_mode == IRC_CONFIG_LOOK_NICK_MODE_ACTION))) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index ab97587a4..1a1e357f7 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -554,7 +554,7 @@ IRC_PROTOCOL_CALLBACK(authenticate) irc_server_sasl_get_creds (server, &sasl_username, &sasl_password, &sasl_key); - sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + sasl_mechanism = IRC_SERVER_OPTION_ENUM( server, IRC_SERVER_OPTION_SASL_MECHANISM); answer = NULL; @@ -922,7 +922,7 @@ irc_protocol_cap_sync (struct t_irc_server *server, int sasl) if (weechat_config_boolean (irc_config_network_sasl_fail_unavailable)) { /* same handling as for sasl_end_fail */ - sasl_fail = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_FAIL); + sasl_fail = IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_FAIL); if ((sasl_fail == IRC_SERVER_SASL_FAIL_RECONNECT) || (sasl_fail == IRC_SERVER_SASL_FAIL_DISCONNECT)) { @@ -1219,7 +1219,7 @@ IRC_PROTOCOL_CALLBACK(cap) if (sasl_to_do) { - sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + sasl_mechanism = IRC_SERVER_OPTION_ENUM( server, IRC_SERVER_OPTION_SASL_MECHANISM); if ((sasl_mechanism >= 0) && (sasl_mechanism < IRC_NUM_SASL_MECHANISMS)) @@ -2634,11 +2634,11 @@ IRC_PROTOCOL_CALLBACK(notice) ptr_channel = NULL; if (nick - && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER) + && weechat_config_enum (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER) { ptr_channel = irc_channel_search (server, nick); if (!ptr_channel - && weechat_config_integer (irc_config_look_notice_as_pv) == IRC_CONFIG_LOOK_NOTICE_AS_PV_ALWAYS) + && weechat_config_enum (irc_config_look_notice_as_pv) == IRC_CONFIG_LOOK_NOTICE_AS_PV_ALWAYS) { ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_PRIVATE, @@ -7742,7 +7742,7 @@ IRC_PROTOCOL_CALLBACK(sasl_end_fail) IRC_PROTOCOL_RUN_CALLBACK(numeric); - sasl_fail = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_FAIL); + sasl_fail = IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_FAIL); if (!server->is_connected && ((sasl_fail == IRC_SERVER_SASL_FAIL_RECONNECT) || (sasl_fail == IRC_SERVER_SASL_FAIL_DISCONNECT))) diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index a86c2d34a..525e3a603 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -546,7 +546,7 @@ irc_server_sasl_enabled (struct t_irc_server *server) irc_server_sasl_get_creds (server, &sasl_username, &sasl_password, &sasl_key); - sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + sasl_mechanism = IRC_SERVER_OPTION_ENUM( server, IRC_SERVER_OPTION_SASL_MECHANISM); /* @@ -2927,8 +2927,8 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags, NULL, /* pos_arguments */ &pos_channel, &pos_text); - switch (IRC_SERVER_OPTION_INTEGER(server, - IRC_SERVER_OPTION_CHARSET_MESSAGE)) + switch (IRC_SERVER_OPTION_ENUM(server, + IRC_SERVER_OPTION_CHARSET_MESSAGE)) { case IRC_SERVER_CHARSET_MESSAGE_MESSAGE: pos_encode = 0; @@ -3517,8 +3517,8 @@ irc_server_msgq_flush () msg_decoded = NULL; - switch (IRC_SERVER_OPTION_INTEGER(irc_recv_msgq->server, - IRC_SERVER_OPTION_CHARSET_MESSAGE)) + switch (IRC_SERVER_OPTION_ENUM(irc_recv_msgq->server, + IRC_SERVER_OPTION_CHARSET_MESSAGE)) { case IRC_SERVER_CHARSET_MESSAGE_MESSAGE: pos_decode = 0; @@ -3847,8 +3847,7 @@ irc_server_timer_sasl_cb (const void *pointer, void *data, int remaining_calls) weechat_printf (server->buffer, _("%s%s: SASL authentication timeout"), weechat_prefix ("error"), IRC_PLUGIN_NAME); - sasl_fail = IRC_SERVER_OPTION_INTEGER(server, - IRC_SERVER_OPTION_SASL_FAIL); + sasl_fail = IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_FAIL); if ((sasl_fail == IRC_SERVER_SASL_FAIL_RECONNECT) || (sasl_fail == IRC_SERVER_SASL_FAIL_DISCONNECT)) { @@ -4700,7 +4699,7 @@ irc_server_create_buffer (struct t_irc_server *server) struct t_hashtable *buffer_props; ptr_buffer_for_merge = NULL; - switch (weechat_config_integer (irc_config_look_server_buffer)) + switch (weechat_config_enum (irc_config_look_server_buffer)) { case IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE: /* merge with WeeChat core buffer */ @@ -6598,7 +6597,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist, IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_CAPABILITIES))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "sasl_mechanism", - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_MECHANISM))) + IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_MECHANISM))) return 0; if (!weechat_infolist_new_var_string (ptr_item, "sasl_username", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_USERNAME))) @@ -6610,7 +6609,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist, IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_KEY))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "sasl_fail", - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_FAIL))) + IRC_SERVER_OPTION_ENUM(server, IRC_SERVER_OPTION_SASL_FAIL))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "autoconnect", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOCONNECT))) @@ -6984,10 +6983,10 @@ irc_server_print_log () /* sasl_mechanism */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SASL_MECHANISM])) weechat_log_printf (" sasl_mechanism. . . . . . : null ('%s')", - irc_sasl_mechanism_string[IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_SASL_MECHANISM)]); + irc_sasl_mechanism_string[IRC_SERVER_OPTION_ENUM(ptr_server, IRC_SERVER_OPTION_SASL_MECHANISM)]); else weechat_log_printf (" sasl_mechanism. . . . . . : '%s'", - irc_sasl_mechanism_string[weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_SASL_MECHANISM])]); + irc_sasl_mechanism_string[weechat_config_enum (ptr_server->options[IRC_SERVER_OPTION_SASL_MECHANISM])]); /* sasl_username */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SASL_USERNAME])) weechat_log_printf (" sasl_username . . . . . . : null ('%s')", @@ -7010,10 +7009,10 @@ irc_server_print_log () /* sasl_fail */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SASL_FAIL])) weechat_log_printf (" sasl_fail . . . . . . . . : null ('%s')", - irc_server_sasl_fail_string[IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_SASL_FAIL)]); + irc_server_sasl_fail_string[IRC_SERVER_OPTION_ENUM(ptr_server, IRC_SERVER_OPTION_SASL_FAIL)]); else weechat_log_printf (" sasl_fail . . . . . . . . : '%s'", - irc_server_sasl_fail_string[weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_SASL_FAIL])]); + irc_server_sasl_fail_string[weechat_config_enum (ptr_server->options[IRC_SERVER_OPTION_SASL_FAIL])]); /* autoconnect */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT])) weechat_log_printf (" autoconnect . . . . . . . : null (%s)", diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c index 67686abb7..571cd5c87 100644 --- a/src/plugins/logger/logger-buffer.c +++ b/src/plugins/logger/logger-buffer.c @@ -351,7 +351,7 @@ logger_buffer_compress_file (struct t_logger_buffer *logger_buffer) const char *ptr_extension; int compression_type, compression_level; - compression_type = weechat_config_integer ( + compression_type = weechat_config_enum ( logger_config_file_rotation_compression_type); ptr_extension = logger_buffer_compression_extension[compression_type]; @@ -475,7 +475,7 @@ logger_buffer_rotate (struct t_logger_buffer *logger_buffer) logger_buffer->log_filename); } - compression_type = weechat_config_integer ( + compression_type = weechat_config_enum ( logger_config_file_rotation_compression_type); ptr_extension = logger_buffer_compression_extension[compression_type]; diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index 1b5dd5c97..67ebb6020 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -658,7 +658,7 @@ logger_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); logger_config_file_rotation_compression_type = weechat_config_new_option ( logger_config_file, logger_config_section_file, - "rotation_compression_type", "integer", + "rotation_compression_type", "enum", N_("compression type for rotated log files; if set to \"none\", " "rotated log files are not compressed; WARNING: if rotation was " "enabled with another type of compression (or no compression), " diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c index 9b317a1e9..346234147 100644 --- a/src/plugins/trigger/trigger-buffer.c +++ b/src/plugins/trigger/trigger-buffer.c @@ -57,7 +57,7 @@ trigger_buffer_match_filters (struct t_trigger *trigger) { /* check if the hook matches the filter */ if (weechat_strcasecmp ( - trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])], + trigger_hook_type_string[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])], trigger_buffer_filters[i] + 1) == 0) { return 1; @@ -355,7 +355,7 @@ trigger_buffer_display_trigger (struct t_trigger *trigger, "--> %s%lu\t%s: %s%s %s(%s%s%s)%s", weechat_color (weechat_config_string (trigger_config_color_identifier)), context->id, - trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])], + trigger_hook_type_string[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])], weechat_color ("chat_status_enabled"), trigger->name, weechat_color ("chat_delimiters"), diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index 9e7fdbe2d..0e3371e7a 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -147,7 +147,7 @@ trigger_callback_set_common_vars (struct t_trigger *trigger, weechat_hashtable_set ( hashtable, "tg_hook_type", trigger_hook_type_string[ - weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])]); + weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])]); } /* @@ -396,7 +396,7 @@ trigger_callback_regex (struct t_trigger *trigger, ptr_key = (trigger->regex[i].variable) ? trigger->regex[i].variable : - trigger_hook_regex_default_var[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])]; + trigger_hook_regex_default_var[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])]; if (!ptr_key || !ptr_key[0]) { if (trigger_buffer && display_monitor) diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h index dd08687ee..a6ce93fba 100644 --- a/src/plugins/trigger/trigger-callback.h +++ b/src/plugins/trigger/trigger-callback.h @@ -54,7 +54,7 @@ struct t_trigger_context trigger->hook_count_cb++; \ trigger->hook_running = 1; \ trigger_rc = trigger_return_code[ \ - weechat_config_integer ( \ + weechat_config_enum ( \ trigger->options[TRIGGER_OPTION_RETURN_CODE])]; #define TRIGGER_CALLBACK_CB_NEW_POINTERS \ @@ -88,7 +88,7 @@ struct t_trigger_context if (ctx.vars_updated) \ weechat_list_free (ctx.vars_updated); \ trigger->hook_running = 0; \ - switch (weechat_config_integer ( \ + switch (weechat_config_enum ( \ trigger->options[TRIGGER_OPTION_POST_ACTION])) \ { \ case TRIGGER_POST_ACTION_DISABLE: \ diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 5ec8dc079..3947ed822 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -254,8 +254,8 @@ trigger_command_display_trigger (struct t_trigger *trigger, int verbose) trigger->regex, trigger->commands_count, trigger->commands, - weechat_config_integer (trigger->options[TRIGGER_OPTION_RETURN_CODE]), - weechat_config_integer (trigger->options[TRIGGER_OPTION_POST_ACTION]), + weechat_config_enum (trigger->options[TRIGGER_OPTION_RETURN_CODE]), + weechat_config_enum (trigger->options[TRIGGER_OPTION_POST_ACTION]), verbose); } @@ -877,7 +877,7 @@ trigger_command_trigger (const void *pointer, void *data, argv[2]); goto end; } - add_rc = trigger_hook_default_rc[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0]; + add_rc = trigger_hook_default_rc[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0]; arg_arguments = trigger_command_escape_argument ( weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_ARGUMENTS])); arg_conditions = trigger_command_escape_argument ( diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c index 700febc26..56bdbf4d2 100644 --- a/src/plugins/trigger/trigger-config.c +++ b/src/plugins/trigger/trigger-config.c @@ -375,7 +375,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option case TRIGGER_OPTION_HOOK: ptr_option = weechat_config_new_option ( trigger_config_file, trigger_config_section_trigger, - option_name, "integer", + option_name, "enum", N_("type of hook used"), trigger_hook_option_values, 0, 0, value, NULL, 0, @@ -440,7 +440,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option case TRIGGER_OPTION_RETURN_CODE: ptr_option = weechat_config_new_option ( trigger_config_file, trigger_config_section_trigger, - option_name, "integer", + option_name, "enum", N_("return code for hook callback (see plugin API reference to " "know where ok_eat/error can be used efficiently)"), "ok|ok_eat|error", 0, 0, value, NULL, 0, @@ -449,7 +449,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option case TRIGGER_OPTION_POST_ACTION: ptr_option = weechat_config_new_option ( trigger_config_file, trigger_config_section_trigger, - option_name, "integer", + option_name, "enum", N_("action to take on the trigger after execution"), "none|disable|delete", 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index cc71a5af0..4c163caac 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -329,7 +329,7 @@ trigger_hook (struct t_trigger *trigger) 0, NULL); - switch (weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])) + switch (weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])) { case TRIGGER_HOOK_SIGNAL: if (argv && (argc >= 1)) @@ -1290,8 +1290,8 @@ trigger_print_log () weechat_log_printf (" enabled . . . . . . . . : %d", weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_ENABLED])); weechat_log_printf (" hook . . . . . . . . . : %d ('%s')", - weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK]), - trigger_hook_type_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])]); + weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK]), + trigger_hook_type_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK])]); weechat_log_printf (" arguments . . . . . . . : '%s'", weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_ARGUMENTS])); weechat_log_printf (" conditions. . . . . . . : '%s'", @@ -1301,11 +1301,11 @@ trigger_print_log () weechat_log_printf (" command . . . . . . . . : '%s'", weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_COMMAND])); weechat_log_printf (" return_code . . . . . . : %d ('%s')", - weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE]), - trigger_return_code_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE])]); + weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE]), + trigger_return_code_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE])]); weechat_log_printf (" post_action . . . . . . : %d ('%s')", - weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION]), - trigger_post_action_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION])]); + weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION]), + trigger_post_action_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION])]); weechat_log_printf (" hooks_count . . . . . . : %d", ptr_trigger->hooks_count); weechat_log_printf (" hooks . . . . . . . . . : 0x%lx", ptr_trigger->hooks); for (i = 0; i < ptr_trigger->hooks_count; i++) |