diff options
Diffstat (limited to 'src')
372 files changed, 1920 insertions, 1134 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b044f8b96..e7ef8d7ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # Copyright (C) 2007-2008 Julien Louis <ptitlouis@sysif.net> # Copyright (C) 2008-2009 Emmanuel Bouthenot <kolter@openics.org> # diff --git a/src/Makefile.am b/src/Makefile.am index 48bfbb785..75edfa4bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index bb1bf43f4..c2903809c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # Copyright (C) 2008 Julien Louis <ptitlouis@sysif.net> # Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org> # diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 8b015c061..b70f63598 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/core/wee-arraylist.c b/src/core/wee-arraylist.c index ec6052d65..3bc04c77f 100644 --- a/src/core/wee-arraylist.c +++ b/src/core/wee-arraylist.c @@ -1,7 +1,7 @@ /* * wee-arraylist.c - array lists management * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-arraylist.h b/src/core/wee-arraylist.h index f8c43a3f7..33a404dcc 100644 --- a/src/core/wee-arraylist.h +++ b/src/core/wee-arraylist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-backtrace.c b/src/core/wee-backtrace.c index 6e934de2d..c5ea521a8 100644 --- a/src/core/wee-backtrace.c +++ b/src/core/wee-backtrace.c @@ -1,7 +1,7 @@ /* * wee-backtrace.c - backtrace after a segfault * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-backtrace.h b/src/core/wee-backtrace.h index c77843554..9cecf4244 100644 --- a/src/core/wee-backtrace.h +++ b/src/core/wee-backtrace.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-command.c b/src/core/wee-command.c index c128f423c..586ca0b2c 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1,7 +1,7 @@ /* * wee-command.c - WeeChat core commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -2184,14 +2184,6 @@ COMMAND_CALLBACK(filter) if (string_strcasecmp (argv[1], "add") == 0) { COMMAND_MIN_ARGS(6, "add"); - if (gui_filter_search_by_name (argv[2])) - { - gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("%sError: filter \"%s\" already exists"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - argv[2]); - return WEECHAT_RC_OK; - } if ((strcmp (argv[4], "*") == 0) && (strcmp (argv_eol[5], "*") == 0)) { gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, @@ -2201,7 +2193,8 @@ COMMAND_CALLBACK(filter) return WEECHAT_RC_OK; } - ptr_filter = gui_filter_new (1, argv[2], argv[3], argv[4], argv_eol[5]); + ptr_filter = gui_filter_new (1, argv[2], argv[3], argv[4], + argv_eol[5]); if (ptr_filter) { gui_filter_all_buffers (); @@ -2211,12 +2204,6 @@ COMMAND_CALLBACK(filter) argv[2]); command_filter_display (ptr_filter); } - else - { - gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("%sError adding filter"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); - } return WEECHAT_RC_OK; } @@ -5341,183 +5328,85 @@ void command_set_display_option (struct t_config_option *option, const char *message) { - const char *color_name; - const char *display_undefined = _("(undefined)"); - const char *display_default; - char str_default[128]; - int is_file_plugins_conf; + struct t_config_option *ptr_parent_option; + char *value, *inherited_value, *default_value; + int is_file_plugins_conf, is_value_inherited, is_default_value_inherited; + + ptr_parent_option = NULL; + + value = NULL; + inherited_value = NULL; + default_value = NULL; - display_default = NULL; is_file_plugins_conf = (option->config_file && option->config_file->name && (strcmp (option->config_file->name, "plugins") == 0)); + is_value_inherited = 0; + is_default_value_inherited = 0; - if (option->value) + /* check if option has a parent option */ + if (option->parent_name) { - if (!is_file_plugins_conf && !option->default_value) - { - display_default = display_undefined; - } - switch (option->type) - { - case CONFIG_OPTION_TYPE_BOOLEAN: - if (!is_file_plugins_conf && option->default_value - && (CONFIG_BOOLEAN(option) != CONFIG_BOOLEAN_DEFAULT(option))) - { - snprintf (str_default, sizeof (str_default), "%s", - (CONFIG_BOOLEAN_DEFAULT(option)) ? "on" : "off"); - display_default = str_default; - } - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_VALUE), - (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? "on" : "off", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? " (" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", - (display_default) ? _("default: ") : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", - (display_default) ? display_default : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? ")" : ""); - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (!is_file_plugins_conf && option->default_value - && (CONFIG_INTEGER(option) != CONFIG_INTEGER_DEFAULT(option))) - { - if (option->string_values) - { - display_default = option->string_values[CONFIG_INTEGER_DEFAULT(option)]; - } - else - { - snprintf (str_default, sizeof (str_default), - "%d", CONFIG_INTEGER_DEFAULT(option)); - display_default = str_default; - } - } - if (option->string_values) - { - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_VALUE), - option->string_values[CONFIG_INTEGER(option)], - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? " (" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", - (display_default) ? _("default: ") : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", - (display_default) ? display_default : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? ")" : ""); - } - else - { - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%d%s%s%s%s%s%s%s%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_VALUE), - CONFIG_INTEGER(option), - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? " (" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", - (display_default) ? _("default: ") : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", - (display_default) ? display_default : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? ")" : ""); - } - break; - case CONFIG_OPTION_TYPE_STRING: - if (!is_file_plugins_conf && option->default_value - && (strcmp (CONFIG_STRING(option), CONFIG_STRING_DEFAULT(option)) != 0)) - { - display_default = CONFIG_STRING_DEFAULT(option); - } - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = \"%s%s%s\"%s%s%s%s%s%s%s%s%s%s%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_VALUE), - CONFIG_STRING(option), - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? " (" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", - (display_default) ? _("default: ") : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) && display_default != display_undefined ? "\"" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", - (display_default) ? display_default : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) && display_default != display_undefined ? "\"" : "", - (display_default) ? ")" : ""); - break; - case CONFIG_OPTION_TYPE_COLOR: - if (!is_file_plugins_conf && option->default_value - && (CONFIG_COLOR(option) != CONFIG_COLOR_DEFAULT(option))) - { - display_default = gui_color_get_name (CONFIG_COLOR_DEFAULT(option)); - if (display_default == NULL) - { - display_default = _("(unknown)"); - } - } - color_name = gui_color_get_name (CONFIG_COLOR(option)); - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_VALUE), - (color_name) ? color_name : _("(unknown)"), - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? " (" : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", - (display_default) ? _("default: ") : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", - (display_default) ? display_default : "", - (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", - (display_default) ? ")" : ""); - break; - case CONFIG_NUM_OPTION_TYPES: - /* make C compiler happy */ - break; - } + config_file_search_with_string (option->parent_name, NULL, NULL, + &ptr_parent_option, NULL); + if (ptr_parent_option && (ptr_parent_option->type != option->type)) + ptr_parent_option = NULL; } - else + + /* check if the value is inherited from parent option */ + if (!option->value && ptr_parent_option && ptr_parent_option->value) + is_value_inherited = 1; + + value = config_file_option_value_to_string (option, 0, 1, 1); + + if (is_value_inherited) { - gui_chat_printf_date_tags (NULL, 0, - "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s", - (message) ? message : " ", - (option->config_file) ? option->config_file->name : "", - (option->section) ? option->section->name : "", - option->name); + inherited_value = config_file_option_value_to_string ( + ptr_parent_option, 0, 1, 1); } + + if (option->value) + { + if (ptr_parent_option) + { + is_default_value_inherited = 1; + default_value = config_file_option_value_to_string ( + ptr_parent_option, 0, 1, 1); + } + else if (!is_file_plugins_conf + && config_file_option_has_changed (option)) + { + default_value = config_file_option_value_to_string ( + option, 1, 1, 1); + } + } + + gui_chat_printf_date_tags ( + NULL, 0, + "no_trigger," GUI_CHAT_TAG_NO_HIGHLIGHT, + "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s%s", + (message) ? message : " ", + (option->config_file) ? option->config_file->name : "", + (option->section) ? option->section->name : "", + option->name, + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), + (value) ? value : "?", + (inherited_value) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (inherited_value) ? " -> " : "", + (inherited_value) ? inherited_value : "", + (default_value) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (default_value) ? " (" : "", + (default_value) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (default_value) ? ((is_default_value_inherited) ? _("default if null: ") : _("default: ")) : "", + (default_value) ? default_value : "", + (default_value) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (default_value) ? ")" : ""); + + if (value) + free (value); + if (inherited_value) + free (inherited_value); + if (default_value) + free (default_value); } /* @@ -7515,8 +7404,8 @@ command_init () "ignored when looking for keys).\n" "\n" "Examples:\n" - " key alt-x to toggle nicklist bar:\n" - " /key bind meta-x /bar toggle nicklist\n" + " key alt-t to toggle nicklist bar:\n" + " /key bind meta-t /bar toggle nicklist\n" " key alt-r to jump to #weechat IRC channel:\n" " /key bind meta-r /buffer #weechat\n" " restore default binding for key alt-r:\n" diff --git a/src/core/wee-command.h b/src/core/wee-command.h index 759f911a5..3c58aa7e4 100644 --- a/src/core/wee-command.h +++ b/src/core/wee-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c index 489b5fecf..c99265983 100644 --- a/src/core/wee-completion.c +++ b/src/core/wee-completion.c @@ -1,7 +1,7 @@ /* * wee-completion.c - completion for WeeChat commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/core/wee-completion.h b/src/core/wee-completion.h index 96204b4e5..2fc54b0c8 100644 --- a/src/core/wee-completion.h +++ b/src/core/wee-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 473efb640..6b265e060 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -1,7 +1,7 @@ /* * wee-config-file.c - configuration files/sections/options management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -565,6 +565,7 @@ config_file_option_malloc () new_option->config_file = NULL; new_option->section = NULL; new_option->name = NULL; + new_option->parent_name = NULL; new_option->type = 0; new_option->description = NULL; new_option->string_values = NULL; @@ -615,14 +616,31 @@ config_file_new_option (struct t_config_file *config_file, struct t_config_option *new_option; int var_type, int_value, argc, i, index_value; long number; - char *error; + char *error, *pos, *option_name, *parent_name; + + new_option = NULL; + option_name = NULL; + parent_name = NULL; if (!name) - return NULL; + goto error; + + pos = strstr (name, " << "); + if (pos) + { + option_name = string_strndup (name, pos - name); + parent_name = strdup (pos + 4); + } + else + { + option_name = strdup (name); + } if (config_file && section - && config_file_search_option (config_file, section, name)) - return NULL; + && config_file_search_option (config_file, section, option_name)) + { + goto error; + } var_type = -1; for (i = 0; i < CONFIG_NUM_OPTION_TYPES; i++) @@ -638,7 +656,7 @@ config_file_new_option (struct t_config_file *config_file, gui_chat_printf (NULL, "%sError: unknown option type \"%s\"", gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], type); - return NULL; + goto error; } if (!null_value_allowed) @@ -648,7 +666,7 @@ config_file_new_option (struct t_config_file *config_file, else if (!default_value && value) default_value = value; if (!default_value || !value) - return NULL; + goto error; } new_option = config_file_option_malloc (); @@ -656,9 +674,10 @@ config_file_new_option (struct t_config_file *config_file, { new_option->config_file = config_file; new_option->section = section; - new_option->name = strdup (name); + new_option->name = strdup (option_name); if (!new_option->name) goto error; + new_option->parent_name = (parent_name) ? strdup (parent_name) : NULL; new_option->type = var_type; if (description) { @@ -838,15 +857,22 @@ config_file_new_option (struct t_config_file *config_file, } } - return new_option; + goto end; error: if (new_option) { config_file_option_free_data (new_option); free (new_option); + new_option = NULL; } - return NULL; + +end: + if (option_name) + free (option_name); + if (parent_name) + free (parent_name); + return new_option; } /* @@ -1648,12 +1674,17 @@ void config_file_option_rename (struct t_config_option *option, const char *new_name) { - char *str_new_name; + char *str_new_name, *full_old_name, *full_new_name; + struct t_config_file *ptr_config; + struct t_config_section *ptr_section; + struct t_config_option *ptr_option; if (!option || !new_name || !new_name[0] || config_file_search_option (option->config_file, option->section, new_name)) return; + full_old_name = config_file_option_full_name (option); + str_new_name = strdup (new_name); if (str_new_name) { @@ -1679,6 +1710,155 @@ config_file_option_rename (struct t_config_option *option, if (option->section) config_file_option_insert_in_section (option); } + + full_new_name = config_file_option_full_name (option); + + /* rename "parent_name" in any option using the old option name */ + if (full_old_name && full_new_name) + { + for (ptr_config = config_files; ptr_config; + ptr_config = ptr_config->next_config) + { + for (ptr_section = ptr_config->sections; ptr_section; + ptr_section = ptr_section->next_section) + { + for (ptr_option = ptr_section->options; ptr_option; + ptr_option = ptr_option->next_option) + { + if (ptr_option->parent_name + && (strcmp (ptr_option->parent_name, full_old_name) == 0)) + { + free (ptr_option->parent_name); + ptr_option->parent_name = strdup (full_new_name); + } + } + } + } + } + + if (full_old_name) + free (full_old_name); + if (full_new_name) + free (full_new_name); +} + +/* + * Builds a string with the value or default value of option, + * depending on the type of option. + * + * According to default_value: + * 0: value of option is returned + * 1: default value of option is returned + * + * Note: result must be freed after use. + */ + +char * +config_file_option_value_to_string (struct t_config_option *option, + int default_value, + int use_colors, + int use_delimiters) +{ + char *value; + const char *ptr_value; + int enabled, length; + + if ((default_value && !option->default_value) + || (!default_value && !option->value)) + { + length = 7 + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%s", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE_NULL) : "", + "null"); + return value; + } + + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + enabled = (default_value) ? + CONFIG_BOOLEAN_DEFAULT(option) : CONFIG_BOOLEAN(option); + length = 7 + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%s", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (enabled) ? "on" : "off"); + return value; + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (option->string_values) + { + ptr_value = (default_value) ? + option->string_values[CONFIG_INTEGER_DEFAULT(option)] : + option->string_values[CONFIG_INTEGER(option)]; + length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%s", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + ptr_value); + return value; + } + else + { + length = 31 + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%d", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (default_value) ? CONFIG_INTEGER_DEFAULT(option) : CONFIG_INTEGER(option)); + return value; + } + break; + case CONFIG_OPTION_TYPE_STRING: + ptr_value = (default_value) ? CONFIG_STRING_DEFAULT(option) : CONFIG_STRING(option); + length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%s%s%s%s%s", + (use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (use_delimiters) ? "\"" : "", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + ptr_value, + (use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (use_delimiters) ? "\"" : ""); + return value; + break; + case CONFIG_OPTION_TYPE_COLOR: + ptr_value = gui_color_get_name ( + (default_value) ? CONFIG_COLOR_DEFAULT(option) : CONFIG_COLOR(option)); + if (!ptr_value) + return NULL; + length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1; + value = malloc (length); + if (!value) + return NULL; + snprintf (value, length, + "%s%s", + (use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + ptr_value); + return value; + break; + case CONFIG_NUM_OPTION_TYPES: + /* make C compiler happy */ + break; + } + + /* make C static analyzer happy (never executed) */ + return NULL; } /* @@ -1698,6 +1878,8 @@ config_file_option_get_pointer (struct t_config_option *option, return option->section; else if (string_strcasecmp (property, "name") == 0) return option->name; + else if (string_strcasecmp (property, "parent_name") == 0) + return option->parent_name; else if (string_strcasecmp (property, "type") == 0) return &option->type; else if (string_strcasecmp (property, "description") == 0) @@ -2667,6 +2849,8 @@ config_file_option_free_data (struct t_config_option *option) { if (option->name) free (option->name); + if (option->parent_name) + free (option->parent_name); if (option->description) free (option->description); if (option->string_values) @@ -2934,6 +3118,7 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name) HDATA_VAR(struct t_config_option, config_file, POINTER, 0, NULL, "config_file"); HDATA_VAR(struct t_config_option, section, POINTER, 0, NULL, "config_section"); HDATA_VAR(struct t_config_option, name, STRING, 0, NULL, NULL); + HDATA_VAR(struct t_config_option, parent_name, STRING, 0, NULL, NULL); HDATA_VAR(struct t_config_option, type, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_config_option, description, STRING, 0, NULL, NULL); HDATA_VAR(struct t_config_option, string_values, STRING, 0, "*", NULL); @@ -2956,6 +3141,150 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name) } /* + * Adds a configuration option in an infolist. + * + * Returns: + * 1: OK + * 0: error + */ + +int +config_file_add_option_to_infolist(struct t_infolist *infolist, + struct t_config_file *config_file, + struct t_config_section *section, + struct t_config_option *option, + const char *option_name) +{ + char *option_full_name, *value, *string_values; + struct t_config_option *ptr_parent_option; + struct t_infolist_item *ptr_item; + int rc; + + rc = 1; + + option_full_name = config_file_option_full_name (option); + if (!option_full_name) + goto error; + + if (option_name && option_name[0] + && (!string_match (option_full_name, option_name, 0))) + { + goto end; + } + + ptr_item = infolist_new_item (infolist); + if (!ptr_item) + goto error; + + if (!infolist_new_var_string (ptr_item, "full_name", option_full_name)) + goto error; + if (!infolist_new_var_string (ptr_item, "config_name", config_file->name)) + goto error; + if (!infolist_new_var_string (ptr_item, "section_name", section->name)) + goto error; + if (!infolist_new_var_string (ptr_item, "option_name", option->name)) + goto error; + if (!infolist_new_var_string (ptr_item, "parent_name", option->parent_name)) + goto error; + if (!infolist_new_var_string (ptr_item, "description", option->description)) + goto error; + if (!infolist_new_var_string (ptr_item, "description_nls", + (option->description + && option->description[0]) ? + _(option->description) : "")) + { + goto error; + } + string_values = string_build_with_split_string ( + (const char **)option->string_values, "|"); + if (!infolist_new_var_string (ptr_item, "string_values", string_values)) + { + if (string_values) + free (string_values); + goto error; + } + if (string_values) + free (string_values); + if (!infolist_new_var_integer (ptr_item, "min", option->min)) + goto error; + if (!infolist_new_var_integer (ptr_item, "max", option->max)) + goto error; + if (!infolist_new_var_integer (ptr_item, "null_value_allowed", + option->null_value_allowed)) + { + goto error; + } + if (!infolist_new_var_integer (ptr_item, "value_is_null", + (option->value) ? 0 : 1)) + { + goto error; + } + if (!infolist_new_var_integer (ptr_item, + "default_value_is_null", + (option->default_value) ? + 0 : 1)) + { + goto error; + } + if (!infolist_new_var_string (ptr_item, "type", + config_option_type_string[option->type])) + { + goto error; + } + if (option->value) + { + value = config_file_option_value_to_string (option, 0, 0, 0); + if (!value) + goto error; + if (!infolist_new_var_string (ptr_item, "value", value)) + { + free (value); + goto error; + } + free (value); + } + if (option->default_value) + { + value = config_file_option_value_to_string (option, 1, 0, 0); + if (!value) + goto error; + if (!infolist_new_var_string (ptr_item, "default_value", value)) + { + free (value); + goto error; + } + free (value); + } + if (option->parent_name) + { + config_file_search_with_string (option->parent_name, + NULL, NULL, &ptr_parent_option, NULL); + if (ptr_parent_option && ptr_parent_option->value) + { + value = config_file_option_value_to_string (ptr_parent_option, + 0, 0, 0); + if (!value) + goto error; + if (!infolist_new_var_string (ptr_item, "parent_value", value)) + { + free (value); + goto error; + } + free (value); + } + } + + goto end; + +error: + rc = 0; + +end: + free (option_full_name); + return rc; +} + +/* * Adds configuration options in an infolist. * * Returns: @@ -2970,9 +3299,6 @@ config_file_add_to_infolist (struct t_infolist *infolist, struct t_config_file *ptr_config; struct t_config_section *ptr_section; struct t_config_option *ptr_option; - struct t_infolist_item *ptr_item; - int length; - char *option_full_name, value[128], *string_values; if (!infolist) return 0; @@ -2986,280 +3312,13 @@ config_file_add_to_infolist (struct t_infolist *infolist, for (ptr_option = ptr_section->options; ptr_option; ptr_option = ptr_option->next_option) { - length = strlen (ptr_config->name) + 1 + - strlen (ptr_section->name) + 1 + - strlen (ptr_option->name) + 1; - option_full_name = malloc (length); - if (option_full_name) + if (!config_file_add_option_to_infolist (infolist, + ptr_config, + ptr_section, + ptr_option, + option_name)) { - snprintf (option_full_name, length, "%s.%s.%s", - ptr_config->name, - ptr_section->name, - ptr_option->name); - if (!option_name || !option_name[0] - || string_match (option_full_name, option_name, 0)) - { - ptr_item = infolist_new_item (infolist); - if (!ptr_item) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "full_name", - option_full_name)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "config_name", - ptr_config->name)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "section_name", - ptr_section->name)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "option_name", - ptr_option->name)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "description", - ptr_option->description)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_string (ptr_item, - "description_nls", - (ptr_option->description - && ptr_option->description[0]) ? - _(ptr_option->description) : "")) - { - free (option_full_name); - return 0; - } - string_values = string_build_with_split_string ((const char **)ptr_option->string_values, - "|"); - if (!infolist_new_var_string (ptr_item, - "string_values", - string_values)) - { - if (string_values) - free (string_values); - free (option_full_name); - return 0; - } - if (string_values) - free (string_values); - if (!infolist_new_var_integer (ptr_item, - "min", - ptr_option->min)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_integer (ptr_item, - "max", - ptr_option->max)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_integer (ptr_item, - "null_value_allowed", - ptr_option->null_value_allowed)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_integer (ptr_item, - "value_is_null", - (ptr_option->value) ? - 0 : 1)) - { - free (option_full_name); - return 0; - } - if (!infolist_new_var_integer (ptr_item, - "default_value_is_null", - (ptr_option->default_value) ? - 0 : 1)) - { - free (option_full_name); - return 0; - } - switch (ptr_option->type) - { - case CONFIG_OPTION_TYPE_BOOLEAN: - if (!infolist_new_var_string (ptr_item, - "type", - "boolean")) - { - free (option_full_name); - return 0; - } - if (ptr_option->value) - { - if (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) - snprintf (value, sizeof (value), "on"); - else - snprintf (value, sizeof (value), "off"); - if (!infolist_new_var_string (ptr_item, - "value", - value)) - { - free (option_full_name); - return 0; - } - } - if (ptr_option->default_value) - { - if (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) - snprintf (value, sizeof (value), "on"); - else - snprintf (value, sizeof (value), "off"); - if (!infolist_new_var_string (ptr_item, - "default_value", - value)) - { - free (option_full_name); - return 0; - } - } - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (!infolist_new_var_string (ptr_item, - "type", - "integer")) - { - free (option_full_name); - return 0; - } - if (ptr_option->string_values) - { - if (ptr_option->value) - { - if (!infolist_new_var_string (ptr_item, - "value", - ptr_option->string_values[CONFIG_INTEGER(ptr_option)])) - { - free (option_full_name); - return 0; - } - } - if (ptr_option->default_value) - { - if (!infolist_new_var_string (ptr_item, - "default_value", - ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)])) - { - free (option_full_name); - return 0; - } - } - } - else - { - if (ptr_option->value) - { - snprintf (value, sizeof (value), "%d", - CONFIG_INTEGER(ptr_option)); - if (!infolist_new_var_string (ptr_item, - "value", - value)) - { - free (option_full_name); - return 0; - } - } - if (ptr_option->default_value) - { - snprintf (value, sizeof (value), "%d", - CONFIG_INTEGER_DEFAULT(ptr_option)); - if (!infolist_new_var_string (ptr_item, - "default_value", - value)) - { - free (option_full_name); - return 0; - } - } - } - break; - case CONFIG_OPTION_TYPE_STRING: - if (!infolist_new_var_string (ptr_item, - "type", - "string")) - { - free (option_full_name); - return 0; - } - if (ptr_option->value) - { - if (!infolist_new_var_string (ptr_item, - "value", - CONFIG_STRING(ptr_option))) - { - free (option_full_name); - return 0; - } - } - if (ptr_option->default_value) - { - if (!infolist_new_var_string (ptr_item, - "default_value", - CONFIG_STRING_DEFAULT(ptr_option))) - { - free (option_full_name); - return 0; - } - } - break; - case CONFIG_OPTION_TYPE_COLOR: - if (!infolist_new_var_string (ptr_item, - "type", - "color")) - { - free (option_full_name); - return 0; - } - if (ptr_option->value) - { - if (!infolist_new_var_string (ptr_item, - "value", - gui_color_get_name (CONFIG_COLOR(ptr_option)))) - { - free (option_full_name); - return 0; - } - } - if (ptr_option->default_value) - { - if (!infolist_new_var_string (ptr_item, - "default_value", - gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)))) - { - free (option_full_name); - return 0; - } - } - break; - case CONFIG_NUM_OPTION_TYPES: - break; - } - } - free (option_full_name); + return 0; } } } @@ -3327,6 +3386,7 @@ config_file_print_log () log_printf (" config_file. . . . . : 0x%lx", ptr_option->config_file); log_printf (" section. . . . . . . : 0x%lx", ptr_option->section); log_printf (" name . . . . . . . . : '%s'", ptr_option->name); + log_printf (" parent_name. . . . . : '%s'", ptr_option->parent_name); log_printf (" type . . . . . . . . : %d", ptr_option->type); log_printf (" description. . . . . : '%s'", ptr_option->description); log_printf (" string_values. . . . : 0x%lx", ptr_option->string_values); diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h index 29d454418..2d637743e 100644 --- a/src/core/wee-config-file.h +++ b/src/core/wee-config-file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -115,6 +115,8 @@ struct t_config_option struct t_config_file *config_file; /* configuration file */ struct t_config_section *section; /* section */ char *name; /* name */ + char *parent_name; /* parent name (to inherit the */ + /* value from another option) */ enum t_config_option_type type; /* type */ char *description; /* description */ char **string_values; /* allowed string values */ @@ -222,6 +224,10 @@ extern int config_file_option_set_null (struct t_config_option *option, extern int config_file_option_unset (struct t_config_option *option); extern void config_file_option_rename (struct t_config_option *option, const char *new_name); +extern char *config_file_option_value_to_string (struct t_config_option *option, + int default_value, + int add_delimiters, + int use_colors); extern void *config_file_option_get_pointer (struct t_config_option *option, const char *property); extern int config_file_option_is_null (struct t_config_option *option); diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 78a570d0f..a79f5f547 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -1,7 +1,7 @@ /* * wee-config.c - WeeChat configuration options (file weechat.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -148,6 +148,7 @@ struct t_config_option *config_look_mouse; struct t_config_option *config_look_mouse_timer_delay; struct t_config_option *config_look_nick_prefix; struct t_config_option *config_look_nick_suffix; +struct t_config_option *config_look_paste_auto_add_newline; struct t_config_option *config_look_paste_bracketed; struct t_config_option *config_look_paste_bracketed_timer_delay; struct t_config_option *config_look_paste_max_lines; @@ -223,13 +224,13 @@ struct t_config_option *config_color_chat_text_found_bg; struct t_config_option *config_color_chat_time; struct t_config_option *config_color_chat_time_delimiters; struct t_config_option *config_color_chat_value; +struct t_config_option *config_color_chat_value_null; struct t_config_option *config_color_emphasized; struct t_config_option *config_color_emphasized_bg; struct t_config_option *config_color_input_actions; struct t_config_option *config_color_input_text_not_found; struct t_config_option *config_color_nicklist_away; struct t_config_option *config_color_nicklist_group; -struct t_config_option *config_color_nicklist_offline; struct t_config_option *config_color_separator; struct t_config_option *config_color_status_count_highlight; struct t_config_option *config_color_status_count_msg; @@ -2653,6 +2654,12 @@ config_weechat_init_options () N_("text to display after nick in prefix of message, example: \">\""), NULL, 0, 0, "", NULL, 0, NULL, NULL, &config_change_nick_prefix_suffix, NULL, NULL, NULL); + config_look_paste_auto_add_newline = config_file_new_option ( + weechat_config_file, ptr_section, + "paste_auto_add_newline", "boolean", + N_("automatically add a newline at the end of pasted text if there " + "are at least two lines and if a confirmation is asked"), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_paste_bracketed = config_file_new_option ( weechat_config_file, ptr_section, "paste_bracketed", "boolean", @@ -3213,6 +3220,12 @@ config_weechat_init_options () N_("text color for values"), NULL, GUI_COLOR_CHAT_VALUE, 0, "cyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); + config_color_chat_value_null = config_file_new_option ( + weechat_config_file, ptr_section, + "chat_value_null", "color", + N_("text color for null values (undefined)"), + NULL, GUI_COLOR_CHAT_VALUE_NULL, 0, "blue", NULL, 0, + NULL, NULL, &config_change_color, NULL, NULL, NULL); /* emphasis (chat/bars) */ config_color_emphasized = config_file_new_option ( weechat_config_file, ptr_section, @@ -3256,12 +3269,6 @@ config_weechat_init_options () N_("text color for groups in nicklist"), NULL, -1, 0, "green", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); - config_color_nicklist_offline = config_file_new_option ( - weechat_config_file, ptr_section, - "nicklist_offline", "color", - N_("text color for offline nicknames"), - NULL, -1, 0, "blue", NULL, 0, - NULL, NULL, &config_change_color, NULL, NULL, NULL); /* general color settings */ config_color_separator = config_file_new_option ( weechat_config_file, ptr_section, diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 9ce97a4f9..aad2ba0b5 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -194,6 +194,7 @@ extern struct t_config_option *config_look_mouse; extern struct t_config_option *config_look_mouse_timer_delay; extern struct t_config_option *config_look_nick_prefix; extern struct t_config_option *config_look_nick_suffix; +extern struct t_config_option *config_look_paste_auto_add_newline; extern struct t_config_option *config_look_paste_bracketed; extern struct t_config_option *config_look_paste_bracketed_timer_delay; extern struct t_config_option *config_look_paste_max_lines; @@ -267,13 +268,13 @@ extern struct t_config_option *config_color_chat_text_found_bg; extern struct t_config_option *config_color_chat_time; extern struct t_config_option *config_color_chat_time_delimiters; extern struct t_config_option *config_color_chat_value; +extern struct t_config_option *config_color_chat_value_null; extern struct t_config_option *config_color_emphasized; extern struct t_config_option *config_color_emphasized_bg; extern struct t_config_option *config_color_input_actions; extern struct t_config_option *config_color_input_text_not_found; extern struct t_config_option *config_color_nicklist_away; extern struct t_config_option *config_color_nicklist_group; -extern struct t_config_option *config_color_nicklist_offline; extern struct t_config_option *config_color_separator; extern struct t_config_option *config_color_status_count_highlight; extern struct t_config_option *config_color_status_count_msg; diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c index bb82027ab..9fc4560e9 100644 --- a/src/core/wee-debug.c +++ b/src/core/wee-debug.c @@ -1,7 +1,7 @@ /* * wee-debug.c - debug functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-debug.h b/src/core/wee-debug.h index 6b7394fc5..ab018aece 100644 --- a/src/core/wee-debug.h +++ b/src/core/wee-debug.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index b16225661..fb3ca8ec4 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -1,7 +1,7 @@ /* * wee-eval.c - evaluate expressions with references to internal vars * - * Copyright (C) 2012-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2012-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-eval.h b/src/core/wee-eval.h index 7aaf81f78..0670cb77c 100644 --- a/src/core/wee-eval.h +++ b/src/core/wee-eval.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2012-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index 63916ee20..eb9613b12 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -1,7 +1,7 @@ /* * wee-hashtable.c - implementation of hashtable * - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-hashtable.h b/src/core/wee-hashtable.h index c203b9636..941a95b13 100644 --- a/src/core/wee-hashtable.h +++ b/src/core/wee-hashtable.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index 84c2fbae7..16c8abaab 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -1,7 +1,7 @@ /* * wee-hdata.c - direct access to WeeChat data using hashtables * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h index 860da7e54..869e431b5 100644 --- a/src/core/wee-hdata.h +++ b/src/core/wee-hdata.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index c0c195eef..c7100260e 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1,7 +1,7 @@ /* * wee-hook.c - WeeChat hooks management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h index 82de5b7bd..d0fc10fc3 100644 --- a/src/core/wee-hook.h +++ b/src/core/wee-hook.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/core/wee-infolist.c b/src/core/wee-infolist.c index 70f0c8ff5..fc2508479 100644 --- a/src/core/wee-infolist.c +++ b/src/core/wee-infolist.c @@ -1,7 +1,7 @@ /* * wee-infolist.c - info lists management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-infolist.h b/src/core/wee-infolist.h index 1a890f81b..1c753c815 100644 --- a/src/core/wee-infolist.h +++ b/src/core/wee-infolist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-input.c b/src/core/wee-input.c index aba0b04cb..8927d55d4 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -1,7 +1,7 @@ /* * wee-input.c - default input callback for buffers * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-input.h b/src/core/wee-input.h index 1a1d6fce9..f4add7a39 100644 --- a/src/core/wee-input.h +++ b/src/core/wee-input.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-list.c b/src/core/wee-list.c index 7ea9027a4..b14f78358 100644 --- a/src/core/wee-list.c +++ b/src/core/wee-list.c @@ -1,7 +1,7 @@ /* * wee-list.c - sorted lists * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-list.h b/src/core/wee-list.h index 0376d784b..203347337 100644 --- a/src/core/wee-list.h +++ b/src/core/wee-list.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-log.c b/src/core/wee-log.c index 89c844294..4edf3e910 100644 --- a/src/core/wee-log.c +++ b/src/core/wee-log.c @@ -1,7 +1,7 @@ /* * wee-log.c - WeeChat log file (weechat.log) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -115,7 +115,7 @@ log_init () string_iconv_fprintf (stderr, _("Error: unable to create/append to log file (weechat.log)\n" "If another WeeChat process is using this file, try to run WeeChat\n" - "with another home using \"--dir\" command line option.\n")); + "with another home using the \"--dir\" command line option.\n")); exit (1); } log_printf ("WeeChat %s (%s %s %s)", diff --git a/src/core/wee-log.h b/src/core/wee-log.h index 9763afa3c..ee9b4f462 100644 --- a/src/core/wee-log.h +++ b/src/core/wee-log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-network.c b/src/core/wee-network.c index 7eb94ca49..d68bbefcd 100644 --- a/src/core/wee-network.c +++ b/src/core/wee-network.c @@ -1,7 +1,7 @@ /* * wee-network.c - network functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2010 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2010 Gu1ll4um3r0m41n <aeroxteam@gmail.com> * Copyright (C) 2012 Simon Arlott @@ -1634,6 +1634,19 @@ network_connect_with_fork (struct t_hook *hook_connect) unhook (hook_connect); return; } + rc = gnutls_server_name_set (*HOOK_CONNECT(hook_connect, gnutls_sess), + GNUTLS_NAME_DNS, + HOOK_CONNECT(hook_connect, address), + strlen (HOOK_CONNECT(hook_connect, address))); + if (rc != GNUTLS_E_SUCCESS) + { + (void) (HOOK_CONNECT(hook_connect, callback)) + (hook_connect->callback_data, + WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR, + 0, -1, _("set server name indication (SNI) failed"), NULL); + unhook (hook_connect); + return; + } rc = gnutls_priority_set_direct (*HOOK_CONNECT(hook_connect, gnutls_sess), HOOK_CONNECT(hook_connect, gnutls_priorities), &pos_error); diff --git a/src/core/wee-network.h b/src/core/wee-network.h index 29e712d79..bcf5d6b69 100644 --- a/src/core/wee-network.h +++ b/src/core/wee-network.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c index de9e36f8a..d9aa3183b 100644 --- a/src/core/wee-proxy.c +++ b/src/core/wee-proxy.c @@ -1,7 +1,7 @@ /* * wee-proxy.c - proxy functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-proxy.h b/src/core/wee-proxy.h index d1ffb05bc..732d6d876 100644 --- a/src/core/wee-proxy.h +++ b/src/core/wee-proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-secure.c b/src/core/wee-secure.c index cc8da3346..4931dd06d 100644 --- a/src/core/wee-secure.c +++ b/src/core/wee-secure.c @@ -1,7 +1,7 @@ /* * wee-secure.c - secured data configuration options (file sec.conf) * - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-secure.h b/src/core/wee-secure.h index 563b60b49..8ed18461d 100644 --- a/src/core/wee-secure.h +++ b/src/core/wee-secure.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 9ae23d7f3..e40538176 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -1,7 +1,7 @@ /* * wee-string.c - string functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -1587,17 +1587,30 @@ string_replace_regex (const char *string, void *regex, const char *replace, * This function must not be called directly (call string_split or * string_split_shared instead). * + * According to keep_eol value: + * 0: standard split + * 1: each argument contains the argument and all the following arguments + * 2: same as 1, and separator is kept at the end of string. + * * Examples: - * string_split ("abc de fghi", " ", 0, 0, NULL) - * ==> array[0] = "abc" - * array[1] = "de" - * array[2] = "fghi" - * array[3] = NULL - * string_split ("abc de fghi", " ", 1, 0, NULL) - * ==> array[0] = "abc de fghi" - * array[1] = "de fghi" - * array[2] = "fghi" - * array[3] = NULL + * string_split ("abc de fghi ", " ", 0, 0, &argc) + * ==> array[0] == "abc" + * array[1] == "de" + * array[2] == "fghi" + * array[3] == NULL + * argc == 3 + * string_split ("abc de fghi ", " ", 1, 0, &argc) + * ==> array[0] == "abc de fghi" + * array[1] == "de fghi" + * array[2] == "fghi" + * array[3] == NULL + * argc == 3 + * string_split ("abc de fghi ", " ", 2, 0, &argc) + * ==> array[0] == "abc de fghi " + * array[1] == "de fghi " + * array[2] == "fghi " + * array[3] == NULL + * argc == 3 */ char ** @@ -1628,7 +1641,8 @@ string_split_internal (const char *string, const char *separators, int keep_eol, { ptr++; } - i++; + if (ptr[0]) + i++; } n_items = i; @@ -2825,6 +2839,14 @@ string_input_for_buffer (const char *string) if (!string) return NULL; + /* a single "/" is not a command */ + if (strcmp (string, "/") == 0) + return string; + + /* "/ " is not a command */ + if (strncmp (string, "/ ", 2) == 0) + return string; + /* special case for C comments pasted in input line */ if (strncmp (string, "/*", 2) == 0) return string; @@ -2839,7 +2861,7 @@ string_input_for_buffer (const char *string) pos_space = strchr (string + 1, ' '); /* - * if there's no other '/' or if '/' is after first space, + * if there are no other '/' or if '/' is after first space, * then it is a command, and return NULL */ if (!pos_slash || (pos_space && pos_slash > pos_space)) @@ -2854,9 +2876,13 @@ string_input_for_buffer (const char *string) next_char = utf8_next_char (string); - /* there's no next char, then it's a command */ + /* there's no next char, then it's a not command */ if (!next_char || !next_char[0]) - return NULL; + return string; + + /* next char is a space, then it's not a command */ + if (next_char[0] == ' ') + return string; /* check if first char is doubled: if yes, then it's not a command */ if (utf8_charcmp (string, next_char) == 0) diff --git a/src/core/wee-string.h b/src/core/wee-string.h index 55899dead..f760b98d0 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c index 60bf14bae..4623c340f 100644 --- a/src/core/wee-upgrade-file.c +++ b/src/core/wee-upgrade-file.c @@ -1,7 +1,7 @@ /* * wee-upgrade-file.c - save/restore data for upgrading WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-upgrade-file.h b/src/core/wee-upgrade-file.h index b991868bf..5ad2139b3 100644 --- a/src/core/wee-upgrade-file.h +++ b/src/core/wee-upgrade-file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 806809f40..fb3a33b20 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -1,7 +1,7 @@ /* * wee-upgrade.c - save/restore session data of WeeChat core * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-upgrade.h b/src/core/wee-upgrade.h index ebb77a559..28da38e7f 100644 --- a/src/core/wee-upgrade.h +++ b/src/core/wee-upgrade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-url.c b/src/core/wee-url.c index 8994233e9..c46e1ea52 100644 --- a/src/core/wee-url.c +++ b/src/core/wee-url.c @@ -1,7 +1,7 @@ /* * wee-url.c - URL transfer * - * Copyright (C) 2012-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2012-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-url.h b/src/core/wee-url.h index be90abda3..cabd242e5 100644 --- a/src/core/wee-url.h +++ b/src/core/wee-url.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2012-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c index 7cfb8a875..bcff2340a 100644 --- a/src/core/wee-utf8.c +++ b/src/core/wee-utf8.c @@ -1,7 +1,7 @@ /* * wee-utf8.c - UTF-8 string functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/core/wee-utf8.h b/src/core/wee-utf8.h index abdf96b2b..29391280f 100644 --- a/src/core/wee-utf8.h +++ b/src/core/wee-utf8.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-util.c b/src/core/wee-util.c index d4d4e8d8f..f3c6c7a88 100644 --- a/src/core/wee-util.c +++ b/src/core/wee-util.c @@ -1,7 +1,7 @@ /* * wee-util.c - some useful functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-util.h b/src/core/wee-util.h index 583dfc0d9..ed4b8e042 100644 --- a/src/core/wee-util.h +++ b/src/core/wee-util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-version.c b/src/core/wee-version.c index 54942e65d..252907f16 100644 --- a/src/core/wee-version.c +++ b/src/core/wee-version.c @@ -1,7 +1,7 @@ /* * wee-version.c - functions for WeeChat version * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/wee-version.h b/src/core/wee-version.h index 8a6ff6648..63c189269 100644 --- a/src/core/wee-version.h +++ b/src/core/wee-version.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/core/weechat.c b/src/core/weechat.c index db11e991a..e011c2e94 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -17,7 +17,7 @@ * * weechat.c - WeeChat main functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -191,7 +191,11 @@ weechat_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--dir") == 0)) { if (i + 1 < argc) + { + if (weechat_home) + free (weechat_home); weechat_home = strdup (argv[++i]); + } else { string_iconv_fprintf (stderr, @@ -255,7 +259,11 @@ weechat_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--run-command") == 0)) { if (i + 1 < argc) + { + if (weechat_startup_commands) + free (weechat_startup_commands); weechat_startup_commands = strdup (argv[++i]); + } else { string_iconv_fprintf (stderr, @@ -462,35 +470,62 @@ void weechat_term_check () { char *term, *sty, *tmux; + const char *screen_terms = "screen-256color, screen"; + const char *tmux_terms = "tmux-256color, tmux, screen-256color, screen"; + const char *ptr_terms; int is_term_ok, is_screen, is_tmux; term = getenv ("TERM"); sty = getenv ("STY"); tmux = getenv ("TMUX"); - is_term_ok = (term && (strncmp (term, "screen", 6) == 0)); is_screen = (sty && sty[0]); is_tmux = (tmux && tmux[0]); - if ((is_screen || is_tmux) && !is_term_ok) + if (is_screen || is_tmux) { - gui_chat_printf ( - NULL, - /* TRANSLATORS: the "under %s" can be "under screen" or "under tmux" */ - _("%sWarning: WeeChat is running under %s and $TERM is \"%s\", " - "which can cause display bugs; $TERM should be set to " - "\"screen-256color\" or \"screen\""), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - (is_screen) ? "screen" : "tmux", - (term) ? term : ""); - gui_chat_printf ( - NULL, - _("%sYou should add this line in the file %s: %s"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - (is_screen) ? "~/.screenrc" : "~/.tmux.conf", - (is_screen) ? - "term screen-256color" : - "set -g default-terminal \"screen-256color\""); + /* check if $TERM is OK (according to screen/tmux) */ + is_term_ok = 0; + ptr_terms = NULL; + if (is_screen) + { + is_term_ok = (term && (strncmp (term, "screen", 6) == 0)); + ptr_terms = screen_terms; + } + else if (is_tmux) + { + is_term_ok = (term + && ((strncmp (term, "screen", 6) == 0) + || (strncmp (term, "tmux", 4) == 0))); + ptr_terms = tmux_terms; + } + + /* display a warning if $TERM is NOT OK */ + if (!is_term_ok) + { + gui_chat_printf_date_tags ( + NULL, + 0, + "term_warning", + /* TRANSLATORS: the "under %s" can be "under screen" or "under tmux" */ + _("%sWarning: WeeChat is running under %s and $TERM is \"%s\", " + "which can cause display bugs; $TERM should be set to one " + "of these values: %s"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + (is_screen) ? "screen" : "tmux", + (term) ? term : "", + ptr_terms); + gui_chat_printf_date_tags ( + NULL, + 0, + "term_warning", + _("%sYou should add this line in the file %s: %s"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + (is_screen) ? "~/.screenrc" : "~/.tmux.conf", + (is_screen) ? + "term screen-256color" : + "set -g default-terminal \"tmux-256color\""); + } } } @@ -578,18 +613,17 @@ weechat_shutdown (int return_code, int crash) { gui_chat_print_lines_waiting_buffer (stderr); + log_close (); + network_end (); + debug_end (); + if (weechat_argv0) free (weechat_argv0); if (weechat_home) free (weechat_home); - log_close (); if (weechat_local_charset) free (weechat_local_charset); - network_end (); - - debug_end (); - if (crash) abort(); else if (return_code >= 0) diff --git a/src/core/weechat.h b/src/core/weechat.h index fb895a63e..16c3011cc 100644 --- a/src/core/weechat.h +++ b/src/core/weechat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -51,7 +51,7 @@ #endif /* !defined(_) */ -#define WEECHAT_COPYRIGHT_DATE "(C) 2003-2015" +#define WEECHAT_COPYRIGHT_DATE "(C) 2003-2016" #define WEECHAT_WEBSITE "https://weechat.org/" #define WEECHAT_WEBSITE_DOWNLOAD "https://weechat.org/download" diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index b9cdf0654..6a4d89156 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index d7db9d549..6ecaca6f8 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt index 284956f70..81af7bd34 100644 --- a/src/gui/curses/CMakeLists.txt +++ b/src/gui/curses/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # Copyright (C) 2007-2008 Julien Louis <ptitlouis@sysif.net> # Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org> # diff --git a/src/gui/curses/Makefile.am b/src/gui/curses/Makefile.am index bdcc0f4f5..2e04ff820 100644 --- a/src/gui/curses/Makefile.am +++ b/src/gui/curses/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 8c6749cd8..393c65b16 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -1,7 +1,7 @@ /* * gui-curses-bar-window.c - bar window functions for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 0bbd1810e..05586d037 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -1,7 +1,7 @@ /* * gui-curses-chat.c - chat display functions for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index 2bdfc52da..e6f9b86fc 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -1,7 +1,7 @@ /* * gui-curses-color.c - color functions for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -1462,6 +1462,7 @@ gui_color_init_weechat () gui_color_build (GUI_COLOR_CHAT_NICK_SUFFIX, CONFIG_COLOR(config_color_chat_nick_suffix), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_EMPHASIS, CONFIG_COLOR(config_color_emphasized), CONFIG_COLOR(config_color_emphasized_bg)); gui_color_build (GUI_COLOR_CHAT_DAY_CHANGE, CONFIG_COLOR(config_color_chat_day_change), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_VALUE_NULL, CONFIG_COLOR(config_color_chat_value_null), CONFIG_COLOR(config_color_chat_bg)); /* * define old nick colors for compatibility on /upgrade with previous diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c index d9fd89367..263ac1661 100644 --- a/src/gui/curses/gui-curses-key.c +++ b/src/gui/curses/gui-curses-key.c @@ -1,7 +1,7 @@ /* * gui-curses-key.c - keyboard functions for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 090c1ef04..210e1e4f8 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -1,7 +1,7 @@ /* * gui-curses-main.c - main loop for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-mouse.c b/src/gui/curses/gui-curses-mouse.c index dcd9c1070..945837137 100644 --- a/src/gui/curses/gui-curses-mouse.c +++ b/src/gui/curses/gui-curses-mouse.c @@ -1,7 +1,7 @@ /* * gui-curses-mouse.c - mouse functions for Curses GUI * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-term.c b/src/gui/curses/gui-curses-term.c index c5408bbcd..53a16f373 100644 --- a/src/gui/curses/gui-curses-term.c +++ b/src/gui/curses/gui-curses-term.c @@ -1,7 +1,7 @@ /* * gui-curses-term.c - terminal functions for Curses GUI * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index af0a69c91..20856b3d9 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -1,7 +1,7 @@ /* * gui-curses-window.c - window display functions for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index 682c98596..43d80bfbb 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/curses/main.c b/src/gui/curses/main.c index 9a7211272..09df7bbea 100644 --- a/src/gui/curses/main.c +++ b/src/gui/curses/main.c @@ -1,7 +1,7 @@ /* * main.c - entry point for Curses GUI * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index d3eea0512..365173dbc 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1,7 +1,7 @@ /* * gui-bar-item.c - bar item functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar-item.h b/src/gui/gui-bar-item.h index b70bd7934..c995a0a30 100644 --- a/src/gui/gui-bar-item.h +++ b/src/gui/gui-bar-item.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index ad09d563d..f1fd037a1 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -1,7 +1,7 @@ /* * gui-bar-window.c - bar window functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar-window.h b/src/gui/gui-bar-window.h index 485c9c219..dff86ec56 100644 --- a/src/gui/gui-bar-window.h +++ b/src/gui/gui-bar-window.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index f71bc8147..123321118 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -1,7 +1,7 @@ /* * gui-bar.c - bar functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h index bde879822..ff7e2a805 100644 --- a/src/gui/gui-bar.h +++ b/src/gui/gui-bar.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 3ff61f171..d62c5e0c6 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1,7 +1,7 @@ /* * gui-buffer.c - buffer functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index d533d0ba6..8e6b90b14 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 0c2ced0c7..d2dd538b2 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -1,7 +1,7 @@ /* * gui-chat.c - chat functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h index 70c73edd9..e52cd5af2 100644 --- a/src/gui/gui-chat.h +++ b/src/gui/gui-chat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index 470bc7a97..e2c9bb4c9 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -1,7 +1,7 @@ /* * gui-color.c - color functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index b67d2876d..184e6d8ae 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -26,10 +26,13 @@ struct t_config_option; /* * Color from configuration options. + * * When changing some colors below: * - always add to the end * - never remove a color (mark it as obsolete if needed) * - do not re-use an obsolete color + * - add build of color in file src/gui/curses/gui-curses-color.c, + * function gui_color_init_weechat () * - update the Developer's guide */ @@ -84,6 +87,7 @@ enum t_gui_color_enum GUI_COLOR_CHAT_NICK_SUFFIX, GUI_COLOR_EMPHASIS, GUI_COLOR_CHAT_DAY_CHANGE, + GUI_COLOR_CHAT_VALUE_NULL, /* number of colors */ GUI_COLOR_NUM_COLORS, diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 0e07b96da..4ef7d37c6 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1,7 +1,7 @@ /* * gui-completion.c - word completion according to context (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h index ce214a0e3..b80c8f1a3 100644 --- a/src/gui/gui-completion.h +++ b/src/gui/gui-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-cursor.c b/src/gui/gui-cursor.c index 7fabd6941..f876375e7 100644 --- a/src/gui/gui-cursor.c +++ b/src/gui/gui-cursor.c @@ -1,7 +1,7 @@ /* * gui-cursor.c - functions for free movement of cursor (used by all GUI) * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-cursor.h b/src/gui/gui-cursor.h index ce2257313..3958ec165 100644 --- a/src/gui/gui-cursor.h +++ b/src/gui/gui-cursor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index df0fa1619..b2da42a16 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -1,7 +1,7 @@ /* * gui-filter.c - filter functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -38,6 +38,7 @@ #include "../plugins/plugin.h" #include "gui-filter.h" #include "gui-buffer.h" +#include "gui-chat.h" #include "gui-line.h" #include "gui-window.h" @@ -254,6 +255,21 @@ gui_filter_search_by_name (const char *name) } /* + * Displays an error when a new filter is created. + */ + +void +gui_filter_new_error (const char *name, const char *error) +{ + gui_chat_printf_date_tags ( + NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("%sError adding filter \"%s\": %s"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + (name) ? name : "", + error); +} + +/* * Creates a new filter. * * Returns pointer to new filter, NULL if error. @@ -265,15 +281,22 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, { struct t_gui_filter *new_filter; regex_t *regex1, *regex2; - char *pos_tab, *regex_prefix, **tags_array; + char *pos_tab, *regex_prefix, **tags_array, buf[512], str_error[512]; const char *ptr_start_regex, *pos_regex_message; - int i; + int i, rc; if (!name || !buffer_name || !tags || !regex) + { + gui_filter_new_error (name, _("not enough arguments")); return NULL; + } if (gui_filter_search_by_name (name)) + { + gui_filter_new_error (name, + _("a filter with same name already exists")); return NULL; + } ptr_start_regex = regex; if ((ptr_start_regex[0] == '!') @@ -305,9 +328,16 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, regex1 = malloc (sizeof (*regex1)); if (regex1) { - if (string_regcomp (regex1, regex_prefix, - REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0) + rc = string_regcomp (regex1, regex_prefix, + REG_EXTENDED | REG_ICASE | REG_NOSUB); + if (rc != 0) { + regerror (rc, regex1, buf, sizeof (buf)); + snprintf (str_error, sizeof (str_error), + /* TRANSLATORS: %s is the error returned by regerror */ + _("invalid regular expression (%s)"), + buf); + gui_filter_new_error (name, str_error); free (regex_prefix); free (regex1); return NULL; @@ -320,9 +350,16 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, regex2 = malloc (sizeof (*regex2)); if (regex2) { - if (string_regcomp (regex2, pos_regex_message, - REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0) + rc = string_regcomp (regex2, pos_regex_message, + REG_EXTENDED | REG_ICASE | REG_NOSUB); + if (rc != 0) { + regerror (rc, regex2, buf, sizeof (buf)); + snprintf (str_error, sizeof (str_error), + /* TRANSLATORS: %s is the error returned by regerror */ + _("invalid regular expression (%s)"), + buf); + gui_filter_new_error (name, str_error); if (regex_prefix) free (regex_prefix); if (regex1) @@ -390,6 +427,10 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, (void) hook_signal_send ("filter_added", WEECHAT_HOOK_SIGNAL_POINTER, new_filter); } + else + { + gui_filter_new_error (name, _("not enough memory")); + } return new_filter; } diff --git a/src/gui/gui-filter.h b/src/gui/gui-filter.h index 4c89d46b6..0eb86bafc 100644 --- a/src/gui/gui-filter.h +++ b/src/gui/gui-filter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-focus.c b/src/gui/gui-focus.c index 91606e4f1..321296762 100644 --- a/src/gui/gui-focus.c +++ b/src/gui/gui-focus.c @@ -1,7 +1,7 @@ /* * gui-focus.c - functions about focus (cursor mode and mouse) (used by all GUI) * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-focus.h b/src/gui/gui-focus.h index 771b9db97..22c3bc4a4 100644 --- a/src/gui/gui-focus.h +++ b/src/gui/gui-focus.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c index 74d04256e..7c72ec9e8 100644 --- a/src/gui/gui-history.c +++ b/src/gui/gui-history.c @@ -1,7 +1,7 @@ /* * gui-history.c - memorize commands or text for buffers (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/gui/gui-history.h b/src/gui/gui-history.h index b7ff62c71..d4d17d00b 100644 --- a/src/gui/gui-history.h +++ b/src/gui/gui-history.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index e15236a63..8c261ece6 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -1,7 +1,7 @@ /* * gui-hotlist.c - hotlist management (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-hotlist.h b/src/gui/gui-hotlist.h index 15f1bce25..79760908e 100644 --- a/src/gui/gui-hotlist.h +++ b/src/gui/gui-hotlist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index a635c021f..9d543acb2 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -1,7 +1,7 @@ /* * gui-input.c - input functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h index 832c80671..b36c2d1bb 100644 --- a/src/gui/gui-input.h +++ b/src/gui/gui-input.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 97c50c5c3..436d878af 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1,7 +1,7 @@ /* * gui-key.c - keyboard functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -1816,7 +1816,8 @@ gui_key_paste_accept () * add final newline if there is not in pasted text * (for at least 2 lines pasted) */ - if ((gui_key_get_paste_lines () > 1) + if (CONFIG_BOOLEAN(config_look_paste_auto_add_newline) + && (gui_key_get_paste_lines () > 1) && (gui_key_buffer_size > 0) && (gui_key_buffer[gui_key_buffer_size - 1] != '\r') && (gui_key_buffer[gui_key_buffer_size - 1] != '\n')) diff --git a/src/gui/gui-key.h b/src/gui/gui-key.h index e6af2d88a..ccbfab515 100644 --- a/src/gui/gui-key.h +++ b/src/gui/gui-key.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c index 14e33e489..8f335c9ec 100644 --- a/src/gui/gui-layout.c +++ b/src/gui/gui-layout.c @@ -1,7 +1,7 @@ /* * gui-layout.c - layout functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-layout.h b/src/gui/gui-layout.h index 61d149128..968af3afb 100644 --- a/src/gui/gui-layout.h +++ b/src/gui/gui-layout.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 9b3ad32fe..14a529376 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -1,7 +1,7 @@ /* * gui-line.c - line functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-line.h b/src/gui/gui-line.h index d8660f643..015be32e1 100644 --- a/src/gui/gui-line.h +++ b/src/gui/gui-line.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-main.h b/src/gui/gui-main.h index 251f8b7dc..13e164efd 100644 --- a/src/gui/gui-main.h +++ b/src/gui/gui-main.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-mouse.c b/src/gui/gui-mouse.c index b60c52a0e..2002162c1 100644 --- a/src/gui/gui-mouse.c +++ b/src/gui/gui-mouse.c @@ -1,7 +1,7 @@ /* * gui-mouse.c - functions for mouse (used by all GUI) * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-mouse.h b/src/gui/gui-mouse.h index 41f703c97..b5315c79e 100644 --- a/src/gui/gui-mouse.h +++ b/src/gui/gui-mouse.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index 7b533a80b..0c907ef6f 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -1,7 +1,7 @@ /* * gui-nicklist.c - nicklist functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-nicklist.h b/src/gui/gui-nicklist.h index 81b815ec6..03c8f59e3 100644 --- a/src/gui/gui-nicklist.h +++ b/src/gui/gui-nicklist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 825fd47ba..c81f9d16e 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1,7 +1,7 @@ /* * gui-window.c - window functions (used by all GUI) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h index f0f9387ec..87f957141 100644 --- a/src/gui/gui-window.h +++ b/src/gui/gui-window.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index ce7546859..40d73e10d 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org> # # This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 4836aec07..aa46965f7 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # Copyright (C) 2006-2009 Emmanuel Bouthenot <kolter@openics.org> # # This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/alias/CMakeLists.txt b/src/plugins/alias/CMakeLists.txt index 7214efbc3..8f1c39958 100644 --- a/src/plugins/alias/CMakeLists.txt +++ b/src/plugins/alias/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/alias/Makefile.am b/src/plugins/alias/Makefile.am index 0214ef60d..fb9cffa96 100644 --- a/src/plugins/alias/Makefile.am +++ b/src/plugins/alias/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/alias/alias-command.c b/src/plugins/alias/alias-command.c index 74c1964ff..59975387d 100644 --- a/src/plugins/alias/alias-command.c +++ b/src/plugins/alias/alias-command.c @@ -1,7 +1,7 @@ /* * alias-command.c - alias commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -123,11 +123,36 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, weechat_printf (NULL, _("All aliases:")); } } - weechat_printf (NULL, " %s %s=>%s %s", - ptr_alias->name, - weechat_color ("chat_delimiters"), - weechat_color ("chat"), - ptr_alias->command); + ptr_option = weechat_config_search_option ( + alias_config_file, + alias_config_section_completion, + ptr_alias->name); + if (ptr_option) + { + weechat_printf ( + NULL, + " %s %s=>%s %s %s(%s%s %s%s)%s", + ptr_alias->name, + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + ptr_alias->command, + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + _("completion:"), + weechat_config_string (ptr_option), + weechat_color ("chat_delimiters"), + weechat_color ("chat")); + } + else + { + weechat_printf ( + NULL, + " %s %s=>%s %s", + ptr_alias->name, + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + ptr_alias->command); + } alias_found = 1; } } @@ -190,7 +215,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, ptr_option = weechat_config_search_option ( alias_config_file, alias_config_section_cmd, - ptr_alias_name); + ptr_alias_name); if (ptr_option) weechat_config_option_free (ptr_option); ptr_option = weechat_config_search_option ( diff --git a/src/plugins/alias/alias-command.h b/src/plugins/alias/alias-command.h index 14b75dbef..033a9bf28 100644 --- a/src/plugins/alias/alias-command.h +++ b/src/plugins/alias/alias-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-completion.c b/src/plugins/alias/alias-completion.c index 44a590abc..42e3a553e 100644 --- a/src/plugins/alias/alias-completion.c +++ b/src/plugins/alias/alias-completion.c @@ -1,7 +1,7 @@ /* * alias-completion.c - completion for alias commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-completion.h b/src/plugins/alias/alias-completion.h index eb5ca1e0d..3808c9319 100644 --- a/src/plugins/alias/alias-completion.h +++ b/src/plugins/alias/alias-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c index 2a892649c..9a2128b39 100644 --- a/src/plugins/alias/alias-config.c +++ b/src/plugins/alias/alias-config.c @@ -1,7 +1,7 @@ /* * alias-config.c - alias configuration options (file alias.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-config.h b/src/plugins/alias/alias-config.h index 9d7ce25ec..714abfcde 100644 --- a/src/plugins/alias/alias-config.h +++ b/src/plugins/alias/alias-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-info.c b/src/plugins/alias/alias-info.c index f91a12487..600f0c8c2 100644 --- a/src/plugins/alias/alias-info.c +++ b/src/plugins/alias/alias-info.c @@ -1,7 +1,7 @@ /* * alias-info.c - info and infolist hooks for alias plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias-info.h b/src/plugins/alias/alias-info.h index 3d0a65ba1..a06373a74 100644 --- a/src/plugins/alias/alias-info.h +++ b/src/plugins/alias/alias-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index d4e3126ff..db02f987c 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -1,7 +1,7 @@ /* * alias.c - alias plugin for WeeChat: command aliases * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -572,6 +572,33 @@ alias_update_completion (struct t_alias *alias, const char *completion) } /* + * Checks if an alias name is valid: it must not contain any slashes nor + * any spaces. + * + * Returns: + * 1: name is valid + * 0: name is invalid + */ + +int +alias_name_valid (const char *name) +{ + if (!name || !name[0]) + return 0; + + /* no spaces allowed */ + if (strchr (name, ' ')) + return 0; + + /* no slashes allowed */ + if (strchr (name, '/')) + return 0; + + /* name is valid */ + return 1; +} + +/* * Creates a new alias and adds it to alias list. * * Returns pointer to new alias, NULL if error. @@ -582,7 +609,16 @@ alias_new (const char *name, const char *command, const char *completion) { struct t_alias *new_alias, *ptr_alias, *pos_alias; - if (!name || !name[0] || !command || !command[0]) + if (!alias_name_valid (name)) + { + weechat_printf (NULL, + _("%s%s: invalid alias name: \"%s\""), + weechat_prefix ("error"), ALIAS_PLUGIN_NAME, + name); + return NULL; + } + + if (!command || !command[0]) return NULL; while (weechat_string_is_command_char (name)) diff --git a/src/plugins/alias/alias.h b/src/plugins/alias/alias.h index 1fd47f378..58c78a8d4 100644 --- a/src/plugins/alias/alias.h +++ b/src/plugins/alias/alias.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/CMakeLists.txt b/src/plugins/aspell/CMakeLists.txt index 846ef4c4e..2002871af 100644 --- a/src/plugins/aspell/CMakeLists.txt +++ b/src/plugins/aspell/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> -# Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/aspell/Makefile.am b/src/plugins/aspell/Makefile.am index 70464ca3c..0e50bf45a 100644 --- a/src/plugins/aspell/Makefile.am +++ b/src/plugins/aspell/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> -# Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/aspell/weechat-aspell-bar-item.c b/src/plugins/aspell/weechat-aspell-bar-item.c index f088cbf0c..c723ce782 100644 --- a/src/plugins/aspell/weechat-aspell-bar-item.c +++ b/src/plugins/aspell/weechat-aspell-bar-item.c @@ -2,7 +2,7 @@ * weechat-aspell-bar-item.c - bar items for aspell plugin * * Copyright (C) 2012 Nils Görs <weechatter@arcor.de> - * Copyright (C) 2012-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2012-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c index 343467a36..36b06ece7 100644 --- a/src/plugins/aspell/weechat-aspell-command.c +++ b/src/plugins/aspell/weechat-aspell-command.c @@ -1,7 +1,7 @@ /* * weechat-aspell-command.c - aspell commands * - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-command.h b/src/plugins/aspell/weechat-aspell-command.h index 1cbf8f391..920b00b3b 100644 --- a/src/plugins/aspell/weechat-aspell-command.h +++ b/src/plugins/aspell/weechat-aspell-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-completion.c b/src/plugins/aspell/weechat-aspell-completion.c index f0b3ef191..c095a0091 100644 --- a/src/plugins/aspell/weechat-aspell-completion.c +++ b/src/plugins/aspell/weechat-aspell-completion.c @@ -1,7 +1,7 @@ /* * weechat-aspell-completion.c - completion for aspell commands * - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-completion.h b/src/plugins/aspell/weechat-aspell-completion.h index cba724bb4..afa15770a 100644 --- a/src/plugins/aspell/weechat-aspell-completion.h +++ b/src/plugins/aspell/weechat-aspell-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c index ac381359d..ee46731be 100644 --- a/src/plugins/aspell/weechat-aspell-config.c +++ b/src/plugins/aspell/weechat-aspell-config.c @@ -2,7 +2,7 @@ * weechat-aspell-config.c - aspell configuration options (file aspell.conf) * * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-config.h b/src/plugins/aspell/weechat-aspell-config.h index 010350209..266af1774 100644 --- a/src/plugins/aspell/weechat-aspell-config.h +++ b/src/plugins/aspell/weechat-aspell-config.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-info.c b/src/plugins/aspell/weechat-aspell-info.c index 8860c9bba..33e6eed86 100644 --- a/src/plugins/aspell/weechat-aspell-info.c +++ b/src/plugins/aspell/weechat-aspell-info.c @@ -1,7 +1,7 @@ /* * weechat-aspell-info.c - info for aspell plugin * - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-info.h b/src/plugins/aspell/weechat-aspell-info.h index e170709b8..f1b50bc7f 100644 --- a/src/plugins/aspell/weechat-aspell-info.h +++ b/src/plugins/aspell/weechat-aspell-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c index 460c7509c..fdaee28f5 100644 --- a/src/plugins/aspell/weechat-aspell-speller.c +++ b/src/plugins/aspell/weechat-aspell-speller.c @@ -2,7 +2,7 @@ * weechat-aspell-speller.c - speller management for aspell plugin * * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell-speller.h b/src/plugins/aspell/weechat-aspell-speller.h index cc696f4e2..705afa553 100644 --- a/src/plugins/aspell/weechat-aspell-speller.h +++ b/src/plugins/aspell/weechat-aspell-speller.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c index ae2775b2c..961d2553d 100644 --- a/src/plugins/aspell/weechat-aspell.c +++ b/src/plugins/aspell/weechat-aspell.c @@ -2,7 +2,7 @@ * weechat-aspell.c - aspell plugin for WeeChat: color for misspelled words * * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Nils Görs <weechatter@arcor.de> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/aspell/weechat-aspell.h b/src/plugins/aspell/weechat-aspell.h index fbcbc3fb8..e947f83bd 100644 --- a/src/plugins/aspell/weechat-aspell.h +++ b/src/plugins/aspell/weechat-aspell.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/charset/CMakeLists.txt b/src/plugins/charset/CMakeLists.txt index 052b46711..16cf17d05 100644 --- a/src/plugins/charset/CMakeLists.txt +++ b/src/plugins/charset/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/charset/Makefile.am b/src/plugins/charset/Makefile.am index 9f746b83f..1a2ed9805 100644 --- a/src/plugins/charset/Makefile.am +++ b/src/plugins/charset/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index ad275e848..7e6a50baf 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -1,7 +1,7 @@ /* * charset.c - charset plugin for WeeChat: encode/decode strings * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/CMakeLists.txt b/src/plugins/exec/CMakeLists.txt index f250dc720..8c1e115ed 100644 --- a/src/plugins/exec/CMakeLists.txt +++ b/src/plugins/exec/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/exec/Makefile.am b/src/plugins/exec/Makefile.am index 9413e12e2..eb1908724 100644 --- a/src/plugins/exec/Makefile.am +++ b/src/plugins/exec/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c index 48c8f3e5c..1339dbd5b 100644 --- a/src/plugins/exec/exec-buffer.c +++ b/src/plugins/exec/exec-buffer.c @@ -1,7 +1,7 @@ /* * exec-buffer.c - buffers with output of commands * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-buffer.h b/src/plugins/exec/exec-buffer.h index 0b7f1a956..d0ee022ee 100644 --- a/src/plugins/exec/exec-buffer.h +++ b/src/plugins/exec/exec-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index 4d75f6dd6..dbe692c3f 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -1,7 +1,7 @@ /* * exec-command.c - exec command * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-command.h b/src/plugins/exec/exec-command.h index ab5fb474e..eb4d737fe 100644 --- a/src/plugins/exec/exec-command.h +++ b/src/plugins/exec/exec-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-completion.c b/src/plugins/exec/exec-completion.c index 9eb430cad..d243f6692 100644 --- a/src/plugins/exec/exec-completion.c +++ b/src/plugins/exec/exec-completion.c @@ -1,7 +1,7 @@ /* * exec-completion.c - completion for exec commands * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-completion.h b/src/plugins/exec/exec-completion.h index 7012ac6e7..4b6bf8c8b 100644 --- a/src/plugins/exec/exec-completion.h +++ b/src/plugins/exec/exec-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c index 8c4145fe8..7ead68550 100644 --- a/src/plugins/exec/exec-config.c +++ b/src/plugins/exec/exec-config.c @@ -1,7 +1,7 @@ /* * exec-config.c - exec configuration options (file exec.conf) * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec-config.h b/src/plugins/exec/exec-config.h index 679bafac1..04ebcb065 100644 --- a/src/plugins/exec/exec-config.h +++ b/src/plugins/exec/exec-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 7363700b4..3922a1154 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -1,7 +1,7 @@ /* * exec.c - execution of external commands in WeeChat * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/exec/exec.h b/src/plugins/exec/exec.h index 2efea0402..e54187a73 100644 --- a/src/plugins/exec/exec.h +++ b/src/plugins/exec/exec.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/fifo/CMakeLists.txt b/src/plugins/fifo/CMakeLists.txt index 9a547d86e..b1c27b62f 100644 --- a/src/plugins/fifo/CMakeLists.txt +++ b/src/plugins/fifo/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # @@ -19,6 +19,7 @@ add_library(fifo MODULE fifo.c fifo.h +fifo-command.c fifo-command.h fifo-info.c fifo-info.h) set_target_properties(fifo PROPERTIES PREFIX "") diff --git a/src/plugins/fifo/Makefile.am b/src/plugins/fifo/Makefile.am index b7fb2ec7e..8a51e9fb2 100644 --- a/src/plugins/fifo/Makefile.am +++ b/src/plugins/fifo/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # @@ -25,6 +25,8 @@ lib_LTLIBRARIES = fifo.la fifo_la_SOURCES = fifo.c \ fifo.h \ + fifo-command.c \ + fifo-command.h \ fifo-info.c \ fifo-info.h fifo_la_LDFLAGS = -module -no-undefined diff --git a/src/plugins/fifo/fifo-command.c b/src/plugins/fifo/fifo-command.c new file mode 100644 index 000000000..ece6ea646 --- /dev/null +++ b/src/plugins/fifo/fifo-command.c @@ -0,0 +1,117 @@ +/* + * fifo-command.c - fifo command + * + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdlib.h> + +#include "../weechat-plugin.h" +#include "fifo.h" + + +/* + * Callback for command "/fifo": manages FIFO pipe. + */ + +int +fifo_command_fifo (void *data, struct t_gui_buffer *buffer, int argc, + char **argv, char **argv_eol) +{ + /* make C compiler happy */ + (void) data; + (void) buffer; + (void) argv_eol; + + if (argc == 1) + { + if (fifo_fd != -1) + { + weechat_printf (NULL, + _("%s: pipe is enabled (file: %s)"), + FIFO_PLUGIN_NAME, + fifo_filename); + } + else + { + weechat_printf (NULL, + _("%s: pipe is disabled"), FIFO_PLUGIN_NAME); + } + return WEECHAT_RC_OK; + } + + /* enable pipe */ + if (weechat_strcasecmp (argv[1], "enable") == 0) + { + weechat_config_set_plugin (FIFO_OPTION_NAME, "on"); + return WEECHAT_RC_OK; + } + + /* disable pipe */ + if (weechat_strcasecmp (argv[1], "disable") == 0) + { + weechat_config_set_plugin (FIFO_OPTION_NAME, "off"); + return WEECHAT_RC_OK; + } + + /* toggle pipe */ + if (weechat_strcasecmp (argv[1], "toggle") == 0) + { + weechat_config_set_plugin (FIFO_OPTION_NAME, + (fifo_fd == -1) ? "on" : "off"); + return WEECHAT_RC_OK; + } + + WEECHAT_COMMAND_ERROR; +} + +/* + * Hooks fifo command. + */ + +void +fifo_command_init () +{ + weechat_hook_command ( + "fifo", + N_("fifo plugin configuration"), + N_("enable|disable|toggle"), + N_(" enable: enable FIFO pipe\n" + "disable: disable FIFO pipe\n" + " toggle: toggle FIFO pipe\n" + "\n" + "FIFO pipe is used as remote control of WeeChat: you can send " + "commands or text to the FIFO pipe from your shell.\n" + "By default the FIFO pipe is in ~/.weechat/weechat_fifo_xxx " + "(\"xxx\" is the WeeChat PID).\n" + "\n" + "The expected format is one of:\n" + " plugin.buffer *text or command here\n" + " *text or command here\n" + "\n" + "For example to change your freenode nick:\n" + " echo 'irc.server.freenode */nick newnick' " + ">~/.weechat/weechat_fifo_12345\n" + "\n" + "Please read the user's guide for more info and examples.\n" + "\n" + "Examples:\n" + " /fifo toggle"), + "enable|disable|toggle", + &fifo_command_fifo, NULL); +} diff --git a/src/plugins/fifo/fifo-command.h b/src/plugins/fifo/fifo-command.h new file mode 100644 index 000000000..0b7f29b81 --- /dev/null +++ b/src/plugins/fifo/fifo-command.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef WEECHAT_FIFO_COMMAND_H +#define WEECHAT_FIFO_COMMAND_H 1 + +extern void fifo_command_init (); + +#endif /* WEECHAT_FIFO_COMMAND_H */ diff --git a/src/plugins/fifo/fifo-info.c b/src/plugins/fifo/fifo-info.c index 6c5fe2d35..dd709fb9f 100644 --- a/src/plugins/fifo/fifo-info.c +++ b/src/plugins/fifo/fifo-info.c @@ -1,7 +1,7 @@ /* * fifo-info.c - info and infolist hooks for fifo plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/fifo/fifo-info.h b/src/plugins/fifo/fifo-info.h index 234c0b6ab..0a41e7817 100644 --- a/src/plugins/fifo/fifo-info.h +++ b/src/plugins/fifo/fifo-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index 8694b57c8..4331eeafa 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -1,7 +1,7 @@ /* * fifo.c - fifo plugin for WeeChat: remote control with FIFO pipe * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -32,6 +32,7 @@ #include "../weechat-plugin.h" #include "fifo.h" +#include "fifo-command.h" #include "fifo-info.h" @@ -158,8 +159,9 @@ fifo_create () if ((weechat_fifo_plugin->debug >= 1) || !fifo_quiet) { weechat_printf (NULL, - _("%s: pipe opened"), - FIFO_PLUGIN_NAME); + _("%s: pipe opened (file: %s)"), + FIFO_PLUGIN_NAME, + fifo_filename); } fifo_fd_hook = weechat_hook_fd (fifo_fd, 1, 0, 0, &fifo_read, NULL); @@ -259,7 +261,7 @@ fifo_exec (const char *text) if (!pos_msg) { weechat_printf (NULL, - _("%s%s: error, invalid text received on pipe"), + _("%s%s: invalid text received in pipe"), weechat_prefix ("error"), FIFO_PLUGIN_NAME); free (text2); return; @@ -267,15 +269,15 @@ fifo_exec (const char *text) pos_msg[0] = '\0'; pos_msg += 2; ptr_buffer = weechat_buffer_search ("==", text2); - } - - if (!ptr_buffer) - { - weechat_printf (NULL, - _("%s%s: error, buffer not found for pipe data"), - weechat_prefix ("error"), FIFO_PLUGIN_NAME); - free (text2); - return; + if (!ptr_buffer) + { + weechat_printf (NULL, + _("%s%s: buffer \"%s\" not found"), + weechat_prefix ("error"), FIFO_PLUGIN_NAME, + text2); + free (text2); + return; + } } weechat_command (ptr_buffer, pos_msg); @@ -424,6 +426,8 @@ fifo_config_cb (void *data, const char *option, const char *value) int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { + char str_option[256]; + /* make C compiler happy */ (void) argc; (void) argv; @@ -434,8 +438,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) fifo_create (); - weechat_hook_config ("plugins.var.fifo.fifo", &fifo_config_cb, NULL); + snprintf (str_option, sizeof (str_option), + "plugins.var.fifo.%s", FIFO_OPTION_NAME); + weechat_hook_config (str_option, &fifo_config_cb, NULL); + fifo_command_init (); fifo_info_init (); fifo_quiet = 0; diff --git a/src/plugins/fifo/fifo.h b/src/plugins/fifo/fifo.h index 008251ef5..35eb72b0d 100644 --- a/src/plugins/fifo/fifo.h +++ b/src/plugins/fifo/fifo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -22,8 +22,10 @@ #define weechat_plugin weechat_fifo_plugin #define FIFO_PLUGIN_NAME "fifo" +#define FIFO_OPTION_NAME "fifo" extern struct t_weechat_plugin *weechat_fifo_plugin; +extern int fifo_fd; extern char *fifo_filename; #endif /* WEECHAT_FIFO_H */ diff --git a/src/plugins/guile/CMakeLists.txt b/src/plugins/guile/CMakeLists.txt index 3076fe948..16bfa4c0c 100644 --- a/src/plugins/guile/CMakeLists.txt +++ b/src/plugins/guile/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/guile/Makefile.am b/src/plugins/guile/Makefile.am index 5ef2cded9..170fecef1 100644 --- a/src/plugins/guile/Makefile.am +++ b/src/plugins/guile/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 676a85e50..3ac2b766a 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -1,7 +1,7 @@ /* * weechat-guile-api.c - guile API functions * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/guile/weechat-guile-api.h b/src/plugins/guile/weechat-guile-api.h index 42dae4a4c..91d05b6d2 100644 --- a/src/plugins/guile/weechat-guile-api.h +++ b/src/plugins/guile/weechat-guile-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index fa962ea43..85d49e76d 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -1,7 +1,7 @@ /* * weechat-guile.c - guile (scheme) plugin for WeeChat * - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/guile/weechat-guile.h b/src/plugins/guile/weechat-guile.h index 7d5446568..537757623 100644 --- a/src/plugins/guile/weechat-guile.h +++ b/src/plugins/guile/weechat-guile.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2011-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt index 399dc89c4..b773dcf3e 100644 --- a/src/plugins/irc/CMakeLists.txt +++ b/src/plugins/irc/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/irc/Makefile.am b/src/plugins/irc/Makefile.am index 85af3f343..a086e3edf 100644 --- a/src/plugins/irc/Makefile.am +++ b/src/plugins/irc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 740a6f6a9..08c365bf6 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -1,7 +1,7 @@ /* * irc-bar-item.c - bar items for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-bar-item.h b/src/plugins/irc/irc-bar-item.h index 688e9f665..948abd75d 100644 --- a/src/plugins/irc/irc-bar-item.h +++ b/src/plugins/irc/irc-bar-item.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index a1be1c361..f7df9d267 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -1,7 +1,7 @@ /* * irc-buffer.c - buffer functions for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h index e02ffea1e..b31a5c2bb 100644 --- a/src/plugins/irc/irc-buffer.h +++ b/src/plugins/irc/irc-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 11d0c4df1..fe7b92863 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -1,7 +1,7 @@ /* * irc-channel.c - channel and private chat management for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -655,7 +655,7 @@ irc_channel_remove_account (struct t_irc_server *server, { if (ptr_nick->account) free (ptr_nick->account); - ptr_nick->account = strdup ("*"); + ptr_nick->account = NULL; } } } diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h index 08f7f1e9b..479dbba45 100644 --- a/src/plugins/irc/irc-channel.h +++ b/src/plugins/irc/irc-channel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -78,6 +78,11 @@ struct t_irc_channel extern int irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel); +extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server, + const char *channel_name); +extern struct t_gui_buffer *irc_channel_search_buffer (struct t_irc_server *server, + int channel_type, + const char *channel_name); extern struct t_gui_buffer *irc_channel_create_buffer (struct t_irc_server *server, int channel_type, const char *channel_name, @@ -98,8 +103,6 @@ extern void irc_channel_set_modes (struct t_irc_channel *channel, extern void irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel); extern void irc_channel_free_all (struct t_irc_server *server); -extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server, - const char *channel_name); extern int irc_channel_is_channel (struct t_irc_server *server, const char *string); extern const char *irc_channel_get_auto_chantype (struct t_irc_server *server, diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c index f5f4d2688..194a32ac3 100644 --- a/src/plugins/irc/irc-color.c +++ b/src/plugins/irc/irc-color.c @@ -1,7 +1,7 @@ /* * irc-color.c - IRC color decoding/encoding in messages * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h index cc8f58bf6..9425db0ac 100644 --- a/src/plugins/irc/irc-color.h +++ b/src/plugins/irc/irc-color.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index a5bb53559..d3fa3becf 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1,7 +1,7 @@ /* * irc-command.c - IRC commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -1366,69 +1366,106 @@ int irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - char *irc_cmd, str_time[512]; + char **targets, *ctcp_type, str_time[512]; + const char *ctcp_target, *ctcp_args; + int num_targets, arg_target, arg_type, arg_args, i; struct timeval tv; - IRC_BUFFER_GET_SERVER(buffer); - IRC_COMMAND_CHECK_SERVER("ctcp", 1); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; WEECHAT_COMMAND_MIN_ARGS(3, ""); - irc_cmd = strdup (argv[2]); - if (!irc_cmd) + arg_target = 1; + arg_type = 2; + arg_args = 3; + + if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0)) + { + ptr_server = irc_server_search (argv[2]); + ptr_channel = NULL; + arg_target = 3; + arg_type = 4; + arg_args = 5; + } + + IRC_COMMAND_CHECK_SERVER("ctcp", 1); + + targets = weechat_string_split (argv[arg_target], ",", 0, 0, &num_targets); + if (!targets) + WEECHAT_COMMAND_ERROR; + + ctcp_type = strdup (argv[arg_type]); + if (!ctcp_type) + { + weechat_string_free_split (targets); WEECHAT_COMMAND_ERROR; + } - weechat_string_toupper (irc_cmd); + weechat_string_toupper (ctcp_type); - if ((weechat_strcasecmp (argv[2], "ping") == 0) && !argv_eol[3]) + if ((strcmp (ctcp_type, "PING") == 0) && !argv_eol[arg_args]) { + /* generate argument for PING if not provided */ gettimeofday (&tv, NULL); snprintf (str_time, sizeof (str_time), "%ld %ld", (long)tv.tv_sec, (long)tv.tv_usec); - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01PING %s\01", - argv[1], str_time); - weechat_printf ( - irc_msgbuffer_get_target_buffer ( - ptr_server, argv[1], NULL, "ctcp", NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), - argv[1], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - irc_cmd, - IRC_COLOR_RESET, - " ", - str_time); + ctcp_args = str_time; } else { - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01%s%s%s\01", - argv[1], - irc_cmd, - (argv_eol[3]) ? " " : "", - (argv_eol[3]) ? argv_eol[3] : ""); - weechat_printf ( - irc_msgbuffer_get_target_buffer ( - ptr_server, argv[1], NULL, "ctcp", NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), - argv[1], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - irc_cmd, - IRC_COLOR_RESET, - (argv_eol[3]) ? " " : "", - (argv_eol[3]) ? argv_eol[3] : ""); - } - - free (irc_cmd); + ctcp_args = argv_eol[arg_args]; + } + + for (i = 0; i < num_targets; i++) + { + ctcp_target = targets[i]; + + if (strcmp (targets[i], "*") == 0) + { + if (!ptr_channel + || ((ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) + && (ptr_channel->type != IRC_CHANNEL_TYPE_PRIVATE))) + { + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "or private buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "ctcp *"); + ctcp_target = NULL; + } + else + ctcp_target = ptr_channel->name; + } + + if (ctcp_target) + { + irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01%s%s%s\01", + ctcp_target, + ctcp_type, + (ctcp_args) ? " " : "", + (ctcp_args) ? ctcp_args : ""); + weechat_printf ( + irc_msgbuffer_get_target_buffer ( + ptr_server, ctcp_target, NULL, "ctcp", NULL), + _("%sCTCP query to %s%s%s: %s%s%s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (ptr_server, 0, NULL, ctcp_target), + ctcp_target, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + ctcp_type, + IRC_COLOR_RESET, + (ctcp_args) ? " " : "", + (ctcp_args) ? ctcp_args : ""); + } + } + + free (ctcp_type); + weechat_string_free_split (targets); return WEECHAT_RC_OK; } @@ -3069,6 +3106,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, char **targets, *msg_pwd_hidden, *string; int num_targets, i, j, arg_target, arg_text, is_channel, status_msg; int hide_password; + struct t_irc_channel *ptr_channel2; IRC_BUFFER_GET_SERVER_CHANNEL(buffer); @@ -3108,42 +3146,46 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, _("%s%s: \"%s\" command can only be executed in a channel " "or private buffer"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "msg *"); - return WEECHAT_RC_OK; } - string = irc_color_decode (argv_eol[arg_text], - weechat_config_boolean (irc_config_network_colors_send)); - irc_input_user_message_display (ptr_channel->buffer, 0, - (string) ? string : argv_eol[arg_text]); - if (string) - free (string); + else + { + string = irc_color_decode ( + argv_eol[arg_text], + weechat_config_boolean (irc_config_network_colors_send)); + irc_input_user_message_display ( + ptr_channel->buffer, 0, + (string) ? string : argv_eol[arg_text]); + if (string) + free (string); - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :%s", - ptr_channel->name, argv_eol[arg_text]); + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :%s", + ptr_channel->name, argv_eol[arg_text]); + } } else { is_channel = 0; - ptr_channel = NULL; + ptr_channel2 = NULL; status_msg = 0; if (irc_server_prefix_char_statusmsg (ptr_server, targets[i][0]) && irc_channel_is_channel (ptr_server, targets[i] + 1)) { - ptr_channel = irc_channel_search (ptr_server, targets[i] + 1); + ptr_channel2 = irc_channel_search (ptr_server, targets[i] + 1); is_channel = 1; status_msg = 1; } else { - ptr_channel = irc_channel_search (ptr_server, targets[i]); - if (ptr_channel) + ptr_channel2 = irc_channel_search (ptr_server, targets[i]); + if (ptr_channel2) is_channel = 1; } if (is_channel) { - if (ptr_channel) + if (ptr_channel2) { string = irc_color_decode ( argv_eol[arg_text], @@ -3155,7 +3197,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, * (to "@#channel" or "+#channel") */ weechat_printf_tags ( - ptr_channel->buffer, + ptr_channel2->buffer, "notify_none,no_highlight", "%s%s%s -> %s%s%s: %s", weechat_prefix ("network"), @@ -3170,7 +3212,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, { /* standard message (to "#channel") */ irc_input_user_message_display ( - ptr_channel->buffer, + ptr_channel2->buffer, 0, (string) ? string : argv_eol[arg_text]); } @@ -3231,12 +3273,12 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, string = irc_color_decode ( argv_eol[arg_text], weechat_config_boolean (irc_config_network_colors_send)); - ptr_channel = irc_channel_search (ptr_server, - targets[i]); - if (ptr_channel) + ptr_channel2 = irc_channel_search (ptr_server, + targets[i]); + if (ptr_channel2) { irc_input_user_message_display ( - ptr_channel->buffer, + ptr_channel2->buffer, 0, (string) ? string : argv_eol[arg_text]); } @@ -4532,7 +4574,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " ipv6 . . . . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_IPV6]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_IPV6])) ? _("on") : _("off")); /* ssl */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL])) @@ -4542,7 +4584,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " ssl. . . . . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL])) ? _("on") : _("off")); /* ssl_cert */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_CERT])) @@ -4584,7 +4626,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " ssl_verify . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL_VERIFY]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL_VERIFY])) ? _("on") : _("off")); /* password */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PASSWORD])) @@ -4660,7 +4702,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " autoconnect. . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOCONNECT]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOCONNECT])) ? _("on") : _("off")); /* autoreconnect */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT])) @@ -4670,7 +4712,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " autoreconnect. . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTORECONNECT]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTORECONNECT])) ? _("on") : _("off")); /* autoreconnect_delay */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])) @@ -4690,6 +4732,16 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) weechat_printf (NULL, " nicks. . . . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, weechat_config_string (server->options[IRC_SERVER_OPTION_NICKS])); + /* nicks_alternate */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_NICKS_ALTERNATE])) + weechat_printf (NULL, " nicks_alternate. . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_NICKS_ALTERNATE)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " nicks_alternate. . . : %s%s", + IRC_COLOR_CHAT_VALUE, + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_NICKS_ALTERNATE])) ? + _("on") : _("off")); /* username */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_USERNAME])) weechat_printf (NULL, " username . . . . . . : ('%s')", @@ -4762,7 +4814,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) else weechat_printf (NULL, " autorejoin . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOREJOIN]) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOREJOIN])) ? _("on") : _("off")); /* autorejoin_delay */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOREJOIN_DELAY])) @@ -6138,19 +6190,18 @@ irc_command_init () "cap", N_("client capability negotiation"), N_("ls || list || req|ack [<capability> [<capability>...]]" - " || clear || end"), + " || end"), N_(" ls: list the capabilities supported by the server\n" " list: list the capabilities currently enabled\n" " req: request a capability\n" " ack: acknowledge capabilities which require client-side " "acknowledgement\n" - "clear: clear the capabilities currently enabled\n" " end: end the capability negotiation\n" "\n" "Without argument, \"ls\" and \"list\" are sent.\n" "\n" "Capabilities supported by WeeChat are: " - "account-notify, away-notify, extended-join, " + "account-notify, away-notify, cap-notify, extended-join, " "multi-prefix, server-time, userhost-in-names.\n" "\n" "The capabilities to automatically enable on servers can be set " @@ -6159,13 +6210,11 @@ irc_command_init () "\n" "Examples:\n" " /cap\n" - " /cap req multi-prefix\n" - " /cap clear"), + " /cap req multi-prefix away-notify"), "ls" " || list" " || req " IRC_COMMAND_CAP_SUPPORTED_COMPLETION " || ack " IRC_COMMAND_CAP_SUPPORTED_COMPLETION - " || clear" " || end", &irc_command_cap, NULL); weechat_hook_command ( @@ -6209,12 +6258,20 @@ irc_command_init () weechat_hook_command ( "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"), - N_("<target> <type> [<arguments>]"), - N_(" target: nick or channel name to send CTCP to\n" - " type: CTCP type (examples: \"version\", \"ping\", ..)\n" - "arguments: arguments for CTCP"), - "%(irc_channel)|%(nicks) action|clientinfo|finger|ping|source|time|" - "userinfo|version", + N_("[-server <server>] <target>[,<target>...] <type> [<arguments>]"), + N_(" server: send to this server (internal name)\n" + " target: nick or channel ('*' = current channel)\n" + " type: CTCP type (examples: \"version\", \"ping\", ..)\n" + "arguments: arguments for CTCP\n" + "\n" + "Examples:\n" + " /ctcp toto time\n" + " /ctcp toto version\n" + " /ctcp * version"), + "-server %(irc_servers) %(irc_channel)|%(nicks)|* " + IRC_COMMAND_CTCP_SUPPORTED_COMPLETION + " || %(irc_channel)|%(nicks)|* " + IRC_COMMAND_CTCP_SUPPORTED_COMPLETION, &irc_command_ctcp, NULL); weechat_hook_command ( "cycle", @@ -6481,8 +6538,8 @@ irc_command_init () N_("server: send to this server (internal name)\n" "target: nick or channel (may be mask, '*' = current channel)\n" " text: text to send"), - "-server %(irc_servers) %(nicks)" - " || %(nicks)", + "-server %(irc_servers) %(nicks)|*" + " || %(nicks)|*", &irc_command_msg, NULL); weechat_hook_command ( "names", diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h index 358bc6385..ac48c941f 100644 --- a/src/plugins/irc/irc-command.h +++ b/src/plugins/irc/irc-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -45,9 +45,12 @@ struct t_irc_channel; /* list of supported capabilities (for completion in command /cap) */ #define IRC_COMMAND_CAP_SUPPORTED_COMPLETION \ - "account-notify|away-notify|extended-join|" \ - "multi-prefix|server-time|userhost-in-names" \ - "|%*" + "account-notify|away-notify|cap-notify|extended-join|" \ + "multi-prefix|server-time|userhost-in-names|%*" + +/* list of supported CTCPs (for completion in command /ctcp) */ +#define IRC_COMMAND_CTCP_SUPPORTED_COMPLETION \ + "action|clientinfo|finger|ping|source|time|userinfo|version" extern void irc_command_away_server (struct t_irc_server *server, const char *arguments, diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index 831429fe9..153bad8d6 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -1,7 +1,7 @@ /* * irc-completion.c - completion for IRC commands * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -93,26 +93,32 @@ irc_completion_server_channels_cb (void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { - struct t_irc_channel *ptr_channel; + struct t_irc_channel *ptr_channel2; - IRC_BUFFER_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; (void) completion_item; - (void) buffer; if (ptr_server) { - for (ptr_channel = ptr_server->channels; ptr_channel; - ptr_channel = ptr_channel->next_channel) + for (ptr_channel2 = ptr_server->channels; ptr_channel2; + ptr_channel2 = ptr_channel2->next_channel) { - if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) + if (ptr_channel2->type == IRC_CHANNEL_TYPE_CHANNEL) { - weechat_hook_completion_list_add (completion, ptr_channel->name, + weechat_hook_completion_list_add (completion, ptr_channel2->name, 0, WEECHAT_LIST_POS_SORT); } } + + /* add current channel first in list */ + if (ptr_channel) + { + weechat_hook_completion_list_add (completion, ptr_channel->name, + 0, WEECHAT_LIST_POS_BEGINNING); + } } return WEECHAT_RC_OK; @@ -134,7 +140,6 @@ irc_completion_server_privates_cb (void *data, const char *completion_item, /* make C compiler happy */ (void) data; (void) completion_item; - (void) buffer; if (ptr_server) { @@ -458,28 +463,65 @@ irc_completion_channels_cb (void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { - struct t_irc_server *ptr_server; - struct t_irc_channel *ptr_channel; + struct t_irc_server *ptr_server2; + struct t_irc_channel *ptr_channel2; + struct t_weelist *channels_current_server; + int i; + + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; (void) completion_item; - (void) buffer; - for (ptr_server = irc_servers; ptr_server; - ptr_server = ptr_server->next_server) + channels_current_server = weechat_list_new (); + + for (ptr_server2 = irc_servers; ptr_server2; + ptr_server2 = ptr_server2->next_server) { - for (ptr_channel = ptr_server->channels; ptr_channel; - ptr_channel = ptr_channel->next_channel) + for (ptr_channel2 = ptr_server2->channels; ptr_channel2; + ptr_channel2 = ptr_channel2->next_channel) { - if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) + if (ptr_channel2->type == IRC_CHANNEL_TYPE_CHANNEL) { - weechat_hook_completion_list_add (completion, ptr_channel->name, - 0, WEECHAT_LIST_POS_SORT); + if (ptr_server2 == ptr_server) + { + /* will be added later to completions */ + weechat_list_add (channels_current_server, + ptr_channel2->name, + WEECHAT_LIST_POS_SORT, + NULL); + } + else + { + weechat_hook_completion_list_add (completion, + ptr_channel2->name, + 0, + WEECHAT_LIST_POS_SORT); + } } } } + /* add channels of current server first in list */ + for (i = weechat_list_size (channels_current_server) - 1; i >= 0; i--) + { + weechat_hook_completion_list_add ( + completion, + weechat_list_string ( + weechat_list_get (channels_current_server, i)), + 0, + WEECHAT_LIST_POS_BEGINNING); + } + weechat_list_free (channels_current_server); + + /* add current channel first in list */ + if (ptr_channel) + { + weechat_hook_completion_list_add (completion, ptr_channel->name, + 0, WEECHAT_LIST_POS_BEGINNING); + } + return WEECHAT_RC_OK; } diff --git a/src/plugins/irc/irc-completion.h b/src/plugins/irc/irc-completion.h index aa2eb1a6f..20dacb576 100644 --- a/src/plugins/irc/irc-completion.h +++ b/src/plugins/irc/irc-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index fa879e4f8..20b6aff58 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -1,7 +1,7 @@ /* * irc-config.c - IRC configuration options (file irc.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -131,7 +131,6 @@ struct t_config_option *irc_config_color_topic_old; /* IRC config, network section */ -struct t_config_option *irc_config_network_alternate_nick; struct t_config_option *irc_config_network_autoreconnect_delay_growing; struct t_config_option *irc_config_network_autoreconnect_delay_max; struct t_config_option *irc_config_network_ban_mask_default; @@ -1594,7 +1593,8 @@ irc_config_server_new_option (struct t_config_file *config_file, config_file, section, option_name, "string", N_("list of hostname/port or IP/port for server (separated by " - "comma)"), + "comma) " + "(note: content is evaluated, see /help eval)"), NULL, 0, 0, default_value, value, null_value_allowed, @@ -1885,6 +1885,22 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change, callback_change_data, NULL, NULL); break; + case IRC_SERVER_OPTION_NICKS_ALTERNATE: + new_option = weechat_config_new_option ( + config_file, section, + option_name, "boolean", + N_("get an alternate nick when all the declared nicks are " + "already used on server: add some \"_\" until the nick has " + "a length of 9, and then replace last char (or the two " + "last chars) by a number from 1 to 99, until we find " + "a nick not used on server"), + NULL, 0, 0, + default_value, value, + null_value_allowed, + callback_check_value, callback_check_value_data, + callback_change, callback_change_data, + NULL, NULL); + break; case IRC_SERVER_OPTION_USERNAME: new_option = weechat_config_new_option ( config_file, section, @@ -2893,8 +2909,8 @@ irc_config_init () "found, WeeChat will try with next modes received from server " "(\"PREFIX\"); a special mode \"*\" can be used as default color " "if no mode has been found in list)"), - NULL, 0, 0, "q:lightred;a:lightcyan;o:lightgreen;h:lightmagenta;" - "v:yellow;*:lightblue", NULL, 0, NULL, NULL, + NULL, 0, 0, "y:lightred;q:lightred;a:lightcyan;o:lightgreen;" + "h:lightmagenta;v:yellow;*:lightblue", NULL, 0, NULL, NULL, &irc_config_change_color_nick_prefixes, NULL, NULL, NULL); irc_config_color_notice = weechat_config_new_option ( irc_config_file, ptr_section, @@ -2940,14 +2956,6 @@ irc_config_init () return 0; } - irc_config_network_alternate_nick = weechat_config_new_option ( - irc_config_file, ptr_section, - "alternate_nick", "boolean", - N_("get an alternate nick when the nick is already used on server: add " - "some \"_\" until the nick has a length of 9, and then replace last " - "char (or the two last chars) by a number from 1 to 99, until we " - "find a nick not used on server"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_autoreconnect_delay_growing = weechat_config_new_option ( irc_config_file, ptr_section, "autoreconnect_delay_growing", "integer", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index cd0a766b5..caca3f6aa 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -172,7 +172,6 @@ extern struct t_config_option *irc_config_color_topic_current; extern struct t_config_option *irc_config_color_topic_new; extern struct t_config_option *irc_config_color_topic_old; -extern struct t_config_option *irc_config_network_alternate_nick; extern struct t_config_option *irc_config_network_autoreconnect_delay_growing; extern struct t_config_option *irc_config_network_autoreconnect_delay_max; extern struct t_config_option *irc_config_network_ban_mask_default; diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 55d7c6b2e..081a5414a 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -1,7 +1,7 @@ /* * irc-ctcp.c - IRC CTCP protocol * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-ctcp.h b/src/plugins/irc/irc-ctcp.h index 179f2ed21..0febcd0cc 100644 --- a/src/plugins/irc/irc-ctcp.h +++ b/src/plugins/irc/irc-ctcp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c index ea33f0a37..9e8ffca6d 100644 --- a/src/plugins/irc/irc-debug.c +++ b/src/plugins/irc/irc-debug.c @@ -1,7 +1,7 @@ /* * irc-debug.c - debug functions for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-debug.h b/src/plugins/irc/irc-debug.h index 199d9e7af..8daa12139 100644 --- a/src/plugins/irc/irc-debug.h +++ b/src/plugins/irc/irc-debug.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c index 2f18a4fea..4ef33d3ad 100644 --- a/src/plugins/irc/irc-ignore.c +++ b/src/plugins/irc/irc-ignore.c @@ -1,7 +1,7 @@ /* * irc-ignore.c - ignore (nicks/hosts) management for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-ignore.h b/src/plugins/irc/irc-ignore.h index 70d37c85f..9a8284903 100644 --- a/src/plugins/irc/irc-ignore.h +++ b/src/plugins/irc/irc-ignore.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c index f905a6a4b..46c9c1a8f 100644 --- a/src/plugins/irc/irc-info.c +++ b/src/plugins/irc/irc-info.c @@ -1,7 +1,7 @@ /* * irc-info.c - info, infolist and hdata hooks for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-info.h b/src/plugins/irc/irc-info.h index 888a1d93a..7f50323a8 100644 --- a/src/plugins/irc/irc-info.h +++ b/src/plugins/irc/irc-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index f7e3b5af3..81cbcc044 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -1,7 +1,7 @@ /* * irc-input.c - input data management for IRC buffers * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-input.h b/src/plugins/irc/irc-input.h index f4fc4bdb4..9a7988102 100644 --- a/src/plugins/irc/irc-input.h +++ b/src/plugins/irc/irc-input.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c index e0c4dcf4f..1524a9f3b 100644 --- a/src/plugins/irc/irc-message.c +++ b/src/plugins/irc/irc-message.c @@ -1,7 +1,7 @@ /* * irc-message.c - functions for IRC messages * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -70,7 +70,7 @@ irc_message_parse (struct t_irc_server *server, const char *message, int *pos_command, int *pos_arguments, int *pos_channel, int *pos_text) { - const char *ptr_message, *pos, *pos2, *pos3, *pos4; + const char *ptr_message, *pos, *pos2, *pos3, *pos4, *ptr_channel_found; if (tags) *tags = NULL; @@ -96,6 +96,7 @@ irc_message_parse (struct t_irc_server *server, const char *message, *pos_channel = -1; if (pos_text) *pos_text = -1; + ptr_channel_found = NULL; if (!message) return; @@ -209,6 +210,7 @@ irc_message_parse (struct t_irc_server *server, const char *message, { if (irc_channel_is_channel (server, pos)) { + ptr_channel_found = pos; pos2 = strchr (pos, ' '); if (channel) { @@ -253,6 +255,7 @@ irc_message_parse (struct t_irc_server *server, const char *message, } if (irc_channel_is_channel (server, pos2)) { + ptr_channel_found = pos2; pos4 = strchr (pos2, ' '); if (channel) { @@ -277,13 +280,38 @@ irc_message_parse (struct t_irc_server *server, const char *message, *pos_text = pos4 - message; } } - else if ((channel && !*channel) - || (pos_channel && (*pos_channel < 0))) + else { - if (channel) - *channel = weechat_strndup (pos, pos3 - pos); - if (pos_channel) - *pos_channel = pos - message; + if (ptr_channel_found) + { + if (pos[0] == ':') + pos++; + if (text) + *text = strdup (pos); + if (pos_text) + *pos_text = pos - message; + } + else + { + if (channel) + *channel = weechat_strndup (pos, pos3 - pos); + if (pos_channel) + *pos_channel = pos - message; + pos4 = strchr (pos3, ' '); + if (pos4) + { + while (pos4[0] == ' ') + { + pos4++; + } + if (pos4[0] == ':') + pos4++; + if (text) + *text = strdup (pos4); + if (pos_text) + *pos_text = pos4 - message; + } + } } } } diff --git a/src/plugins/irc/irc-message.h b/src/plugins/irc/irc-message.h index 026595b7e..a4478115c 100644 --- a/src/plugins/irc/irc-message.h +++ b/src/plugins/irc/irc-message.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index 163e9cdd7..a31d64388 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -1,7 +1,7 @@ /* * irc-mode.c - IRC channel/user modes management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h index f6a498626..8dbd2220e 100644 --- a/src/plugins/irc/irc-mode.h +++ b/src/plugins/irc/irc-mode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-msgbuffer.c b/src/plugins/irc/irc-msgbuffer.c index 0e58a417a..27708fccb 100644 --- a/src/plugins/irc/irc-msgbuffer.c +++ b/src/plugins/irc/irc-msgbuffer.c @@ -1,7 +1,7 @@ /* * irc-msgbuffer.c - target buffer for IRC messages * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-msgbuffer.h b/src/plugins/irc/irc-msgbuffer.h index 370c2dd92..a27e7daa2 100644 --- a/src/plugins/irc/irc-msgbuffer.h +++ b/src/plugins/irc/irc-msgbuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 0877f331a..98b470641 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -1,7 +1,7 @@ /* * irc-nick.c - nick management for IRC plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -626,7 +626,7 @@ irc_nick_nicklist_set_color_all () struct t_irc_nick * irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, const char *nickname, const char *host, const char *prefixes, - int away, const char *account) + int away, const char *account, const char *realname) { struct t_irc_nick *new_nick, *ptr_nick; int length; @@ -650,6 +650,9 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, if (ptr_nick->account) free (ptr_nick->account); ptr_nick->account = (account) ? strdup (account) : NULL; + if (ptr_nick->realname) + free (ptr_nick->realname); + ptr_nick->realname = (realname) ? strdup (realname) : NULL; /* add new nick in nicklist */ irc_nick_nicklist_add (server, channel, ptr_nick); @@ -665,6 +668,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, new_nick->name = strdup (nickname); new_nick->host = (host) ? strdup (host) : NULL; new_nick->account = (account) ? strdup (account) : NULL; + new_nick->realname = (realname) ? strdup (realname) : NULL; length = strlen (irc_server_get_prefix_chars (server)); new_nick->prefixes = malloc (length + 1); if (!new_nick->name || !new_nick->prefixes) @@ -675,6 +679,8 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, free (new_nick->host); if (new_nick->account) free (new_nick->account); + if (new_nick->realname) + free (new_nick->realname); if (new_nick->prefixes) free (new_nick->prefixes); free (new_nick); @@ -817,6 +823,8 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel, free (nick->prefixes); if (nick->account) free (nick->account); + if (nick->realname) + free (nick->realname); if (nick->color) free (nick->color); @@ -1137,6 +1145,7 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name) WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_nick, account, STRING, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, realname, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, 0, NULL, hdata_name); WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, 0, NULL, hdata_name); @@ -1177,6 +1186,8 @@ irc_nick_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_string (ptr_item, "account", nick->account)) return 0; + if (!weechat_infolist_new_var_string (ptr_item, "realname", nick->realname)) + return 0; if (!weechat_infolist_new_var_string (ptr_item, "color", nick->color)) return 0; @@ -1197,6 +1208,7 @@ irc_nick_print_log (struct t_irc_nick *nick) weechat_log_printf (" prefix . . . . : '%s'", nick->prefix); weechat_log_printf (" away . . . . . : %d", nick->away); weechat_log_printf (" account. . . . : '%s'", nick->account); + weechat_log_printf (" realname . . . : '%s'", nick->realname); weechat_log_printf (" color. . . . . : '%s'", nick->color); weechat_log_printf (" prev_nick. . . : 0x%lx", nick->prev_nick); weechat_log_printf (" next_nick. . . : 0x%lx", nick->next_nick); diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h index 3079a437b..d723db180 100644 --- a/src/plugins/irc/irc-nick.h +++ b/src/plugins/irc/irc-nick.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -39,6 +39,7 @@ struct t_irc_nick /* prefixes) */ int away; /* 1 if nick is away */ char *account; /* account name of the user */ + char *realname; /* realname (aka gecos) of the user */ char *color; /* color for nickname */ struct t_irc_nick *prev_nick; /* link to previous nick on channel */ struct t_irc_nick *next_nick; /* link to next nick on channel */ @@ -66,7 +67,8 @@ extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server, const char *host, const char *prefixes, int away, - const char *account); + const char *account, + const char *realname); extern void irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, struct t_irc_nick *nick, const char *new_nick); diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index cb9a2e590..2d39250ca 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -1,7 +1,7 @@ /* * irc-notify.c - notify lists for IRC plugin * - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-notify.h b/src/plugins/irc/irc-notify.h index 19c310dba..63bd96347 100644 --- a/src/plugins/irc/irc-notify.h +++ b/src/plugins/irc/irc-notify.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index f3d7bff92..689a3c91f 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1,7 +1,7 @@ /* * irc-protocol.c - implementation of IRC protocol (RFCs 1459/2810/2811/2812/2813) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2014 Shawn Smith <ShawnSmith0828@gmail.com> * @@ -206,9 +206,12 @@ IRC_PROTOCOL_CALLBACK(account) { struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; + char *pos_account; IRC_PROTOCOL_MIN_ARGS(3); + pos_account = (strcmp (argv[2], "*") != 0) ? argv[2] : NULL; + for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { @@ -217,8 +220,8 @@ IRC_PROTOCOL_CALLBACK(account) { if (ptr_nick->account) free (ptr_nick->account); - ptr_nick->account = (server->cap_account_notify) ? - strdup (argv[2]) : strdup ("*"); + ptr_nick->account = (server->cap_account_notify && pos_account) ? + strdup (pos_account) : NULL; } } @@ -337,11 +340,11 @@ IRC_PROTOCOL_CALLBACK(away) IRC_PROTOCOL_CALLBACK(cap) { - char *ptr_caps, **caps_supported, **caps_requested, *cap_option, *cap_req; - char str_msg_auth[512]; + char *ptr_caps, **caps_supported, **caps_requested, **caps_added; + char **caps_removed, *cap_option, *cap_req, str_msg_auth[512]; const char *ptr_cap_option; - int num_caps_supported, num_caps_requested; - int sasl_requested, sasl_to_do, sasl_mechanism; + int num_caps_supported, num_caps_requested, num_caps_added; + int num_caps_removed, sasl_requested, sasl_to_do, sasl_mechanism; int i, j, timeout, length; IRC_PROTOCOL_MIN_ARGS(4); @@ -363,9 +366,11 @@ IRC_PROTOCOL_CALLBACK(cap) { sasl_requested = irc_server_sasl_enabled (server); sasl_to_do = 0; - ptr_cap_option = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_CAPABILITIES); - length = ((ptr_cap_option && ptr_cap_option[0]) ? strlen (ptr_cap_option) : 0) + 16; + ptr_cap_option = IRC_SERVER_OPTION_STRING( + server, + IRC_SERVER_OPTION_CAPABILITIES); + length = ((ptr_cap_option && ptr_cap_option[0]) ? + strlen (ptr_cap_option) : 0) + 16; cap_option = malloc (length); cap_req = malloc (length); if (cap_option && cap_req) @@ -473,6 +478,10 @@ IRC_PROTOCOL_CALLBACK(cap) { server->cap_account_notify = 1; } + else if (strcmp (caps_supported[i], "extended-join") == 0) + { + server->cap_extended_join = 1; + } } weechat_string_free_split (caps_supported); } @@ -514,6 +523,103 @@ IRC_PROTOCOL_CALLBACK(cap) irc_server_sendf (server, 0, NULL, "CAP END"); } } + else if (strcmp (argv[3], "NEW") == 0) + { + if (argc > 4) + { + ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, now available: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps); + + /* + * assume that we're not requesting any already-enabled + * capabilities + * TODO: SASL Reauthentication + */ + ptr_cap_option = IRC_SERVER_OPTION_STRING( + server, + IRC_SERVER_OPTION_CAPABILITIES); + length = ((ptr_cap_option && ptr_cap_option[0]) ? + strlen (ptr_cap_option) : 0) + 16; + cap_option = malloc (length); + cap_req = malloc (length); + if (cap_option && cap_req) + { + cap_option[0] = '\0'; + if (ptr_cap_option && ptr_cap_option[0]) + strcat (cap_option, ptr_cap_option); + cap_req[0] = '\0'; + caps_requested = weechat_string_split (cap_option, ",", 0, 0, + &num_caps_requested); + caps_added = weechat_string_split (ptr_caps, " ", 0, 0, + &num_caps_added); + if (caps_requested && caps_added) + { + for (i = 0; i < num_caps_requested; i++) + { + for (j = 0; j < num_caps_added; j++) + { + if (weechat_strcasecmp (caps_requested[i], + caps_added[j]) == 0) + { + if (cap_req[0]) + strcat (cap_req, " "); + strcat (cap_req, caps_added[j]); + } + } + } + } + if (caps_requested) + weechat_string_free_split (caps_requested); + if (caps_added) + weechat_string_free_split (caps_added); + if (cap_req[0]) + { + weechat_printf ( + server->buffer, + _("%s%s: client capability, requesting: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, + cap_req); + irc_server_sendf (server, 0, NULL, + "CAP REQ :%s", cap_req); + } + } + if (cap_option) + free (cap_option); + if (cap_req) + free (cap_req); + } + } + else if (strcmp (argv[3], "DEL") == 0) + { + if (argc > 4) + { + ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, removed: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps); + caps_removed = weechat_string_split (ptr_caps, " ", 0, 0, + &num_caps_removed); + if (caps_removed) + { + for (i = 0; i < num_caps_removed; i++) + { + if (strcmp (caps_removed[i], "away-notify") == 0) + { + server->cap_away_notify = 0; + } + else if (strcmp (caps_removed[i], "account-notify") == 0) + { + server->cap_account_notify = 0; + } + } + weechat_string_free_split (caps_removed); + } + } + } return WEECHAT_RC_OK; } @@ -648,7 +754,7 @@ IRC_PROTOCOL_CALLBACK(invite) * * With extended-join capability: * :nick!user@host JOIN :#channel * :real name - * *nick!user@host JOIN :#channel account :real name + * :nick!user@host JOIN :#channel account :real name */ IRC_PROTOCOL_CALLBACK(join) @@ -743,7 +849,8 @@ IRC_PROTOCOL_CALLBACK(join) /* add nick in channel */ ptr_nick = irc_nick_new (server, ptr_channel, nick, address, NULL, 0, - (pos_account) ? pos_account : "*"); + (pos_account) ? pos_account : NULL, + (pos_realname) ? pos_realname : NULL); /* rename the nick if it was in list with a different case */ irc_channel_nick_speaking_rename_if_present (server, ptr_channel, nick); @@ -1179,7 +1286,7 @@ IRC_PROTOCOL_CALLBACK(nick) /* temporary disable hotlist */ weechat_buffer_set (NULL, "hotlist", "-"); - /* set host for nick if needed */ + /* set host in nick if needed */ if (!ptr_nick->host) ptr_nick->host = strdup (address); @@ -4068,7 +4175,7 @@ IRC_PROTOCOL_CALLBACK(352) ptr_nick = (ptr_channel) ? irc_nick_search (server, ptr_channel, argv[7]) : NULL; - /* update host for nick */ + /* update host in nick */ if (ptr_nick) { if (ptr_nick->host) @@ -4079,13 +4186,22 @@ IRC_PROTOCOL_CALLBACK(352) snprintf (ptr_nick->host, length, "%s@%s", argv[4], argv[5]); } - /* update away flag for nick */ + /* update away flag in nick */ if (ptr_channel && ptr_nick && pos_attr) { irc_nick_set_away (server, ptr_channel, ptr_nick, (pos_attr[0] == 'G') ? 1 : 0); } + /* update realname in nick */ + if (ptr_channel && ptr_nick && pos_realname) + { + if (ptr_nick->realname) + free (ptr_nick->realname); + ptr_nick->realname = (pos_realname && server->cap_extended_join) ? + strdup (pos_realname) : NULL; + } + /* display output of who (manual who from user) */ if (!ptr_channel || (ptr_channel->checking_whox <= 0)) { @@ -4196,7 +4312,7 @@ IRC_PROTOCOL_CALLBACK(353) if (ptr_channel && ptr_channel->nicks) { if (!irc_nick_new (server, ptr_channel, nickname, pos_host, - prefixes, 0, "*")) + prefixes, 0, NULL, NULL)) { weechat_printf ( server->buffer, @@ -4291,7 +4407,7 @@ IRC_PROTOCOL_CALLBACK(354) ptr_nick = (ptr_channel) ? irc_nick_search (server, ptr_channel, argv[7]) : NULL; - /* update host for nick */ + /* update host in nick */ if (ptr_nick) { if (ptr_nick->host) @@ -4305,7 +4421,7 @@ IRC_PROTOCOL_CALLBACK(354) snprintf (ptr_nick->host, length, "%s@%s", argv[4], argv[5]); } - /* update away flag for nick */ + /* update away flag in nick */ if (ptr_channel && ptr_nick) { if (pos_attr @@ -4326,14 +4442,24 @@ IRC_PROTOCOL_CALLBACK(354) } } - /* update account flag for nick */ + /* update account flag in nick */ if (ptr_nick) { if (ptr_nick->account) free (ptr_nick->account); ptr_nick->account = (ptr_channel && pos_account && server->cap_account_notify) ? - strdup (pos_account) : strdup ("*"); + strdup (pos_account) : NULL; + } + + /* update realname in nick */ + if (ptr_nick) + { + if (ptr_nick->realname) + free (ptr_nick->realname); + ptr_nick->realname = (ptr_channel && pos_realname + && server->cap_extended_join) ? + strdup (pos_realname) : NULL; } /* display output of who (manual who from user) */ @@ -4912,6 +5038,74 @@ IRC_PROTOCOL_CALLBACK(438) } /* + * Callback for the IRC message "470": forwarding to another channel. + * + * Message looks like: + * :server 470 mynick #channel ##channel :Forwarding to another channel + */ + +IRC_PROTOCOL_CALLBACK(470) +{ + struct t_gui_buffer *ptr_buffer; + struct t_gui_lines *own_lines; + const char *buffer_name, *short_name, *localvar_channel; + int lines_count; + + irc_protocol_cb_generic_error (server, + date, nick, address, host, command, + ignored, argc, argv, argv_eol); + + if ((argc >= 5) && !irc_channel_search (server, argv[3])) + { + ptr_buffer = irc_channel_search_buffer (server, + IRC_CHANNEL_TYPE_CHANNEL, + argv[3]); + if (ptr_buffer) + { + short_name = weechat_buffer_get_string (ptr_buffer, "short_name"); + localvar_channel = weechat_buffer_get_string (ptr_buffer, + "localvar_channel"); + if (!short_name + || (localvar_channel + && (strcmp (localvar_channel, short_name) == 0))) + { + /* + * update the short_name only if it was not changed by the + * user + */ + weechat_buffer_set (ptr_buffer, "short_name", argv[4]); + } + buffer_name = irc_buffer_build_name (server->name, argv[4]); + weechat_buffer_set (ptr_buffer, "name", buffer_name); + weechat_buffer_set (ptr_buffer, "localvar_set_channel", argv[4]); + + /* + * check if logger backlog should be displayed for the new channel + * name: it is displayed only if the buffer is currently completely + * empty (no messages at all) + */ + lines_count = 0; + own_lines = weechat_hdata_pointer (weechat_hdata_get ("buffer"), + ptr_buffer, "own_lines"); + if (own_lines) + { + lines_count = weechat_hdata_integer ( + weechat_hdata_get ("lines"), + own_lines, "lines_count"); + } + if (lines_count == 0) + { + (void) weechat_hook_signal_send ("logger_backlog", + WEECHAT_HOOK_SIGNAL_POINTER, + ptr_buffer); + } + } + } + + return WEECHAT_RC_OK; +} + +/* * Callback for the IRC message "728": quietlist. * * Message looks like: @@ -5544,7 +5738,7 @@ irc_protocol_recv_command (struct t_irc_server *server, { "464", /* password incorrect */ 1, 0, &irc_protocol_cb_generic_error }, { "465", /* you are banned from this server */ 1, 0, &irc_protocol_cb_generic_error }, { "467", /* channel key already set */ 1, 0, &irc_protocol_cb_generic_error }, - { "470", /* forwarding to another channel */ 1, 0, &irc_protocol_cb_generic_error }, + { "470", /* forwarding to another channel */ 1, 0, &irc_protocol_cb_470 }, { "471", /* channel is already full */ 1, 0, &irc_protocol_cb_generic_error }, { "472", /* unknown mode char to me */ 1, 0, &irc_protocol_cb_generic_error }, { "473", /* cannot join channel (invite only) */ 1, 0, &irc_protocol_cb_generic_error }, diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h index c1f88d0d5..186a0729b 100644 --- a/src/plugins/irc/irc-protocol.h +++ b/src/plugins/irc/irc-protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c index 6518cac15..4e5155090 100644 --- a/src/plugins/irc/irc-raw.c +++ b/src/plugins/irc/irc-raw.c @@ -1,7 +1,7 @@ /* * irc-raw.c - functions for IRC raw data messages * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-raw.h b/src/plugins/irc/irc-raw.h index 82fc529b0..6d9b23d78 100644 --- a/src/plugins/irc/irc-raw.h +++ b/src/plugins/irc/irc-raw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 576d6fd24..de1c71ee5 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -1,7 +1,7 @@ /* * irc-redirect.c - redirection of IRC command output * - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-redirect.h b/src/plugins/irc/irc-redirect.h index b78db090a..7fd841621 100644 --- a/src/plugins/irc/irc-redirect.h +++ b/src/plugins/irc/irc-redirect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2010-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c index 623d12a27..f5bf4dd8b 100644 --- a/src/plugins/irc/irc-sasl.c +++ b/src/plugins/irc/irc-sasl.c @@ -1,7 +1,7 @@ /* * irc-sasl.c - SASL authentication with IRC server * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-sasl.h b/src/plugins/irc/irc-sasl.h index 2677f5247..d3b61ddd9 100644 --- a/src/plugins/irc/irc-sasl.h +++ b/src/plugins/irc/irc-sasl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index f5824660c..6c081e3a0 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1,7 +1,7 @@ /* * irc-server.c - I/O communication with IRC servers * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2010 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2012 Simon Arlott * @@ -96,6 +96,7 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] = { "autoreconnect", "on" }, { "autoreconnect_delay", "10" }, { "nicks", "" }, + { "nicks_alternate", "on" }, { "username", "" }, { "realname", "" }, { "local_hostname", "" }, @@ -407,7 +408,7 @@ void irc_server_set_addresses (struct t_irc_server *server, const char *addresses) { int i; - char *pos, *error; + char *pos, *error, *addresses_eval; long number; /* free data */ @@ -431,8 +432,11 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses) /* set new addresses/ports */ if (addresses && addresses[0]) { + addresses_eval = weechat_string_eval_expression (addresses, + NULL, NULL, NULL); server->addresses_array = weechat_string_split ( - addresses, ",", 0, 0, &server->addresses_count); + (addresses_eval) ? addresses_eval : addresses, + ",", 0, 0, &server->addresses_count); server->ports_array = malloc ( server->addresses_count * sizeof (server->ports_array[0])); server->retry_array = malloc ( @@ -455,6 +459,8 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses) } server->retry_array[i] = 0; } + if (addresses_eval) + free (addresses_eval); } } @@ -624,8 +630,8 @@ irc_server_get_alternate_nick (struct t_irc_server *server) /* now we have tried all nicks in list */ - /* if alternate nick is disabled, just return NULL */ - if (!weechat_config_boolean (irc_config_network_alternate_nick)) + /* if alternate nicks are disabled, just return NULL */ + if (!IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_NICKS_ALTERNATE)) return NULL; /* use main nick and we will add "_" and then number if needed */ @@ -1011,6 +1017,7 @@ irc_server_alloc (const char *name) new_server->nick_modes = NULL; new_server->cap_away_notify = 0; new_server->cap_account_notify = 0; + new_server->cap_extended_join = 0; new_server->isupport = NULL; new_server->prefix_modes = NULL; new_server->prefix_chars = NULL; @@ -1073,25 +1080,28 @@ irc_server_alloc (const char *name) for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) { length = strlen (new_server->name) + 1 + - strlen (irc_server_options[i][0]) + 1; + strlen (irc_server_options[i][0]) + + 512 + /* inherited option name (irc.server_default.xxx) */ + 1; option_name = malloc (length); if (option_name) { - snprintf (option_name, length, "%s.%s", + snprintf (option_name, length, "%s.%s << irc.server_default.%s", new_server->name, + irc_server_options[i][0], irc_server_options[i][0]); - new_server->options[i] = - irc_config_server_new_option (irc_config_file, - irc_config_section_server, - i, - option_name, - NULL, - NULL, - 1, - &irc_config_server_check_value_cb, - irc_server_options[i][0], - &irc_config_server_change_cb, - irc_server_options[i][0]); + new_server->options[i] = irc_config_server_new_option ( + irc_config_file, + irc_config_section_server, + i, + option_name, + NULL, + NULL, + 1, + &irc_config_server_check_value_cb, + irc_server_options[i][0], + &irc_config_server_change_cb, + irc_server_options[i][0]); irc_config_server_change_cb (irc_server_options[i][0], new_server->options[i]); free (option_name); @@ -3328,7 +3338,13 @@ irc_server_login (struct t_irc_server *server) server, IRC_SERVER_OPTION_CAPABILITIES); if (password && password[0]) - irc_server_sendf (server, 0, NULL, "PASS %s", password); + { + irc_server_sendf ( + server, 0, NULL, + "PASS %s%s", + ((password[0] == ':') || (strchr (password, ' '))) ? ":" : "", + password); + } if (!server->nick) { @@ -4678,6 +4694,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address, } server->cap_away_notify = 0; server->cap_account_notify = 0; + server->cap_extended_join = 0; server->is_away = 0; server->away_time = 0; server->lag = 0; @@ -5261,6 +5278,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name) WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, cap_away_notify, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, cap_account_notify, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, cap_extended_join, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL); @@ -5402,6 +5420,9 @@ irc_server_add_to_infolist (struct t_infolist *infolist, if (!weechat_infolist_new_var_string (ptr_item, "nicks", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NICKS))) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "nicks_alternate", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_NICKS_ALTERNATE))) + return 0; if (!weechat_infolist_new_var_string (ptr_item, "username", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME))) return 0; @@ -5480,6 +5501,8 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_integer (ptr_item, "cap_account_notify", server->cap_account_notify)) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "cap_extended_join", server->cap_extended_join)) + return 0; if (!weechat_infolist_new_var_string (ptr_item, "isupport", server->isupport)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "prefix_modes", server->prefix_modes)) @@ -5573,7 +5596,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" ipv6 . . . . . . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_IPV6]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_IPV6])) ? "on" : "off"); /* ssl */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL])) @@ -5582,7 +5605,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" ssl. . . . . . . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL])) ? "on" : "off"); /* ssl_cert */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT])) @@ -5619,7 +5642,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" ssl_verify . . . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY])) ? "on" : "off"); /* password */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_PASSWORD])) @@ -5673,7 +5696,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" autoconnect. . . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT])) ? "on" : "off"); /* autoreconnect */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT])) @@ -5682,7 +5705,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" autoreconnect. . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT])) ? "on" : "off"); /* autoreconnect_delay */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])) @@ -5698,6 +5721,15 @@ irc_server_print_log () else weechat_log_printf (" nicks. . . . . . . . : '%s'", weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_NICKS])); + /* nicks_alternate */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_NICKS_ALTERNATE])) + weechat_log_printf (" nicks_alternate. . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_NICKS_ALTERNATE)) ? + "on" : "off"); + else + weechat_log_printf (" nicks_alternate. . . : %s", + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_NICKS_ALTERNATE])) ? + "on" : "off"); /* username */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_USERNAME])) weechat_log_printf (" username . . . . . . : null ('%s')", @@ -5745,7 +5777,7 @@ irc_server_print_log () "on" : "off"); else weechat_log_printf (" autorejoin . . . . . : %s", - weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOREJOIN]) ? + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOREJOIN])) ? "on" : "off"); /* autorejoin_delay */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOREJOIN_DELAY])) @@ -5843,6 +5875,7 @@ irc_server_print_log () weechat_log_printf (" nick_modes . . . . . : '%s'", ptr_server->nick_modes); weechat_log_printf (" cap_away_notify. . . : %d", ptr_server->cap_away_notify); weechat_log_printf (" cap_account_notify . : %d", ptr_server->cap_account_notify); + weechat_log_printf (" cap_extended_join. . : %d", ptr_server->cap_extended_join); weechat_log_printf (" isupport . . . . . . : '%s'", ptr_server->isupport); weechat_log_printf (" prefix_modes . . . . : '%s'", ptr_server->prefix_modes); weechat_log_printf (" prefix_chars . . . . : '%s'", ptr_server->prefix_chars); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index dd650c325..8ba3d96e6 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. @@ -64,6 +64,7 @@ enum t_irc_server_option IRC_SERVER_OPTION_AUTORECONNECT, /* autoreconnect when disconnected */ IRC_SERVER_OPTION_AUTORECONNECT_DELAY, /* delay before trying again reco */ IRC_SERVER_OPTION_NICKS, /* nicknames (comma separated list) */ + IRC_SERVER_OPTION_NICKS_ALTERNATE, /* use alternate nicknames */ IRC_SERVER_OPTION_USERNAME, /* user name */ IRC_SERVER_OPTION_REALNAME, /* real name */ IRC_SERVER_OPTION_LOCAL_HOSTNAME,/* custom local hostname */ @@ -186,6 +187,7 @@ struct t_irc_server char *nick_modes; /* nick modes */ int cap_away_notify; /* 1 if capability away-notify is enabled*/ int cap_account_notify; /* 1 if CAP account-notify is enabled */ + int cap_extended_join; /* 1 if CAP extended-join is enabled */ char *isupport; /* copy of message 005 (ISUPPORT) */ char *prefix_modes; /* prefix modes from msg 005 (eg "ohv") */ char *prefix_chars; /* prefix chars from msg 005 (eg "@%+") */ diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index 08a7f023d..458bf0204 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -1,7 +1,7 @@ /* * irc-upgrade.c - save/restore IRC plugin data when upgrading WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -373,6 +373,7 @@ irc_upgrade_read_cb (void *data, irc_upgrade_current_server->nick_modes = strdup (str); irc_upgrade_current_server->cap_away_notify = weechat_infolist_integer (infolist, "cap_away_notify"); irc_upgrade_current_server->cap_account_notify = weechat_infolist_integer (infolist, "cap_account_notify"); + irc_upgrade_current_server->cap_extended_join = weechat_infolist_integer (infolist, "cap_extended_join"); str = weechat_infolist_string (infolist, "isupport"); if (str) irc_upgrade_current_server->isupport = strdup (str); @@ -574,7 +575,8 @@ irc_upgrade_read_cb (void *data, weechat_infolist_string (infolist, "host"), weechat_infolist_string (infolist, "prefixes"), weechat_infolist_integer (infolist, "away"), - weechat_infolist_string (infolist, "account")); + weechat_infolist_string (infolist, "account"), + weechat_infolist_string (infolist, "realname")); if (ptr_nick) { /* diff --git a/src/plugins/irc/irc-upgrade.h b/src/plugins/irc/irc-upgrade.h index 17da632cd..0c9ab8730 100644 --- a/src/plugins/irc/irc-upgrade.h +++ b/src/plugins/irc/irc-upgrade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 9222d3f88..934df21ce 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -1,7 +1,7 @@ /* * irc.c - IRC (Internet Relay Chat) plugin for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h index 1ee4d538b..3e4cce9f2 100644 --- a/src/plugins/irc/irc.h +++ b/src/plugins/irc/irc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/javascript/CMakeLists.txt b/src/plugins/javascript/CMakeLists.txt index 91a56a340..a2911a218 100644 --- a/src/plugins/javascript/CMakeLists.txt +++ b/src/plugins/javascript/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/javascript/Makefile.am b/src/plugins/javascript/Makefile.am index 5a81350f3..983108751 100644 --- a/src/plugins/javascript/Makefile.am +++ b/src/plugins/javascript/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index a5a07c432..fe223252b 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -2,7 +2,7 @@ * weechat-js-api.cpp - javascript API functions * * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -25,6 +25,7 @@ #include <cstdlib> #include <cstring> #include <string> +#include <time.h> extern "C" { diff --git a/src/plugins/javascript/weechat-js-api.h b/src/plugins/javascript/weechat-js-api.h index 74de77941..199296234 100644 --- a/src/plugins/javascript/weechat-js-api.h +++ b/src/plugins/javascript/weechat-js-api.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/javascript/weechat-js-v8.cpp b/src/plugins/javascript/weechat-js-v8.cpp index 3effbd02c..2633c7a97 100644 --- a/src/plugins/javascript/weechat-js-v8.cpp +++ b/src/plugins/javascript/weechat-js-v8.cpp @@ -2,7 +2,7 @@ * weechat-js-v8.cpp - v8 javascript functions * * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/javascript/weechat-js-v8.h b/src/plugins/javascript/weechat-js-v8.h index 65aa930fe..d71965418 100644 --- a/src/plugins/javascript/weechat-js-v8.h +++ b/src/plugins/javascript/weechat-js-v8.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp index 5636cda12..927f76cb8 100644 --- a/src/plugins/javascript/weechat-js.cpp +++ b/src/plugins/javascript/weechat-js.cpp @@ -2,7 +2,7 @@ * weechat-js.cpp - javascript plugin for WeeChat * * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/javascript/weechat-js.h b/src/plugins/javascript/weechat-js.h index a6412f347..4d26e9c6f 100644 --- a/src/plugins/javascript/weechat-js.h +++ b/src/plugins/javascript/weechat-js.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 Koka El Kiwi <kokakiwi@kokakiwi.net> - * Copyright (C) 2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2015-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/CMakeLists.txt b/src/plugins/logger/CMakeLists.txt index 85d1ab885..8b2a61b17 100644 --- a/src/plugins/logger/CMakeLists.txt +++ b/src/plugins/logger/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/logger/Makefile.am b/src/plugins/logger/Makefile.am index a0c5b7708..b150a4392 100644 --- a/src/plugins/logger/Makefile.am +++ b/src/plugins/logger/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c index 1a4d3e4c6..a5317a36e 100644 --- a/src/plugins/logger/logger-buffer.c +++ b/src/plugins/logger/logger-buffer.c @@ -1,7 +1,7 @@ /* * logger-buffer.c - logger buffer list management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-buffer.h b/src/plugins/logger/logger-buffer.h index 45d6799e1..4168fe736 100644 --- a/src/plugins/logger/logger-buffer.h +++ b/src/plugins/logger/logger-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index cac61d8a9..49d28e0f1 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -1,7 +1,7 @@ /* * logger-config.c - logger configuration options (file logger.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-config.h b/src/plugins/logger/logger-config.h index c930ae0f5..834da3ab6 100644 --- a/src/plugins/logger/logger-config.h +++ b/src/plugins/logger/logger-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-info.c b/src/plugins/logger/logger-info.c index cb3db8bf2..dd0f3ae60 100644 --- a/src/plugins/logger/logger-info.c +++ b/src/plugins/logger/logger-info.c @@ -1,7 +1,7 @@ /* * logger-info.c - info and infolist hooks for logger plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-info.h b/src/plugins/logger/logger-info.h index 1d6a6fa14..21f4963e7 100644 --- a/src/plugins/logger/logger-info.h +++ b/src/plugins/logger/logger-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-tail.c b/src/plugins/logger/logger-tail.c index 6325366af..d62dc13f9 100644 --- a/src/plugins/logger/logger-tail.c +++ b/src/plugins/logger/logger-tail.c @@ -1,7 +1,7 @@ /* * logger-tail.c - return last lines of a file * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger-tail.h b/src/plugins/logger/logger-tail.h index 086ef349a..fa5ef473d 100644 --- a/src/plugins/logger/logger-tail.h +++ b/src/plugins/logger/logger-tail.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 06e0ff4ca..8b698470a 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -1,7 +1,7 @@ /* * logger.c - logger plugin for WeeChat: save buffer lines to disk files * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -559,11 +559,12 @@ logger_write_line (struct t_logger_buffer *logger_buffer, fopen (logger_buffer->log_filename, "a"); if (!logger_buffer->log_file) { - weechat_printf_tags (NULL, - "no_log", - _("%s%s: unable to write log file \"%s\""), - weechat_prefix ("error"), LOGGER_PLUGIN_NAME, - logger_buffer->log_filename); + weechat_printf_tags ( + NULL, + "no_log", + _("%s%s: unable to write log file \"%s\": %s"), + weechat_prefix ("error"), LOGGER_PLUGIN_NAME, + logger_buffer->log_filename, strerror (errno)); logger_buffer_free (logger_buffer); return; } diff --git a/src/plugins/logger/logger.h b/src/plugins/logger/logger.h index dc40d1df8..df3e0d8e0 100644 --- a/src/plugins/logger/logger.h +++ b/src/plugins/logger/logger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/lua/CMakeLists.txt b/src/plugins/lua/CMakeLists.txt index 4a075264c..b661285fe 100644 --- a/src/plugins/lua/CMakeLists.txt +++ b/src/plugins/lua/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> -# Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/lua/Makefile.am b/src/plugins/lua/Makefile.am index 3ab660885..15a1a4d56 100644 --- a/src/plugins/lua/Makefile.am +++ b/src/plugins/lua/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> -# Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index cfbe45f9c..ac9ad7397 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2,7 +2,7 @@ * weechat-lua-api.c - lua API functions * * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/lua/weechat-lua-api.h b/src/plugins/lua/weechat-lua-api.h index 65abd09fc..3227967dd 100644 --- a/src/plugins/lua/weechat-lua-api.h +++ b/src/plugins/lua/weechat-lua-api.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index e78ebddf2..e20eaa912 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -2,7 +2,7 @@ * weechat-lua.c - lua plugin for WeeChat * * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/lua/weechat-lua.h b/src/plugins/lua/weechat-lua.h index 0a760babf..dee5d2f09 100644 --- a/src/plugins/lua/weechat-lua.h +++ b/src/plugins/lua/weechat-lua.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> - * Copyright (C) 2006-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/perl/CMakeLists.txt b/src/plugins/perl/CMakeLists.txt index 41b2f8fa1..5dac3d925 100644 --- a/src/plugins/perl/CMakeLists.txt +++ b/src/plugins/perl/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/perl/Makefile.am b/src/plugins/perl/Makefile.am index b011f0caf..49eedeae3 100644 --- a/src/plugins/perl/Makefile.am +++ b/src/plugins/perl/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 61631c72b..c4cc5f303 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -1,7 +1,7 @@ /* * weechat-perl-api.c - perl API functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2008 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2012 Simon Arlott * diff --git a/src/plugins/perl/weechat-perl-api.h b/src/plugins/perl/weechat-perl-api.h index 2a3c31c00..48d06f9d4 100644 --- a/src/plugins/perl/weechat-perl-api.h +++ b/src/plugins/perl/weechat-perl-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index eed230b52..70182885b 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -1,7 +1,7 @@ /* * weechat-perl.c - perl plugin for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2008 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/perl/weechat-perl.h b/src/plugins/perl/weechat-perl.h index 1d31fa794..107806ac0 100644 --- a/src/plugins/perl/weechat-perl.h +++ b/src/plugins/perl/weechat-perl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 157a94d04..455e46041 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -1,7 +1,7 @@ /* * plugin-api.c - extra functions for plugin API * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h index 672eac8c9..963cc874b 100644 --- a/src/plugins/plugin-api.h +++ b/src/plugins/plugin-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c index a1c779fbb..dab7798e8 100644 --- a/src/plugins/plugin-config.c +++ b/src/plugins/plugin-config.c @@ -1,7 +1,7 @@ /* * plugin-config.c - plugin configuration options (file plugins.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-config.h b/src/plugins/plugin-config.h index c7a0498fa..271d8eee9 100644 --- a/src/plugins/plugin-config.h +++ b/src/plugins/plugin-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c index a8b38b3a8..b46e236f3 100644 --- a/src/plugins/plugin-script-api.c +++ b/src/plugins/plugin-script-api.c @@ -1,7 +1,7 @@ /* * script-api.c - script API functions, used by script plugins * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h index 7786c8798..8ad03e742 100644 --- a/src/plugins/plugin-script-api.h +++ b/src/plugins/plugin-script-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/plugin-script-callback.c b/src/plugins/plugin-script-callback.c index 437116c16..7d734f77c 100644 --- a/src/plugins/plugin-script-callback.c +++ b/src/plugins/plugin-script-callback.c @@ -1,7 +1,7 @@ /* * script-callback.c - script callbacks management * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-script-callback.h b/src/plugins/plugin-script-callback.h index e1b72fd2e..0ff2fa1f1 100644 --- a/src/plugins/plugin-script-callback.h +++ b/src/plugins/plugin-script-callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c index ffb003a84..fa5bf85e9 100644 --- a/src/plugins/plugin-script.c +++ b/src/plugins/plugin-script.c @@ -1,7 +1,7 @@ /* * plugin-script.c - common functions used by script plugins * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin-script.h b/src/plugins/plugin-script.h index 3f60191ae..d92b30d3b 100644 --- a/src/plugins/plugin-script.h +++ b/src/plugins/plugin-script.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 960310d1f..73c842656 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -1,7 +1,7 @@ /* * plugin.c - WeeChat plugins management (load/unload dynamic C libraries) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 08028f95a..c605079f6 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/python/CMakeLists.txt b/src/plugins/python/CMakeLists.txt index 2684b889f..6fccb0ab2 100644 --- a/src/plugins/python/CMakeLists.txt +++ b/src/plugins/python/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/python/Makefile.am b/src/plugins/python/Makefile.am index 43de0e137..b95ec6913 100644 --- a/src/plugins/python/Makefile.am +++ b/src/plugins/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 1eca2723a..cce3cd9ea 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -1,7 +1,7 @@ /* * weechat-python-api.c - python API functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2012 Simon Arlott * diff --git a/src/plugins/python/weechat-python-api.h b/src/plugins/python/weechat-python-api.h index 058d28f75..68b434b33 100644 --- a/src/plugins/python/weechat-python-api.h +++ b/src/plugins/python/weechat-python-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index eb382d0d2..de19aa3f8 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -1,7 +1,7 @@ /* * weechat-python.c - python plugin for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2012 Simon Arlott * diff --git a/src/plugins/python/weechat-python.h b/src/plugins/python/weechat-python.h index 3a4375428..11920c187 100644 --- a/src/plugins/python/weechat-python.h +++ b/src/plugins/python/weechat-python.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/relay/CMakeLists.txt b/src/plugins/relay/CMakeLists.txt index e3a0a6f33..4dc1bb2e7 100644 --- a/src/plugins/relay/CMakeLists.txt +++ b/src/plugins/relay/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/relay/Makefile.am b/src/plugins/relay/Makefile.am index b27e27690..96c33157c 100644 --- a/src/plugins/relay/Makefile.am +++ b/src/plugins/relay/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index 3facb21e0..5731edd1a 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -1,7 +1,7 @@ /* * relay-irc.c - IRC protocol for relay to client: IRC proxy/bouncer * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -754,7 +754,7 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, void *ptr_own_lines, *ptr_line, *ptr_line_data; void *ptr_hdata_line, *ptr_hdata_line_data; char *tags, *message; - const char *ptr_nick, *ptr_nick1, *ptr_nick2, *ptr_host; + const char *ptr_nick, *ptr_nick1, *ptr_nick2, *ptr_host, *localvar_nick; int irc_command, irc_action, count, max_number, max_minutes; time_t date_min, date_min2, date; @@ -780,6 +780,10 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, if (!ptr_hdata_line_data) return; + localvar_nick = NULL; + if (weechat_config_boolean (relay_config_irc_backlog_since_last_message)) + localvar_nick = weechat_buffer_get_string (buffer, "localvar_nick"); + max_number = weechat_config_integer (relay_config_irc_backlog_max_number); max_minutes = weechat_config_integer (relay_config_irc_backlog_max_minutes); date_min = (max_minutes > 0) ? time (NULL) - (max_minutes * 60) : 0; @@ -810,7 +814,7 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, &irc_command, NULL, /* irc_action */ &date, - NULL, /* nick */ + &ptr_nick, NULL, /* nick1 */ NULL, /* nick2 */ NULL, /* host */ @@ -826,6 +830,17 @@ relay_irc_send_channel_backlog (struct t_relay_client *client, /* if we have reached max number of messages, exit loop */ if ((max_number > 0) && (count > max_number)) break; + + if (localvar_nick && localvar_nick[0] + && ptr_nick && (strcmp (ptr_nick, localvar_nick) == 0)) + { + /* + * stop when we find a line sent by the current nick + * (and include this line) + */ + ptr_line = weechat_hdata_move (ptr_hdata_line, ptr_line, -1); + break; + } } ptr_line = weechat_hdata_move (ptr_hdata_line, ptr_line, -1); } diff --git a/src/plugins/relay/irc/relay-irc.h b/src/plugins/relay/irc/relay-irc.h index 90775a91d..fa2ea21ce 100644 --- a/src/plugins/relay/irc/relay-irc.h +++ b/src/plugins/relay/irc/relay-irc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c index 4eb355ab6..502384e4e 100644 --- a/src/plugins/relay/relay-buffer.c +++ b/src/plugins/relay/relay-buffer.c @@ -1,7 +1,7 @@ /* * relay-buffer.c - display clients list on relay buffer * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-buffer.h b/src/plugins/relay/relay-buffer.h index 72a67d661..a377f4340 100644 --- a/src/plugins/relay/relay-buffer.h +++ b/src/plugins/relay/relay-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index 4a6a2615b..fbb00cebb 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -1,7 +1,7 @@ /* * relay-client.c - client functions for relay plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -263,8 +263,8 @@ relay_client_handshake_timer_cb (void *data, int remaining_calls) #endif /* HAVE_GNUTLS */ /* - * Reads text data from a client: splits data on '\n' and keep a partial message - * if date does not end with '\n'. + * Reads text data from a client: splits data on '\n' and keeps a partial + * message if data does not end with '\n'. */ void @@ -515,8 +515,7 @@ relay_client_recv_cb (void *arg_client, int fd) * * "A Pong frame MAY be sent unsolicited. This serves as a * unidirectional heartbeat. A response to an unsolicited - * Pong - * frame is not expected." + * Pong frame is not expected." */ return WEECHAT_RC_OK; } @@ -943,8 +942,7 @@ relay_client_timer_cb (void *data, int remaining_calls) { for (i = 0; i < 2; i++) { - if (ptr_client->outqueue->raw_message - && ptr_client->outqueue->raw_message[i]) + if (ptr_client->outqueue->raw_message[i]) { /* * print raw message and remove it from outqueue diff --git a/src/plugins/relay/relay-client.h b/src/plugins/relay/relay-client.h index 8e8a2c59d..db2366aed 100644 --- a/src/plugins/relay/relay-client.h +++ b/src/plugins/relay/relay-client.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c index b6c958a06..e795bdeaa 100644 --- a/src/plugins/relay/relay-command.c +++ b/src/plugins/relay/relay-command.c @@ -1,7 +1,7 @@ /* * relay-command.c - relay command * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-command.h b/src/plugins/relay/relay-command.h index 0ff5c99d6..23a90dcf0 100644 --- a/src/plugins/relay/relay-command.h +++ b/src/plugins/relay/relay-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-completion.c b/src/plugins/relay/relay-completion.c index 7c6fd7486..b1fed1062 100644 --- a/src/plugins/relay/relay-completion.c +++ b/src/plugins/relay/relay-completion.c @@ -1,7 +1,7 @@ /* * relay-completion.c - completion for relay command * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-completion.h b/src/plugins/relay/relay-completion.h index f522103d5..e8f36f601 100644 --- a/src/plugins/relay/relay-completion.h +++ b/src/plugins/relay/relay-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index cd76bd34d..ec1ec0474 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -1,7 +1,7 @@ /* * relay-config.c - relay configuration options (file relay.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -68,6 +68,7 @@ struct t_config_option *relay_config_network_websocket_allowed_origins; struct t_config_option *relay_config_irc_backlog_max_minutes; struct t_config_option *relay_config_irc_backlog_max_number; struct t_config_option *relay_config_irc_backlog_since_last_disconnect; +struct t_config_option *relay_config_irc_backlog_since_last_message; struct t_config_option *relay_config_irc_backlog_tags; struct t_config_option *relay_config_irc_backlog_time_format; @@ -816,6 +817,11 @@ relay_config_init () "backlog_since_last_disconnect", "boolean", N_("display backlog starting from last client disconnect"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_since_last_message = weechat_config_new_option ( + relay_config_file, ptr_section, + "backlog_since_last_message", "boolean", + N_("display backlog starting from your last message"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); relay_config_irc_backlog_tags = weechat_config_new_option ( relay_config_file, ptr_section, "backlog_tags", "string", diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h index 09c1851c8..08597900c 100644 --- a/src/plugins/relay/relay-config.h +++ b/src/plugins/relay/relay-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -50,6 +50,7 @@ extern struct t_config_option *relay_config_network_websocket_allowed_origins; extern struct t_config_option *relay_config_irc_backlog_max_minutes; extern struct t_config_option *relay_config_irc_backlog_max_number; extern struct t_config_option *relay_config_irc_backlog_since_last_disconnect; +extern struct t_config_option *relay_config_irc_backlog_since_last_message; extern struct t_config_option *relay_config_irc_backlog_tags; extern struct t_config_option *relay_config_irc_backlog_time_format; diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c index 05a0bbaa2..123243fe7 100644 --- a/src/plugins/relay/relay-info.c +++ b/src/plugins/relay/relay-info.c @@ -1,7 +1,7 @@ /* * relay-info.c - info and infolist hooks for relay plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-info.h b/src/plugins/relay/relay-info.h index 376fa494f..6d0fbe04e 100644 --- a/src/plugins/relay/relay-info.h +++ b/src/plugins/relay/relay-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c index 88c6125a3..07496051e 100644 --- a/src/plugins/relay/relay-network.c +++ b/src/plugins/relay/relay-network.c @@ -1,7 +1,7 @@ /* * relay-network.c - network functions for relay plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-network.h b/src/plugins/relay/relay-network.h index c881c3ab9..7e2fc43fa 100644 --- a/src/plugins/relay/relay-network.h +++ b/src/plugins/relay/relay-network.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-raw.c b/src/plugins/relay/relay-raw.c index 465cac7a6..28a1b55b6 100644 --- a/src/plugins/relay/relay-raw.c +++ b/src/plugins/relay/relay-raw.c @@ -1,7 +1,7 @@ /* * relay-raw.c - functions for Relay raw data messages * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-raw.h b/src/plugins/relay/relay-raw.h index ef0f8a1b3..a4d8d4f02 100644 --- a/src/plugins/relay/relay-raw.h +++ b/src/plugins/relay/relay-raw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c index adfe662d1..56fd8da12 100644 --- a/src/plugins/relay/relay-server.c +++ b/src/plugins/relay/relay-server.c @@ -1,7 +1,7 @@ /* * relay-server.c - server functions for relay plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-server.h b/src/plugins/relay/relay-server.h index 2323d21ea..64212bad5 100644 --- a/src/plugins/relay/relay-server.h +++ b/src/plugins/relay/relay-server.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-upgrade.c b/src/plugins/relay/relay-upgrade.c index bfdcaa358..773fabed7 100644 --- a/src/plugins/relay/relay-upgrade.c +++ b/src/plugins/relay/relay-upgrade.c @@ -1,7 +1,7 @@ /* * relay-upgrade.c - save/restore relay plugin data when upgrading WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-upgrade.h b/src/plugins/relay/relay-upgrade.h index ba842f4a3..995d81bc3 100644 --- a/src/plugins/relay/relay-upgrade.h +++ b/src/plugins/relay/relay-upgrade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-websocket.c b/src/plugins/relay/relay-websocket.c index 91862d65a..95a59f4b4 100644 --- a/src/plugins/relay/relay-websocket.c +++ b/src/plugins/relay/relay-websocket.c @@ -1,7 +1,7 @@ /* * relay-websocket.c - websocket server functions for relay plugin (RFC 6455) * - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay-websocket.h b/src/plugins/relay/relay-websocket.h index a88a8fad0..8d6e565b9 100644 --- a/src/plugins/relay/relay-websocket.h +++ b/src/plugins/relay/relay-websocket.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2013-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index ead40834c..e5b2e0482 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -1,7 +1,7 @@ /* * relay.c - network communication between WeeChat and remote client * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/relay.h b/src/plugins/relay/relay.h index 8c1c9219d..f802fdec6 100644 --- a/src/plugins/relay/relay.h +++ b/src/plugins/relay/relay.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c index ff7a19dfb..8ddc1fc1f 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.c +++ b/src/plugins/relay/weechat/relay-weechat-msg.c @@ -1,7 +1,7 @@ /* * relay-weechat-msg.c - build binary messages for WeeChat protocol * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat-msg.h b/src/plugins/relay/weechat/relay-weechat-msg.h index 4cf988109..8c55ab455 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.h +++ b/src/plugins/relay/weechat/relay-weechat-msg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat-nicklist.c b/src/plugins/relay/weechat/relay-weechat-nicklist.c index be719b54d..73f997808 100644 --- a/src/plugins/relay/weechat/relay-weechat-nicklist.c +++ b/src/plugins/relay/weechat/relay-weechat-nicklist.c @@ -1,7 +1,7 @@ /* * relay-weechat-nicklist.c - nicklist functions for WeeChat protocol * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat-nicklist.h b/src/plugins/relay/weechat/relay-weechat-nicklist.h index 5ba846470..2aebfaf72 100644 --- a/src/plugins/relay/weechat/relay-weechat-nicklist.h +++ b/src/plugins/relay/weechat/relay-weechat-nicklist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 6227a4987..f216cb56f 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -1,7 +1,7 @@ /* * relay-weechat-protocol.c - WeeChat protocol for relay to client * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -405,7 +405,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input) struct t_gui_buffer *ptr_buffer; char *pos, **timer_args; - RELAY_WEECHAT_PROTOCOL_MIN_ARGS(2); + RELAY_WEECHAT_PROTOCOL_MIN_ARGS(1); ptr_buffer = relay_weechat_protocol_get_buffer (argv[0]); if (!ptr_buffer) @@ -417,7 +417,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input) "\"%s %s\""), RELAY_PLUGIN_NAME, command, - argv_eol[0]); + argv[0]); } return WEECHAT_RC_OK; } @@ -1351,7 +1351,7 @@ relay_weechat_protocol_recv (struct t_relay_client *client, const char *data) pos++; } argv = weechat_string_split (pos, " ", 0, 0, &argc); - argv_eol = weechat_string_split (pos, " ", 1, 0, NULL); + argv_eol = weechat_string_split (pos, " ", 2, 0, NULL); } for (i = 0; protocol_cb[i].name; i++) diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.h b/src/plugins/relay/weechat/relay-weechat-protocol.h index c69bd9662..4de3aecb3 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.h +++ b/src/plugins/relay/weechat/relay-weechat-protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat.c b/src/plugins/relay/weechat/relay-weechat.c index 10b7b84ac..be0ac4400 100644 --- a/src/plugins/relay/weechat/relay-weechat.c +++ b/src/plugins/relay/weechat/relay-weechat.c @@ -1,7 +1,7 @@ /* * relay-weechat.c - WeeChat protocol for relay to client * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/relay/weechat/relay-weechat.h b/src/plugins/relay/weechat/relay-weechat.h index b07a0c2a7..678845b91 100644 --- a/src/plugins/relay/weechat/relay-weechat.h +++ b/src/plugins/relay/weechat/relay-weechat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt index eb513f78d..2d03858c5 100644 --- a/src/plugins/ruby/CMakeLists.txt +++ b/src/plugins/ruby/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/ruby/Makefile.am b/src/plugins/ruby/Makefile.am index c03eca335..01c3e932d 100644 --- a/src/plugins/ruby/Makefile.am +++ b/src/plugins/ruby/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index a8bb43612..573757375 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -1,7 +1,7 @@ /* * weechat-ruby-api.c - ruby API functions * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2012 Simon Arlott * diff --git a/src/plugins/ruby/weechat-ruby-api.h b/src/plugins/ruby/weechat-ruby-api.h index 3275892ee..d6676bb03 100644 --- a/src/plugins/ruby/weechat-ruby-api.h +++ b/src/plugins/ruby/weechat-ruby-api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index 409806ba5..d55e1d7c4 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -1,7 +1,7 @@ /* * weechat-ruby.c - ruby plugin for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. @@ -1093,9 +1093,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) " if RUBY_VERSION.split('.')[0] == '1' and RUBY_VERSION.split('.')[1] <= '8'\n" " require 'rubygems'\n" " else\n" - " require 'enc/encdb.so'\n" - " require 'enc/trans/transdb.so'\n" - "\n" " require 'thread'\n" " class ::Mutex\n" " def synchronize(*args)\n" @@ -1118,6 +1115,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) " end\n" "\n" " begin\n" + " require 'enc/encdb.so'\n" + " require 'enc/trans/transdb.so'\n" " module_eval(lines)\n" " rescue Exception => e\n" " @load_eval_file_error = e\n" diff --git a/src/plugins/ruby/weechat-ruby.h b/src/plugins/ruby/weechat-ruby.h index f2c8a70bb..cde73fb85 100644 --- a/src/plugins/ruby/weechat-ruby.h +++ b/src/plugins/ruby/weechat-ruby.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2005-2007 Emmanuel Bouthenot <kolter@openics.org> * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/script/CMakeLists.txt b/src/plugins/script/CMakeLists.txt index eade5489a..cb7af6d79 100644 --- a/src/plugins/script/CMakeLists.txt +++ b/src/plugins/script/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/script/Makefile.am b/src/plugins/script/Makefile.am index 680d103c2..b5f0c7c90 100644 --- a/src/plugins/script/Makefile.am +++ b/src/plugins/script/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c index 753be0531..2dab05f53 100644 --- a/src/plugins/script/script-action.c +++ b/src/plugins/script/script-action.c @@ -1,7 +1,7 @@ /* * script-action.c - actions on scripts * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-action.h b/src/plugins/script/script-action.h index 25f6b145c..c11a9fe56 100644 --- a/src/plugins/script/script-action.h +++ b/src/plugins/script/script-action.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c index 08daebc42..0bf1ec642 100644 --- a/src/plugins/script/script-buffer.c +++ b/src/plugins/script/script-buffer.c @@ -1,7 +1,7 @@ /* * script-buffer.c - display scripts on script buffer * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-buffer.h b/src/plugins/script/script-buffer.h index d717dff9b..63b5f6af6 100644 --- a/src/plugins/script/script-buffer.h +++ b/src/plugins/script/script-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c index d7e0cb576..20916368e 100644 --- a/src/plugins/script/script-command.c +++ b/src/plugins/script/script-command.c @@ -1,7 +1,7 @@ /* * script-command.c - script command * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -279,7 +279,7 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc, } /* - * Hook command. + * Hooks script command. */ void @@ -300,8 +300,9 @@ script_command_init () " -o: send list of loaded scripts to buffer\n" " -i: copy list of loaded scripts in command line (for " "sending to buffer)\n" - " search: search scripts by tags or text and display result " - "on scripts buffer\n" + " search: search scripts by tags, language (python, " + "perl, ...), filename extension (py, pl, ...) or text; result is " + "displayed on scripts buffer\n" " show: show detailed info about a script\n" " load: load script(s)\n" " unload: unload script(s)\n" @@ -366,7 +367,7 @@ script_command_init () " /script reload urlserver\n" " /script upgrade"), "list -o|-i" - " || search %(script_tags)" + " || search %(script_tags)|%(script_languages)|%(script_extensions)" " || show %(script_scripts)" " || load %(script_files)|%*" " || unload %(python_script)|%(perl_script)|%(ruby_script)|" diff --git a/src/plugins/script/script-command.h b/src/plugins/script/script-command.h index c29e82a5a..8ed1ed137 100644 --- a/src/plugins/script/script-command.h +++ b/src/plugins/script/script-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-completion.c b/src/plugins/script/script-completion.c index 16749c56e..781fd4877 100644 --- a/src/plugins/script/script-completion.c +++ b/src/plugins/script/script-completion.c @@ -1,7 +1,7 @@ /* * script-completion.c - completions for script command * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -30,6 +30,58 @@ /* + * Adds script languages (python, perl, ruby, ...) to completion list. + */ + +int +script_completion_languages_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) + { + weechat_hook_completion_list_add (completion, + script_language[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * Adds script extensions (py, pl, rb, ...) to completion list. + */ + +int +script_completion_extensions_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) + { + weechat_hook_completion_list_add (completion, + script_extension[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* * Adds scripts to completion list. */ @@ -215,6 +267,12 @@ script_completion_tags_cb (void *data, const char *completion_item, void script_completion_init () { + weechat_hook_completion ("script_languages", + N_("list of script languages"), + &script_completion_languages_cb, NULL); + weechat_hook_completion ("script_extensions", + N_("list of script extensions"), + &script_completion_extensions_cb, NULL); weechat_hook_completion ("script_scripts", N_("list of scripts in repository"), &script_completion_scripts_cb, NULL); diff --git a/src/plugins/script/script-completion.h b/src/plugins/script/script-completion.h index 64a3d844d..830be0e12 100644 --- a/src/plugins/script/script-completion.h +++ b/src/plugins/script/script-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c index 69aec5d8f..ac5363190 100644 --- a/src/plugins/script/script-config.c +++ b/src/plugins/script/script-config.c @@ -1,7 +1,7 @@ /* * script-config.c - script configuration options (file script.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-config.h b/src/plugins/script/script-config.h index 2917e7da4..381a94eb3 100644 --- a/src/plugins/script/script-config.h +++ b/src/plugins/script/script-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-info.c b/src/plugins/script/script-info.c index c5eb83832..e9df673cb 100644 --- a/src/plugins/script/script-info.c +++ b/src/plugins/script/script-info.c @@ -1,7 +1,7 @@ /* * script-info.c - info, infolist and hdata hooks for script plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-info.h b/src/plugins/script/script-info.h index 797ffe205..b506c4cb2 100644 --- a/src/plugins/script/script-info.h +++ b/src/plugins/script/script-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index bef5fad17..10f79ed16 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -1,7 +1,7 @@ /* * script-repo.c - download and read repository file (plugins.xml.gz) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -948,13 +948,33 @@ script_repo_match_filter (struct t_script_repo *script) if (!has_tag) { match = 0; + if (script->name_with_extension - && weechat_strcasestr (script->name_with_extension, words[i])) + && weechat_strcasestr (script->name_with_extension, + words[i])) + { match = 1; + } + + if (!match + && (weechat_strcasecmp (script_language[script->language], + words[i]) == 0)) + { + match = 1; + } + + if (!match + && (weechat_strcasecmp (script_extension[script->language], + words[i]) == 0)) + { + match = 1; + } if (!match && script->description && weechat_strcasestr (script->description, words[i])) + { match = 1; + } if (!match) { diff --git a/src/plugins/script/script-repo.h b/src/plugins/script/script-repo.h index 6d6f05f72..8d14b0300 100644 --- a/src/plugins/script/script-repo.h +++ b/src/plugins/script/script-repo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c index 75c4744bd..f5dfe4294 100644 --- a/src/plugins/script/script.c +++ b/src/plugins/script/script.c @@ -1,7 +1,7 @@ /* * script.c - scripts manager for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/script/script.h b/src/plugins/script/script.h index 0c93a7863..0fd7eb9e7 100644 --- a/src/plugins/script/script.h +++ b/src/plugins/script/script.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/tcl/CMakeLists.txt b/src/plugins/tcl/CMakeLists.txt index ed10bad5b..10a89995d 100644 --- a/src/plugins/tcl/CMakeLists.txt +++ b/src/plugins/tcl/CMakeLists.txt @@ -1,7 +1,7 @@ # # Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> # Copyright (C) 2008 Julien Louis <ptitlouis@sysif.net> -# Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/tcl/Makefile.am b/src/plugins/tcl/Makefile.am index 479e23b8b..344959de3 100644 --- a/src/plugins/tcl/Makefile.am +++ b/src/plugins/tcl/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> -# Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index d75436878..8930927e5 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -3,7 +3,7 @@ * * Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> * Copyright (C) 2008 Julien Louis <ptitlouis@sysif.net> - * Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> * Copyright (C) 2012 Simon Arlott * * This file is part of WeeChat, the extensible chat client. diff --git a/src/plugins/tcl/weechat-tcl-api.h b/src/plugins/tcl/weechat-tcl-api.h index 22675d4b2..5fd7d7ab4 100644 --- a/src/plugins/tcl/weechat-tcl-api.h +++ b/src/plugins/tcl/weechat-tcl-api.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> - * Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index e2c32187c..eed63715a 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -2,7 +2,7 @@ * weechat-tcl.c - tcl plugin for WeeChat * * Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> - * Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/tcl/weechat-tcl.h b/src/plugins/tcl/weechat-tcl.h index 3bbf6580a..b2d59277b 100644 --- a/src/plugins/tcl/weechat-tcl.h +++ b/src/plugins/tcl/weechat-tcl.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2010 Dmitry Kobylin <fnfal@academ.tsc.ru> - * Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2008-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/CMakeLists.txt b/src/plugins/trigger/CMakeLists.txt index c98ecfb56..c43eb4721 100644 --- a/src/plugins/trigger/CMakeLists.txt +++ b/src/plugins/trigger/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/trigger/Makefile.am b/src/plugins/trigger/Makefile.am index d612840cb..7a08e8173 100644 --- a/src/plugins/trigger/Makefile.am +++ b/src/plugins/trigger/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c index c8aea8af0..7fd28e9f4 100644 --- a/src/plugins/trigger/trigger-buffer.c +++ b/src/plugins/trigger/trigger-buffer.c @@ -1,7 +1,7 @@ /* * trigger-buffer.c - debug buffer for triggers * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-buffer.h b/src/plugins/trigger/trigger-buffer.h index 1b30c7951..d61a9144a 100644 --- a/src/plugins/trigger/trigger-buffer.h +++ b/src/plugins/trigger/trigger-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -22,7 +22,7 @@ #define TRIGGER_BUFFER_NAME "monitor" -struct t_gui_buffer *trigger_buffer; +extern struct t_gui_buffer *trigger_buffer; extern void trigger_buffer_set_callbacks (); extern void trigger_buffer_open (const char *filter, int switch_to_buffer); diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index cd89f6a2c..78b3636e8 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -1,7 +1,7 @@ /* * trigger-callback.c - callbacks for triggers * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h index e0b8b0663..9e411d763 100644 --- a/src/plugins/trigger/trigger-callback.h +++ b/src/plugins/trigger/trigger-callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 9faa77507..602b82f5b 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -1,7 +1,7 @@ /* * trigger-command.c - trigger command * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -405,8 +405,9 @@ trigger_command_rename (struct t_trigger *trigger, const char *new_name) if (!trigger_name_valid (name2)) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid name for trigger"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME); + _("%s%s: invalid trigger name: \"%s\""), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + name2); goto end; } /* check that no trigger already exists with the new name */ @@ -496,15 +497,16 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, if (!trigger_name_valid (sargv[0])) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid name for trigger"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME); + _("%s%s: invalid trigger name: \"%s\""), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + sargv[0]); goto end; } type = trigger_search_hook_type (sargv[1]); if (type < 0) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid hook type \"%s\""), + _("%s%s: invalid hook type: \"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, sargv[1]); goto end; @@ -548,7 +550,7 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, && (trigger_search_return_code (sargv[6]) < 0)) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid return code \"%s\""), + _("%s%s: invalid return code: \"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, sargv[6]); goto end; @@ -622,7 +624,7 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, if (type < 0) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid hook type \"%s\""), + _("%s%s: invalid hook type: \"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, argv[2]); goto end; @@ -783,8 +785,9 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, if (!trigger_name_valid (argv[3])) { weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid name for trigger"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME); + _("%s%s: invalid trigger name: \"%s\""), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + argv[3]); goto end; } /* check that no trigger already exists with the new name */ diff --git a/src/plugins/trigger/trigger-command.h b/src/plugins/trigger/trigger-command.h index b9720c5d3..88e080518 100644 --- a/src/plugins/trigger/trigger-command.h +++ b/src/plugins/trigger/trigger-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-completion.c b/src/plugins/trigger/trigger-completion.c index 1fede9bfc..c0f39dba0 100644 --- a/src/plugins/trigger/trigger-completion.c +++ b/src/plugins/trigger/trigger-completion.c @@ -1,7 +1,7 @@ /* * trigger-completion.c - completion for trigger commands * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-completion.h b/src/plugins/trigger/trigger-completion.h index cbad0a58e..7c72ecbe7 100644 --- a/src/plugins/trigger/trigger-completion.h +++ b/src/plugins/trigger/trigger-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c index e4d2a5827..9db2e797a 100644 --- a/src/plugins/trigger/trigger-config.c +++ b/src/plugins/trigger/trigger-config.c @@ -1,7 +1,7 @@ /* * trigger-config.c - trigger configuration options (file trigger.conf) * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger-config.h b/src/plugins/trigger/trigger-config.h index 8933a00cc..f934b9ddd 100644 --- a/src/plugins/trigger/trigger-config.h +++ b/src/plugins/trigger/trigger-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index c0e435625..0c4f121d0 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -1,7 +1,7 @@ /* * trigger.c - trigger plugin for WeeChat * - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -848,7 +848,7 @@ trigger_new_with_options (const char *name, struct t_config_option **options) &new_trigger->regex) < 0) { weechat_printf (NULL, - _("%s%s: invalid regular expression in trigger " + _("%s%s: invalid regular expression in trigger: " "\"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, name); diff --git a/src/plugins/trigger/trigger.h b/src/plugins/trigger/trigger.h index 990c02f92..fdf3b83c3 100644 --- a/src/plugins/trigger/trigger.h +++ b/src/plugins/trigger/trigger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2014-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 801ab78e9..0b8c24e8b 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -1,7 +1,7 @@ /* * weechat-plugin.h - header to compile WeeChat plugins * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/CMakeLists.txt b/src/plugins/xfer/CMakeLists.txt index 54412a8c1..9fb1ce651 100644 --- a/src/plugins/xfer/CMakeLists.txt +++ b/src/plugins/xfer/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/xfer/Makefile.am b/src/plugins/xfer/Makefile.am index faa6a1384..bb4fecd22 100644 --- a/src/plugins/xfer/Makefile.am +++ b/src/plugins/xfer/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> +# Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> # # This file is part of WeeChat, the extensible chat client. # diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c index 48272f77f..c6840a44a 100644 --- a/src/plugins/xfer/xfer-buffer.c +++ b/src/plugins/xfer/xfer-buffer.c @@ -1,7 +1,7 @@ /* * xfer-buffer.c - display xfer list on xfer buffer * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-buffer.h b/src/plugins/xfer/xfer-buffer.h index b1cc5f3df..a855f0939 100644 --- a/src/plugins/xfer/xfer-buffer.h +++ b/src/plugins/xfer/xfer-buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c index 94af315b1..5ac687da0 100644 --- a/src/plugins/xfer/xfer-chat.c +++ b/src/plugins/xfer/xfer-chat.c @@ -1,7 +1,7 @@ /* * xfer-chat.c - chat with direct connection to remote host * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-chat.h b/src/plugins/xfer/xfer-chat.h index bea5ca581..f2ecca818 100644 --- a/src/plugins/xfer/xfer-chat.h +++ b/src/plugins/xfer/xfer-chat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c index ff5f18f01..21790fa09 100644 --- a/src/plugins/xfer/xfer-command.c +++ b/src/plugins/xfer/xfer-command.c @@ -1,7 +1,7 @@ /* * xfer-command.c - xfer command * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-command.h b/src/plugins/xfer/xfer-command.h index 81c3173ed..1b9e79994 100644 --- a/src/plugins/xfer/xfer-command.h +++ b/src/plugins/xfer/xfer-command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-completion.c b/src/plugins/xfer/xfer-completion.c index f1a0e3744..a65e34aeb 100644 --- a/src/plugins/xfer/xfer-completion.c +++ b/src/plugins/xfer/xfer-completion.c @@ -1,7 +1,7 @@ /* * xfer-completion.c - nick completion for xfer chats * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-completion.h b/src/plugins/xfer/xfer-completion.h index 32aece32c..88e06d324 100644 --- a/src/plugins/xfer/xfer-completion.h +++ b/src/plugins/xfer/xfer-completion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c index e2aba74a6..e6d374a30 100644 --- a/src/plugins/xfer/xfer-config.c +++ b/src/plugins/xfer/xfer-config.c @@ -1,7 +1,7 @@ /* * xfer-config.c - xfer configuration options (file xfer.conf) * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-config.h b/src/plugins/xfer/xfer-config.h index 1996fc89c..500f2322e 100644 --- a/src/plugins/xfer/xfer-config.h +++ b/src/plugins/xfer/xfer-config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * @@ -42,9 +42,9 @@ extern struct t_config_option *xfer_config_network_port_range; extern struct t_config_option *xfer_config_network_speed_limit; extern struct t_config_option *xfer_config_network_timeout; -struct t_config_option *xfer_config_file_auto_accept_chats; -struct t_config_option *xfer_config_file_auto_accept_files; -struct t_config_option *xfer_config_file_auto_accept_nicks; +extern struct t_config_option *xfer_config_file_auto_accept_chats; +extern struct t_config_option *xfer_config_file_auto_accept_files; +extern struct t_config_option *xfer_config_file_auto_accept_nicks; extern struct t_config_option *xfer_config_file_auto_rename; extern struct t_config_option *xfer_config_file_auto_resume; extern struct t_config_option *xfer_config_file_auto_check_crc32; diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c index 850585311..4ea5e43bf 100644 --- a/src/plugins/xfer/xfer-dcc.c +++ b/src/plugins/xfer/xfer-dcc.c @@ -1,7 +1,7 @@ /* * xfer-dcc.c - file transfer via DCC protocol * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-dcc.h b/src/plugins/xfer/xfer-dcc.h index c74a6fddc..1a1ab598c 100644 --- a/src/plugins/xfer/xfer-dcc.h +++ b/src/plugins/xfer/xfer-dcc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c index 65f2cd42c..83b07ec09 100644 --- a/src/plugins/xfer/xfer-file.c +++ b/src/plugins/xfer/xfer-file.c @@ -1,7 +1,7 @@ /* * xfer-file.c - file functions for xfer plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-file.h b/src/plugins/xfer/xfer-file.h index 84ab7012a..65e52e8c4 100644 --- a/src/plugins/xfer/xfer-file.h +++ b/src/plugins/xfer/xfer-file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-info.c b/src/plugins/xfer/xfer-info.c index 98719607a..d4a5b5c69 100644 --- a/src/plugins/xfer/xfer-info.c +++ b/src/plugins/xfer/xfer-info.c @@ -1,7 +1,7 @@ /* * xfer-info.c - info and infolist hooks for xfer plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-info.h b/src/plugins/xfer/xfer-info.h index ed23010db..7f20b9c6b 100644 --- a/src/plugins/xfer/xfer-info.h +++ b/src/plugins/xfer/xfer-info.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c index 9200298a1..d536b4fb4 100644 --- a/src/plugins/xfer/xfer-network.c +++ b/src/plugins/xfer/xfer-network.c @@ -1,7 +1,7 @@ /* * xfer-network.c - network functions for xfer plugin * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-network.h b/src/plugins/xfer/xfer-network.h index cacf10619..67b41a56a 100644 --- a/src/plugins/xfer/xfer-network.h +++ b/src/plugins/xfer/xfer-network.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-upgrade.c b/src/plugins/xfer/xfer-upgrade.c index 52f154c77..65b3bbcab 100644 --- a/src/plugins/xfer/xfer-upgrade.c +++ b/src/plugins/xfer/xfer-upgrade.c @@ -1,7 +1,7 @@ /* * xfer-upgrade.c - save/restore xfer plugin data when upgrading WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer-upgrade.h b/src/plugins/xfer/xfer-upgrade.h index 9c2b290fd..a44563523 100644 --- a/src/plugins/xfer/xfer-upgrade.h +++ b/src/plugins/xfer/xfer-upgrade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 84d43aade..5af0fc7cf 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1,7 +1,7 @@ /* * xfer.c - file transfer and direct chat plugin for WeeChat * - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * diff --git a/src/plugins/xfer/xfer.h b/src/plugins/xfer/xfer.h index 0638151dc..f099abbe2 100644 --- a/src/plugins/xfer/xfer.h +++ b/src/plugins/xfer/xfer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org> + * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of WeeChat, the extensible chat client. * |