diff options
Diffstat (limited to 'src')
34 files changed, 924 insertions, 803 deletions
diff --git a/src/core/wee-backtrace.c b/src/core/wee-backtrace.c index c5ea521a8..8441d3155 100644 --- a/src/core/wee-backtrace.c +++ b/src/core/wee-backtrace.c @@ -56,7 +56,7 @@ weechat_backtrace_printf (const char *message, ...) weechat_va_format (message); if (vbuffer) { - string_iconv_fprintf (stderr, "%s\n", vbuffer); + string_fprintf (stderr, "%s\n", vbuffer); log_printf ("%s", vbuffer); free (vbuffer); } diff --git a/src/core/wee-command.c b/src/core/wee-command.c index ac6bd6ce6..d0bd4d982 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -239,8 +239,9 @@ COMMAND_CALLBACK(bar) if (!str_type) { gui_chat_printf (NULL, - _("%sNot enough memory"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + _("%sNot enough memory (%s)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "/bar"); return WEECHAT_RC_OK; } type = gui_bar_search_type (str_type); @@ -5081,8 +5082,9 @@ COMMAND_CALLBACK(repeat) if (!repeat_args) { gui_chat_printf (NULL, - _("%sNot enough memory"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + _("%sNot enough memory (%s)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "/repeat"); return WEECHAT_RC_OK; } repeat_args[0] = strdup (buffer->full_name); @@ -6040,8 +6042,9 @@ COMMAND_CALLBACK(upgrade) if (!ptr_binary && !quit) { gui_chat_printf (NULL, - _("%sNot enough memory"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + _("%sNot enough memory (%s)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "/upgrade"); return WEECHAT_RC_OK; } @@ -6096,12 +6099,12 @@ COMMAND_CALLBACK(upgrade) execvp (exec_args[0], exec_args); /* this code should not be reached if execvp is OK */ - string_iconv_fprintf (stderr, "\n\n*****\n"); - string_iconv_fprintf (stderr, - _("***** Error: exec failed (program: \"%s\"), " - "exiting WeeChat"), - exec_args[0]); - string_iconv_fprintf (stderr, "\n*****\n\n"); + string_fprintf (stderr, "\n\n*****\n"); + string_fprintf (stderr, + _("***** Error: exec failed (program: \"%s\"), " + "exiting WeeChat"), + exec_args[0]); + string_fprintf (stderr, "\n*****\n\n"); free (exec_args[0]); free (exec_args[3]); @@ -6400,8 +6403,9 @@ COMMAND_CALLBACK(wait) if (!timer_args) { gui_chat_printf (NULL, - _("%sNot enough memory"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + _("%sNot enough memory (%s)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "/wait"); return WEECHAT_RC_OK; } timer_args[0] = strdup (buffer->full_name); @@ -7730,6 +7734,9 @@ command_init () "Without argument, this command displays secured data in a new " "buffer.\n" "\n" + "Keys on secure buffer:\n" + " alt+v toggle values\n" + "\n" "When a passphrase is used (data encrypted), it is asked by WeeChat " "on startup.\n" "It is possible to set environment variable \"WEECHAT_PASSPHRASE\" " diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index bcea8d2ac..7a6f3591f 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -2301,35 +2301,35 @@ config_file_write_option (struct t_config_file *config_file, switch (option->type) { case CONFIG_OPTION_TYPE_BOOLEAN: - rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n", - config_file_option_escape (option->name), - option->name, - (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); + rc = string_fprintf (config_file->file, "%s%s = %s\n", + config_file_option_escape (option->name), + option->name, + (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off"); break; case CONFIG_OPTION_TYPE_INTEGER: if (option->string_values) - rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n", - config_file_option_escape (option->name), - option->name, - option->string_values[CONFIG_INTEGER(option)]); + rc = string_fprintf (config_file->file, "%s%s = %s\n", + config_file_option_escape (option->name), + option->name, + option->string_values[CONFIG_INTEGER(option)]); else - rc = string_iconv_fprintf (config_file->file, "%s%s = %d\n", - config_file_option_escape (option->name), - option->name, - CONFIG_INTEGER(option)); + rc = string_fprintf (config_file->file, "%s%s = %d\n", + config_file_option_escape (option->name), + option->name, + CONFIG_INTEGER(option)); break; case CONFIG_OPTION_TYPE_STRING: - rc = string_iconv_fprintf (config_file->file, "%s%s = \"%s\"\n", - config_file_option_escape (option->name), - option->name, - (char *)option->value); + rc = string_fprintf (config_file->file, "%s%s = \"%s\"\n", + config_file_option_escape (option->name), + option->name, + (char *)option->value); break; case CONFIG_OPTION_TYPE_COLOR: - rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n", - config_file_option_escape (option->name), - option->name, - gui_color_get_name (CONFIG_COLOR(option))); + rc = string_fprintf (config_file->file, "%s%s = %s\n", + config_file_option_escape (option->name), + option->name, + gui_color_get_name (CONFIG_COLOR(option))); break; case CONFIG_NUM_OPTION_TYPES: break; @@ -2337,9 +2337,9 @@ config_file_write_option (struct t_config_file *config_file, } else { - rc = string_iconv_fprintf (config_file->file, "%s%s\n", - config_file_option_escape (option->name), - option->name); + rc = string_fprintf (config_file->file, "%s%s\n", + config_file_option_escape (option->name), + option->name); } return rc; @@ -2371,9 +2371,9 @@ config_file_write_line (struct t_config_file *config_file, { if (vbuffer[0]) { - rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n", - config_file_option_escape (option_name), - option_name, vbuffer); + rc = string_fprintf (config_file->file, "%s%s = %s\n", + config_file_option_escape (option_name), + option_name, vbuffer); free (vbuffer); return rc; } @@ -2381,8 +2381,8 @@ config_file_write_line (struct t_config_file *config_file, } } - return (string_iconv_fprintf (config_file->file, "\n[%s]\n", - option_name)); + return (string_fprintf (config_file->file, "\n[%s]\n", + option_name)); } /* @@ -2459,12 +2459,12 @@ config_file_write_internal (struct t_config_file *config_file, } /* write header with name of config file and WeeChat version */ - if (!string_iconv_fprintf (config_file->file, "#\n")) + if (!string_fprintf (config_file->file, "#\n")) goto error; - if (!string_iconv_fprintf (config_file->file, - "# %s -- %s\n#\n", - version_get_name (), - config_file->filename)) + if (!string_fprintf (config_file->file, + "# %s -- %s\n#\n", + version_get_name (), + config_file->filename)) goto error; /* write all sections */ @@ -2493,8 +2493,8 @@ config_file_write_internal (struct t_config_file *config_file, else { /* write all options for section */ - if (!string_iconv_fprintf (config_file->file, - "\n[%s]\n", ptr_section->name)) + if (!string_fprintf (config_file->file, + "\n[%s]\n", ptr_section->name)) goto error; for (ptr_option = ptr_section->options; ptr_option; ptr_option = ptr_option->next_option) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 44a38bf7e..4d86cda97 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -2845,7 +2845,7 @@ config_weechat_init_options () weechat_config_file, ptr_section, "hotlist_short_names", "boolean", N_("if set, uses short names to display buffer names in hotlist (start " - "after first '.' in name)"), + "after first \".\" in name)"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, @@ -3462,7 +3462,7 @@ config_weechat_init_options () config_color_bar_more = config_file_new_option ( weechat_config_file, ptr_section, "bar_more", "color", - N_("text color for '+' when scrolling bars"), + N_("text color for \"+\" when scrolling bars"), NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, NULL, &config_change_color, NULL, NULL, @@ -3700,7 +3700,7 @@ config_weechat_init_options () config_color_chat_prefix_more = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_more", "color", - N_("text color for '+' when prefix is too long"), + N_("text color for \"+\" when prefix is too long"), NULL, GUI_COLOR_CHAT_PREFIX_MORE, 0, "lightmagenta", NULL, 0, NULL, NULL, NULL, &config_change_color, NULL, NULL, @@ -4027,7 +4027,7 @@ config_weechat_init_options () N_("if enabled, the commands inside command line are completed (the " "command at beginning of line has higher priority and is used " "first); note: when this option is enabled, there is no more " - "automatic completion of paths beginning with '/' (outside " + "automatic completion of paths beginning with \"/\" (outside " "commands arguments)"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c index 1aaa436a7..d6ab2118b 100644 --- a/src/core/wee-debug.c +++ b/src/core/wee-debug.c @@ -156,18 +156,17 @@ debug_sigsegv () unhook_all (); gui_main_end (0); - string_iconv_fprintf ( - stderr, - "\n" - "*** Very bad! WeeChat is crashing (SIGSEGV received)\n"); + string_fprintf (stderr, + "\n*** Very bad! WeeChat is crashing (SIGSEGV received)" + "\n"); if (!log_crash_rename ()) { - string_iconv_fprintf ( - stderr, - "*** Full crash dump was saved to %s/weechat.log file.\n", - weechat_home); + string_fprintf (stderr, + "*** Full crash dump was saved to %s/weechat.log file." + "\n", + weechat_home); } - string_iconv_fprintf ( + string_fprintf ( stderr, "***\n" "*** Please help WeeChat developers to fix this bug:\n" diff --git a/src/core/wee-log.c b/src/core/wee-log.c index 4edf3e910..397ae911c 100644 --- a/src/core/wee-log.c +++ b/src/core/wee-log.c @@ -112,10 +112,10 @@ log_init () { if (!log_open (NULL, "w")) { - 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 the \"--dir\" command line option.\n")); + string_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 the \"--dir\" command line option.\n")); exit (1); } log_printf ("WeeChat %s (%s %s %s)", @@ -159,18 +159,18 @@ log_printf (const char *message, ...) date_tmp = localtime (&seconds); if (date_tmp) { - string_iconv_fprintf (weechat_log_file, - "[%04d-%02d-%02d %02d:%02d:%02d] %s\n", - date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, - date_tmp->tm_mday, date_tmp->tm_hour, - date_tmp->tm_min, date_tmp->tm_sec, - vbuffer); + string_fprintf (weechat_log_file, + "[%04d-%02d-%02d %02d:%02d:%02d] %s\n", + date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, + date_tmp->tm_mday, date_tmp->tm_hour, + date_tmp->tm_min, date_tmp->tm_sec, + vbuffer); } else - string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer); + string_fprintf (weechat_log_file, "%s\n", vbuffer); } else - string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer); + string_fprintf (weechat_log_file, "%s\n", vbuffer); fflush (weechat_log_file); @@ -276,8 +276,8 @@ log_crash_rename () getpid()); if (rename (old_name, new_name) == 0) { - string_iconv_fprintf (stderr, "*** Full crash dump was saved to %s file.\n", - new_name); + string_fprintf (stderr, "*** Full crash dump was saved to %s file.\n", + new_name); log_open (new_name, "a"); free (old_name); free (new_name); diff --git a/src/core/wee-network.c b/src/core/wee-network.c index fd1474236..cb2fa52d2 100644 --- a/src/core/wee-network.c +++ b/src/core/wee-network.c @@ -1609,7 +1609,7 @@ network_connect_child_read_cb (const void *pointer, void *data, int fd) (hook_connect->callback_pointer, hook_connect->callback_data, WEECHAT_HOOK_CONNECT_MEMORY_ERROR, - 0, sock, cb_error, cb_ip_address); + 0, sock, "child_read_cb", NULL); unhook (hook_connect); } @@ -1695,7 +1695,7 @@ network_connect_with_fork (struct t_hook *hook_connect) (hook_connect->callback_pointer, hook_connect->callback_data, WEECHAT_HOOK_CONNECT_MEMORY_ERROR, - 0, -1, NULL, NULL); + 0, -1, "pipe", NULL); unhook (hook_connect); return; } @@ -1710,7 +1710,7 @@ network_connect_with_fork (struct t_hook *hook_connect) (hook_connect->callback_pointer, hook_connect->callback_data, WEECHAT_HOOK_CONNECT_MEMORY_ERROR, - 0, -1, NULL, NULL); + 0, -1, "socketpair", NULL); unhook (hook_connect); return; } @@ -1732,7 +1732,7 @@ network_connect_with_fork (struct t_hook *hook_connect) (hook_connect->callback_pointer, hook_connect->callback_data, WEECHAT_HOOK_CONNECT_MEMORY_ERROR, - 0, -1, NULL, NULL); + 0, -1, "fork", NULL); unhook (hook_connect); return; /* child process */ diff --git a/src/core/wee-string.c b/src/core/wee-string.c index af50fb2fd..1481e6361 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -2385,7 +2385,7 @@ string_iconv_from_internal (const char *charset, const char *string) */ int -string_iconv_fprintf (FILE *file, const char *data, ...) +string_fprintf (FILE *file, const char *data, ...) { char *buf2; int rc, num_written; diff --git a/src/core/wee-string.h b/src/core/wee-string.h index f760b98d0..5db751df2 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -85,7 +85,7 @@ extern char *string_iconv (int from_utf8, const char *from_code, extern char *string_iconv_to_internal (const char *charset, const char *string); extern char *string_iconv_from_internal (const char *charset, const char *string); -extern int string_iconv_fprintf (FILE *file, const char *data, ...); +extern int string_fprintf (FILE *file, const char *data, ...); extern char *string_format_size (unsigned long long size); extern void string_encode_base16 (const char *from, int length, char *to); extern int string_decode_base16 (const char *from, char *to); diff --git a/src/core/weechat.c b/src/core/weechat.c index e011c2e94..f0b7d44e5 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -110,8 +110,8 @@ char *weechat_startup_commands = NULL; /* startup commands (-r flag) */ void weechat_display_copyright () { - string_iconv_fprintf (stdout, "\n"); - string_iconv_fprintf ( + string_fprintf (stdout, "\n"); + string_fprintf ( stdout, /* TRANSLATORS: "%s %s" after "compiled on" is date and time */ _("WeeChat %s Copyright %s, compiled on %s %s\n" @@ -122,7 +122,7 @@ weechat_display_copyright () version_get_compilation_date (), version_get_compilation_time (), WEECHAT_WEBSITE); - string_iconv_fprintf (stdout, "\n"); + string_fprintf (stdout, "\n"); } /* @@ -133,12 +133,12 @@ void weechat_display_usage (char *exec_name) { weechat_display_copyright (); - string_iconv_fprintf (stdout, "\n"); - string_iconv_fprintf (stdout, - _("Usage: %s [option...] [plugin:option...]\n"), - exec_name, exec_name); - string_iconv_fprintf (stdout, "\n"); - string_iconv_fprintf ( + string_fprintf (stdout, "\n"); + string_fprintf (stdout, + _("Usage: %s [option...] [plugin:option...]\n"), + exec_name, exec_name); + string_fprintf (stdout, "\n"); + string_fprintf ( stdout, _(" -a, --no-connect disable auto-connect to servers at " "startup\n" @@ -158,7 +158,7 @@ weechat_display_usage (char *exec_name) "(see /help upgrade in WeeChat)\n" " -v, --version display WeeChat version\n" " plugin:option option for plugin (see man weechat)\n")); - string_iconv_fprintf(stdout, "\n"); + string_fprintf(stdout, "\n"); } /* @@ -198,10 +198,9 @@ weechat_parse_args (int argc, char *argv[]) } else { - string_iconv_fprintf (stderr, - _("Error: missing argument for \"%s\" " - "option\n"), - argv[i]); + string_fprintf (stderr, + _("Error: missing argument for \"%s\" option\n"), + argv[i]); weechat_shutdown (EXIT_FAILURE, 0); } } @@ -215,8 +214,8 @@ weechat_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--license") == 0)) { weechat_display_copyright (); - string_iconv_fprintf (stdout, "\n"); - string_iconv_fprintf (stdout, "%s%s", WEECHAT_LICENSE_TEXT); + string_fprintf (stdout, "\n"); + string_fprintf (stdout, "%s%s", WEECHAT_LICENSE_TEXT); weechat_shutdown (EXIT_SUCCESS, 0); } else if (strcmp (argv[i], "--no-dlclose") == 0) @@ -266,10 +265,9 @@ weechat_parse_args (int argc, char *argv[]) } else { - string_iconv_fprintf (stderr, - _("Error: missing argument for \"%s\" " - "option\n"), - argv[i]); + string_fprintf (stderr, + _("Error: missing argument for \"%s\" option\n"), + argv[i]); weechat_shutdown (EXIT_FAILURE, 0); } } @@ -280,7 +278,7 @@ weechat_parse_args (int argc, char *argv[]) else if ((strcmp (argv[i], "-v") == 0) || (strcmp (argv[i], "--version") == 0)) { - string_iconv_fprintf (stdout, version_get_version ()); + string_fprintf (stdout, version_get_version ()); fprintf (stdout, "\n"); weechat_shutdown (EXIT_SUCCESS, 0); } @@ -303,8 +301,7 @@ weechat_set_home_path (char *home_path) ptr_home = getenv ("HOME"); if (!ptr_home) { - string_iconv_fprintf (stderr, - _("Error: unable to get HOME directory\n")); + string_fprintf (stderr, _("Error: unable to get HOME directory\n")); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; @@ -324,9 +321,8 @@ weechat_set_home_path (char *home_path) if (!weechat_home) { - string_iconv_fprintf (stderr, - _("Error: not enough memory for home " - "directory\n")); + string_fprintf (stderr, + _("Error: not enough memory for home directory\n")); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; @@ -363,9 +359,9 @@ weechat_create_home_dir () config_weechat_home = WEECHAT_HOME; if (!config_weechat_home[0]) { - string_iconv_fprintf (stderr, - _("Error: WEECHAT_HOME is undefined, check " - "build options\n")); + string_fprintf (stderr, + _("Error: WEECHAT_HOME is undefined, check build " + "options\n")); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; @@ -378,9 +374,9 @@ weechat_create_home_dir () { if (!S_ISDIR (statinfo.st_mode)) { - string_iconv_fprintf (stderr, - _("Error: home (%s) is not a directory\n"), - weechat_home); + string_fprintf (stderr, + _("Error: home (%s) is not a directory\n"), + weechat_home); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; @@ -390,9 +386,9 @@ weechat_create_home_dir () /* create home directory; error is fatal */ if (!util_mkdir (weechat_home, 0755)) { - string_iconv_fprintf (stderr, - _("Error: cannot create directory \"%s\"\n"), - weechat_home); + string_fprintf (stderr, + _("Error: cannot create directory \"%s\"\n"), + weechat_home); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index d987c4c49..1e912387f 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -927,7 +927,7 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...) gui_buffer_ask_chat_refresh (buffer, 1); } else - string_iconv_fprintf (stdout, "%s\n", vbuffer); + string_fprintf (stdout, "%s\n", vbuffer); } free (vbuffer); @@ -959,7 +959,7 @@ gui_chat_print_lines_waiting_buffer (FILE *f) if (!f && gui_init_ok) gui_chat_printf (NULL, "%s", lines[i]); else - string_iconv_fprintf ((f) ? f : stdout, "%s\n", lines[i]); + string_fprintf ((f) ? f : stdout, "%s\n", lines[i]); } string_free_split (lines); } diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 5589fd2b8..dd686c41f 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -333,10 +333,11 @@ exec_display_line (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer, { snprintf (str_number, sizeof (str_number), "%d\t", exec_cmd->output_line_nb); - weechat_printf_tags (buffer, str_tags, - "%s%s", - (exec_cmd->line_numbers) ? str_number : " \t", - line_color); + weechat_printf_date_tags ( + buffer, 0, str_tags, + "%s%s", + (exec_cmd->line_numbers) ? str_number : " \t", + line_color); } } } @@ -477,11 +478,12 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code) } else { - weechat_printf_tags (ptr_buffer, "exec_rc", - _("%s: end of command %d (\"%s\"), " - "return code: %d"), - EXEC_PLUGIN_NAME, exec_cmd->number, - exec_cmd->command, return_code); + weechat_printf_date_tags ( + ptr_buffer, 0, "exec_rc", + _("%s: end of command %d (\"%s\"), " + "return code: %d"), + EXEC_PLUGIN_NAME, exec_cmd->number, + exec_cmd->command, return_code); } } else @@ -496,11 +498,12 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code) } else { - weechat_printf_tags (ptr_buffer, "exec_rc", - _("%s: unexpected end of command %d " - "(\"%s\")"), - EXEC_PLUGIN_NAME, exec_cmd->number, - exec_cmd->command); + weechat_printf_date_tags ( + ptr_buffer, 0, "exec_rc", + _("%s: unexpected end of command %d " + "(\"%s\")"), + EXEC_PLUGIN_NAME, exec_cmd->number, + exec_cmd->command); } } } diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 20c912360..019c94a0a 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -1337,8 +1337,9 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server, { if (weechat_config_boolean (irc_config_look_display_pv_back)) { - weechat_printf_tags ( + weechat_printf_date_tags ( ptr_channel->buffer, + 0, "irc_nick_back", _("%s%s%s %s(%s%s%s)%s is back on server"), weechat_prefix ("join"), diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 5fa524513..41ce07719 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -640,8 +640,9 @@ irc_command_me_channel_display (struct t_irc_server *server, irc_color_decode (arguments, weechat_config_boolean (irc_config_network_colors_send)) : NULL; ptr_nick = irc_nick_search (server, channel, server->nick); - weechat_printf_tags ( + weechat_printf_date_tags ( channel->buffer, + 0, irc_protocol_tags ("privmsg", "irc_action,notify_none,no_highlight", server->nick, NULL), "%s%s%s%s%s%s%s", @@ -726,16 +727,17 @@ irc_command_display_away (struct t_irc_server *server, const char *string1, if ((ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) || (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)) { - weechat_printf_tags (ptr_channel->buffer, - "away_info", - "%s[%s%s%s %s: %s%s]", - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_NICK_SELF, - server->nick, - IRC_COLOR_RESET, - string1, - string2, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags (ptr_channel->buffer, + 0, + "away_info", + "%s[%s%s%s %s: %s%s]", + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_NICK_SELF, + server->nick, + IRC_COLOR_RESET, + string1, + string2, + IRC_COLOR_CHAT_DELIMITERS); } } } @@ -1467,8 +1469,8 @@ IRC_COMMAND_CALLBACK(ctcp) IRC_COMMAND_CALLBACK(cycle) { - char *channel_name, *pos_args, *buf; - const char *version, *ptr_arg, *msg_part; + char *channel_name, *pos_args, *msg; + const char *ptr_arg; char **channels; int i, num_channels; @@ -1543,24 +1545,24 @@ IRC_COMMAND_CALLBACK(cycle) ptr_channel->cycle = 1; } - msg_part = IRC_SERVER_OPTION_STRING(ptr_server, - IRC_SERVER_OPTION_DEFAULT_MSG_PART); - ptr_arg = (pos_args) ? pos_args : - ((msg_part && msg_part[0]) ? msg_part : NULL); - - if (ptr_arg) + msg = NULL; + ptr_arg = (pos_args) ? + pos_args : IRC_SERVER_OPTION_STRING(ptr_server, + IRC_SERVER_OPTION_MSG_PART); + if (ptr_arg && ptr_arg[0]) { - version = weechat_info_get ("version", ""); - buf = weechat_string_replace (ptr_arg, "%v", (version) ? version : ""); + msg = irc_server_get_default_msg (ptr_arg, ptr_server, channel_name); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PART %s :%s", channel_name, - (buf) ? buf : ptr_arg); - if (buf) - free (buf); + "PART %s :%s", channel_name, msg); } else + { irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PART %s", channel_name); + } + + if (msg) + free (msg); return WEECHAT_RC_OK; } @@ -1815,29 +1817,28 @@ IRC_COMMAND_CALLBACK(die) void irc_command_quit_server (struct t_irc_server *server, const char *arguments) { - const char *ptr_arg, *version, *msg_quit; - char *buf; + const char *ptr_arg; + char *msg; if (!server || !server->is_connected) return; - msg_quit = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_DEFAULT_MSG_QUIT); - ptr_arg = (arguments) ? arguments : - ((msg_quit && msg_quit[0]) ? msg_quit : NULL); - - if (ptr_arg) + msg = NULL; + ptr_arg = (arguments) ? + arguments : IRC_SERVER_OPTION_STRING(server, + IRC_SERVER_OPTION_MSG_QUIT); + if (ptr_arg && ptr_arg[0]) { - version = weechat_info_get ("version", ""); - buf = weechat_string_replace (ptr_arg, "%v", - (version) ? version : ""); - irc_server_sendf (server, 0, NULL, "QUIT :%s", - (buf) ? buf : ptr_arg); - if (buf) - free (buf); + msg = irc_server_get_default_msg (ptr_arg, server, NULL); + irc_server_sendf (server, 0, NULL, "QUIT :%s", msg); } else + { irc_server_sendf (server, 0, NULL, "QUIT"); + } + + if (msg) + free (msg); } /* @@ -2537,23 +2538,19 @@ irc_command_kick_channel (struct t_irc_server *server, const char *channel_name, const char *nick_name, const char *message) { - const char *msg_kick; - char *msg_vars_replaced; + const char *ptr_msg; + char *msg; - msg_kick = (message && message[0]) ? + msg = NULL; + ptr_msg = (message && message[0]) ? message : IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_DEFAULT_MSG_KICK); - if (msg_kick && msg_kick[0]) + IRC_SERVER_OPTION_MSG_KICK); + if (ptr_msg && ptr_msg[0]) { - msg_vars_replaced = irc_message_replace_vars (server, - channel_name, - msg_kick); + msg = irc_server_get_default_msg (ptr_msg, server, channel_name); irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "KICK %s %s :%s", - channel_name, nick_name, - (msg_vars_replaced) ? msg_vars_replaced : msg_kick); - if (msg_vars_replaced) - free (msg_vars_replaced); + channel_name, nick_name, msg); } else { @@ -2561,6 +2558,9 @@ irc_command_kick_channel (struct t_irc_server *server, "KICK %s %s", channel_name, nick_name); } + + if (msg) + free (msg); } /* @@ -3163,8 +3163,9 @@ IRC_COMMAND_CALLBACK(msg) * message to channel ops/voiced * (to "@#channel" or "+#channel") */ - weechat_printf_tags ( + weechat_printf_date_tags ( ptr_channel2->buffer, + 0, "notify_none,no_highlight", "%s%s%s -> %s%s%s: %s", weechat_prefix ("network"), @@ -3251,8 +3252,9 @@ IRC_COMMAND_CALLBACK(msg) } else { - weechat_printf_tags ( + weechat_printf_date_tags ( ptr_server->buffer, + 0, irc_protocol_tags ( "privmsg", "notify_none,no_highlight", ptr_server->nick, NULL), @@ -3430,10 +3432,11 @@ IRC_COMMAND_CALLBACK(notice) string = irc_color_decode ( str_args, weechat_config_boolean (irc_config_network_colors_send)); - weechat_printf_tags ( + weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( ptr_server, argv[arg_target], "notice", NULL, (ptr_channel) ? ptr_channel->buffer : NULL), + 0, "notify_none,no_highlight", "%s%s%s%s -> %s%s%s: %s", weechat_prefix ("network"), @@ -3710,30 +3713,27 @@ void irc_command_part_channel (struct t_irc_server *server, const char *channel_name, const char *part_message) { - const char *ptr_arg, *version, *msg_part; - char *buf; + const char *ptr_arg; + char *msg; - msg_part = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_DEFAULT_MSG_PART); - ptr_arg = (part_message) ? part_message : - ((msg_part && msg_part[0]) ? msg_part : NULL); - - if (ptr_arg) + msg = NULL; + ptr_arg = (part_message) ? + part_message : IRC_SERVER_OPTION_STRING(server, + IRC_SERVER_OPTION_MSG_PART); + if (ptr_arg && ptr_arg[0]) { - version = weechat_info_get ("version", ""); - buf = weechat_string_replace (ptr_arg, "%v", (version) ? version : ""); + msg = irc_server_get_default_msg (ptr_arg, server, channel_name); irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PART %s :%s", - channel_name, - (buf) ? buf : ptr_arg); - if (buf) - free (buf); + "PART %s :%s", channel_name, msg); } else { irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PART %s", channel_name); } + + if (msg) + free (msg); } /* @@ -4820,30 +4820,30 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) weechat_printf (NULL, " away_check_max_nicks : %s%d", IRC_COLOR_CHAT_VALUE, weechat_config_integer (server->options[IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS])); - /* default_msg_kick */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_KICK])) - weechat_printf (NULL, " default_msg_kick . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_KICK)); + /* msg_kick */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_MSG_KICK])) + weechat_printf (NULL, " msg_kick . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_KICK)); else - weechat_printf (NULL, " default_msg_kick . . : %s'%s'", + weechat_printf (NULL, " msg_kick . . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_KICK])); - /* default_msg_part */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_PART])) - weechat_printf (NULL, " default_msg_part . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_PART)); + weechat_config_string (server->options[IRC_SERVER_OPTION_MSG_KICK])); + /* msg_part */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_MSG_PART])) + weechat_printf (NULL, " msg_part . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_PART)); else - weechat_printf (NULL, " default_msg_part . . : %s'%s'", + weechat_printf (NULL, " msg_part . . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_PART])); - /* default_msg_quit */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_QUIT])) - weechat_printf (NULL, " default_msg_quit . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_QUIT)); + weechat_config_string (server->options[IRC_SERVER_OPTION_MSG_PART])); + /* msg_quit */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_MSG_QUIT])) + weechat_printf (NULL, " msg_quit . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_QUIT)); else - weechat_printf (NULL, " default_msg_quit . . : %s'%s'", + weechat_printf (NULL, " msg_quit . . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_DEFAULT_MSG_QUIT])); + weechat_config_string (server->options[IRC_SERVER_OPTION_MSG_QUIT])); /* notify */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_NOTIFY])) weechat_printf (NULL, " notify . . . . . . . : ('%s')", diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index b0140496e..56b2bf21e 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -605,7 +605,7 @@ irc_completion_msg_kick_cb (const void *pointer, void *data, if (ptr_server) { msg_kick = IRC_SERVER_OPTION_STRING(ptr_server, - IRC_SERVER_OPTION_DEFAULT_MSG_KICK); + IRC_SERVER_OPTION_MSG_KICK); if (msg_kick && msg_kick[0]) { weechat_hook_completion_list_add (completion, msg_kick, @@ -638,7 +638,7 @@ irc_completion_msg_part_cb (const void *pointer, void *data, if (ptr_server) { msg_part = IRC_SERVER_OPTION_STRING(ptr_server, - IRC_SERVER_OPTION_DEFAULT_MSG_PART); + IRC_SERVER_OPTION_MSG_PART); if (msg_part && msg_part[0]) { weechat_hook_completion_list_add (completion, msg_part, diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index a488936b0..d4acd7ba3 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -2148,13 +2148,15 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_DEFAULT_MSG_KICK: + case IRC_SERVER_OPTION_MSG_KICK: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("default kick message used by commands \"/kick\" and " - "\"/kickban\" (special variables $nick, $channel and $server " - "are replaced by their value)"), + "\"/kickban\" " + "(note: content is evaluated, see /help eval; special " + "variables ${nick}, ${channel} and ${server} are replaced " + "by their value)"), NULL, 0, 0, default_value, value, null_value_allowed, @@ -2166,12 +2168,15 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_DEFAULT_MSG_PART: + case IRC_SERVER_OPTION_MSG_PART: new_option = weechat_config_new_option ( config_file, section, option_name, "string", - N_("default part message (leaving channel) (\"%v\" will be " - "replaced by WeeChat version in string)"), + N_("default part message (leaving channel) " + "(note: content is evaluated, see /help eval; special " + "variables ${nick}, ${channel} and ${server} are replaced " + "by their value; \"%v\" is replaced by WeeChat version if " + "there is no ${...} in string)"), NULL, 0, 0, default_value, value, null_value_allowed, @@ -2183,12 +2188,15 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_DEFAULT_MSG_QUIT: + case IRC_SERVER_OPTION_MSG_QUIT: new_option = weechat_config_new_option ( config_file, section, option_name, "string", - N_("default quit message (disconnecting from server) (\"%v\" " - "will be replaced by WeeChat version in string)"), + N_("default quit message (disconnecting from server) " + "(note: content is evaluated, see /help eval; special " + "variables ${nick}, ${channel} and ${server} are replaced " + "by their value; \"%v\" is replaced by WeeChat version if " + "there is no ${...} in string)"), NULL, 0, 0, default_value, value, null_value_allowed, diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 081a5414a..5f2aeec95 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -291,10 +291,11 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server, str_args_color = irc_color_decode (str_args, 1); if (!str_args_color) break; - weechat_printf_tags ( + weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, nick, NULL, "ctcp", (channel) ? channel->buffer : NULL), + 0, irc_protocol_tags ( command, "irc_ctcp,irc_ctcp_reply,notify_none,no_highlight", diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index bd6e2c655..bad329b77 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -98,8 +98,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action, ptr_text = (text_decoded) ? text_decoded : ((text2) ? text2 : text); if (action) { - weechat_printf_tags ( + weechat_printf_date_tags ( buffer, + 0, irc_protocol_tags ( "privmsg", str_tags, (ptr_nick) ? ptr_nick->name : ptr_server->nick, @@ -114,8 +115,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action, } else { - weechat_printf_tags ( + weechat_printf_date_tags ( buffer, + 0, irc_protocol_tags ( "privmsg", str_tags, (ptr_nick) ? ptr_nick->name : ptr_server->nick, diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index 3ca5b9e25..c58c668fe 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -672,8 +672,9 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify, const char *host, if (notify->is_on_server == is_on_server) return; - weechat_printf_tags ( + weechat_printf_date_tags ( notify->server->buffer, + 0, irc_notify_get_tags (irc_config_look_notify_tags_ison, (is_on_server) ? "join" : "quit", notify->nick), @@ -719,8 +720,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify, if (!notify->away_message && away_message) { - weechat_printf_tags ( + weechat_printf_date_tags ( notify->server->buffer, + 0, irc_notify_get_tags ( irc_config_look_notify_tags_whois, "away", notify->nick), _("%snotify: %s%s%s is now away: \"%s\""), @@ -733,8 +735,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify, } else if (notify->away_message && !away_message) { - weechat_printf_tags ( + weechat_printf_date_tags ( notify->server->buffer, + 0, irc_notify_get_tags ( irc_config_look_notify_tags_whois, "back", notify->nick), _("%snotify: %s%s%s is back"), @@ -746,8 +749,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify, } else if (notify->away_message && away_message) { - weechat_printf_tags ( + weechat_printf_date_tags ( notify->server->buffer, + 0, irc_notify_get_tags ( irc_config_look_notify_tags_whois, "still_away", notify->nick), _("%snotify: %s%s%s is still away: \"%s\""), diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 7d8ce2edd..0f35155ba 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -75,45 +75,45 @@ char *irc_server_sasl_fail_string[IRC_SERVER_NUM_SASL_FAIL] = { "continue", "reconnect", "disconnect" }; char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] = -{ { "addresses", "" }, - { "proxy", "" }, - { "ipv6", "on" }, - { "ssl", "off" }, - { "ssl_cert", "" }, - { "ssl_priorities", "NORMAL:-VERS-SSL3.0" }, - { "ssl_dhkey_size", "2048" }, - { "ssl_fingerprint", "" }, - { "ssl_verify", "on" }, - { "password", "" }, - { "capabilities", "" }, - { "sasl_mechanism", "plain" }, - { "sasl_username", "" }, - { "sasl_password", "" }, - { "sasl_key", "", }, - { "sasl_timeout", "15" }, - { "sasl_fail", "continue" }, - { "autoconnect", "off" }, - { "autoreconnect", "on" }, - { "autoreconnect_delay", "10" }, - { "nicks", "" }, - { "nicks_alternate", "on" }, - { "username", "" }, - { "realname", "" }, - { "local_hostname", "" }, - { "command", "" }, - { "command_delay", "0" }, - { "autojoin", "" }, - { "autorejoin", "off" }, - { "autorejoin_delay", "30" }, - { "connection_timeout", "60" }, - { "anti_flood_prio_high", "2" }, - { "anti_flood_prio_low", "2" }, - { "away_check", "0" }, - { "away_check_max_nicks", "25" }, - { "default_msg_kick", "" }, - { "default_msg_part", "WeeChat %v" }, - { "default_msg_quit", "WeeChat %v" }, - { "notify", "" }, +{ { "addresses", "" }, + { "proxy", "" }, + { "ipv6", "on" }, + { "ssl", "off" }, + { "ssl_cert", "" }, + { "ssl_priorities", "NORMAL:-VERS-SSL3.0" }, + { "ssl_dhkey_size", "2048" }, + { "ssl_fingerprint", "" }, + { "ssl_verify", "on" }, + { "password", "" }, + { "capabilities", "" }, + { "sasl_mechanism", "plain" }, + { "sasl_username", "" }, + { "sasl_password", "" }, + { "sasl_key", "", }, + { "sasl_timeout", "15" }, + { "sasl_fail", "continue" }, + { "autoconnect", "off" }, + { "autoreconnect", "on" }, + { "autoreconnect_delay", "10" }, + { "nicks", "" }, + { "nicks_alternate", "on" }, + { "username", "" }, + { "realname", "" }, + { "local_hostname", "" }, + { "command", "" }, + { "command_delay", "0" }, + { "autojoin", "" }, + { "autorejoin", "off" }, + { "autorejoin_delay", "30" }, + { "connection_timeout", "60" }, + { "anti_flood_prio_high", "2" }, + { "anti_flood_prio_low", "2" }, + { "away_check", "0" }, + { "away_check_max_nicks", "25" }, + { "msg_kick", "" }, + { "msg_part", "WeeChat ${info:version}" }, + { "msg_quit", "WeeChat ${info:version}" }, + { "notify", "" }, }; char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] = @@ -890,7 +890,7 @@ irc_server_get_prefix_mode_for_char (struct t_irc_server *server, * * For example mode 'o' can return '@'. * - * Returns return ' ' (space) if mode is not found. + * Returns a space if mode is not found. */ char @@ -950,6 +950,55 @@ irc_server_prefix_char_statusmsg (struct t_irc_server *server, } /* + * Gets an evaluated default_msg server option: replaces "%v" by WeeChat + * version if there's no ${...} in string, or just evaluates the string. + * + * Note: result must be freed after use. + */ + +char * +irc_server_get_default_msg (const char *default_msg, + struct t_irc_server *server, + const char *channel_name) +{ + const char *version; + struct t_hashtable *extra_vars; + char *msg; + + /* + * "%v" for version is deprecated since WeeChat 1.6, where + * an expression ${info:version} is preferred, so we replace + * the "%v" with version only if there's no "${...}" in string + */ + if (strstr (default_msg, "%v") && !strstr (default_msg, "${")) + { + version = weechat_info_get ("version", ""); + return weechat_string_replace (default_msg, "%v", + (version) ? version : ""); + } + + extra_vars = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_POINTER, + NULL, + NULL); + if (extra_vars) + { + weechat_hashtable_set (extra_vars, "server", server->name); + weechat_hashtable_set (extra_vars, "channel", + (channel_name) ? channel_name : ""); + weechat_hashtable_set (extra_vars, "nick", server->nick); + } + + msg = weechat_string_eval_expression (default_msg, NULL, extra_vars, NULL); + + if (extra_vars) + weechat_hashtable_free (extra_vars); + + return msg; +} + +/* * Allocates a new server and adds it to the servers queue. * * Returns pointer to new server, NULL if error. @@ -3618,8 +3667,9 @@ irc_server_connect_cb (const void *pointer, void *data, case WEECHAT_HOOK_CONNECT_MEMORY_ERROR: weechat_printf ( server->buffer, - _("%s%s: not enough memory"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + (error) ? error : "-"); if (error && error[0]) { weechat_printf ( @@ -3939,8 +3989,9 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server, { weechat_printf ( server->buffer, - _("%s%s: not enough memory"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + "fingerprint"); } } @@ -4432,8 +4483,9 @@ irc_server_connect (struct t_irc_server *server) { weechat_printf ( server->buffer, - _("%s%s: not enough memory"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + "proxy"); return 0; } snprintf (option_name, length, "weechat.proxy.%s.type", proxy); @@ -5489,14 +5541,14 @@ irc_server_add_to_infolist (struct t_infolist *infolist, if (!weechat_infolist_new_var_integer (ptr_item, "away_check_max_nicks", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "default_msg_kick", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_KICK))) + if (!weechat_infolist_new_var_string (ptr_item, "msg_kick", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_KICK))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "default_msg_part", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_PART))) + if (!weechat_infolist_new_var_string (ptr_item, "msg_part", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_PART))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "default_msg_quit", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_QUIT))) + if (!weechat_infolist_new_var_string (ptr_item, "msg_quit", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_QUIT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "temp_server", server->temp_server)) return 0; @@ -5848,27 +5900,27 @@ irc_server_print_log () else weechat_log_printf (" away_check_max_nicks : %d", weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS])); - /* default_msg_kick */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_KICK])) - weechat_log_printf (" default_msg_kick . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_DEFAULT_MSG_KICK)); + /* msg_kick */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_MSG_KICK])) + weechat_log_printf (" msg_kick . . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_MSG_KICK)); else - weechat_log_printf (" default_msg_kick . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_KICK])); - /* default_msg_part */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_PART])) - weechat_log_printf (" default_msg_part . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_DEFAULT_MSG_PART)); + weechat_log_printf (" msg_kick . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_MSG_KICK])); + /* msg_part */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_MSG_PART])) + weechat_log_printf (" msg_part . . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_MSG_PART)); else - weechat_log_printf (" default_msg_part . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_PART])); - /* default_msg_quit */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_QUIT])) - weechat_log_printf (" default_msg_quit . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_DEFAULT_MSG_QUIT)); + weechat_log_printf (" msg_part . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_MSG_PART])); + /* msg_quit */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_MSG_QUIT])) + weechat_log_printf (" msg_quit . . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_MSG_QUIT)); else - weechat_log_printf (" default_msg_quit . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_DEFAULT_MSG_QUIT])); + weechat_log_printf (" msg_quit . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_MSG_QUIT])); /* other server variables */ weechat_log_printf (" temp_server. . . . . : %d", ptr_server->temp_server); weechat_log_printf (" reloading_from_config: %d", ptr_server->reloaded_from_config); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index 10bb1094f..663b0d085 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -78,9 +78,9 @@ enum t_irc_server_option IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW, /* anti-flood (low priority) */ IRC_SERVER_OPTION_AWAY_CHECK, /* delay between away checks */ IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS, /* max nicks for away check */ - IRC_SERVER_OPTION_DEFAULT_MSG_KICK, /* default kick message */ - IRC_SERVER_OPTION_DEFAULT_MSG_PART, /* default part message */ - IRC_SERVER_OPTION_DEFAULT_MSG_QUIT, /* default quit message */ + IRC_SERVER_OPTION_MSG_KICK, /* default kick message */ + IRC_SERVER_OPTION_MSG_PART, /* default part message */ + IRC_SERVER_OPTION_MSG_QUIT, /* default quit message */ IRC_SERVER_OPTION_NOTIFY, /* notify list */ /* number of server options */ IRC_SERVER_NUM_OPTIONS, @@ -300,6 +300,9 @@ extern char irc_server_get_prefix_char_for_mode (struct t_irc_server *server, extern const char *irc_server_get_chanmodes (struct t_irc_server *server); extern int irc_server_prefix_char_statusmsg (struct t_irc_server *server, char prefix_char); +extern char *irc_server_get_default_msg (const char *default_msg, + struct t_irc_server *server, + const char *channel_name); extern struct t_irc_server *irc_server_alloc (const char *name); extern struct t_irc_server *irc_server_alloc_with_url (const char *irc_url); extern void irc_server_apply_command_line_options (struct t_irc_server *server, diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c index a5317a36e..7acdb13f7 100644 --- a/src/plugins/logger/logger-buffer.c +++ b/src/plugins/logger/logger-buffer.c @@ -79,11 +79,10 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level) if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: start logging for buffer \"%s\"", - LOGGER_PLUGIN_NAME, - weechat_buffer_get_string (buffer, "name")); + weechat_printf_date_tags (NULL, 0, "no_log", + "%s: start logging for buffer \"%s\"", + LOGGER_PLUGIN_NAME, + weechat_buffer_get_string (buffer, "name")); } new_logger_buffer = malloc (sizeof (*new_logger_buffer)); @@ -197,11 +196,11 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer) if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: stop logging for buffer \"%s\"", - LOGGER_PLUGIN_NAME, - weechat_buffer_get_string (ptr_buffer, "name")); + weechat_printf_date_tags ( + NULL, 0, "no_log", + "%s: stop logging for buffer \"%s\"", + LOGGER_PLUGIN_NAME, + weechat_buffer_get_string (ptr_buffer, "name")); } } diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index 478201d15..0e9a8d75c 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -94,9 +94,9 @@ logger_config_flush_delay_change (const void *pointer, void *data, { if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: stopping timer", LOGGER_PLUGIN_NAME); + weechat_printf_date_tags ( + NULL, 0, "no_log", + "%s: stopping timer", LOGGER_PLUGIN_NAME); } weechat_unhook (logger_timer); logger_timer = NULL; @@ -106,11 +106,11 @@ logger_config_flush_delay_change (const void *pointer, void *data, { if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: starting timer (interval: %d seconds)", - LOGGER_PLUGIN_NAME, - weechat_config_integer (logger_config_file_flush_delay)); + weechat_printf_date_tags ( + NULL, 0, "no_log", + "%s: starting timer (interval: %d seconds)", + LOGGER_PLUGIN_NAME, + weechat_config_integer (logger_config_file_flush_delay)); } logger_timer = weechat_hook_timer (weechat_config_integer (logger_config_file_flush_delay) * 1000, 0, 0, diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 71378c1e3..159557f20 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -97,10 +97,9 @@ logger_get_file_path () if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: file path = \"%s\"", - LOGGER_PLUGIN_NAME, path2); + weechat_printf_date_tags (NULL, 0, "no_log", + "%s: file path = \"%s\"", + LOGGER_PLUGIN_NAME, path2); } end: @@ -364,13 +363,12 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask) if (weechat_logger_plugin->debug) { - weechat_printf_tags (NULL, - "no_log", - "%s: buffer = \"%s\", mask = \"%s\", " - "decoded mask = \"%s\"", - LOGGER_PLUGIN_NAME, - weechat_buffer_get_string (buffer, "name"), - mask, mask_decoded5); + weechat_printf_date_tags (NULL, 0, "no_log", + "%s: buffer = \"%s\", mask = \"%s\", " + "decoded mask = \"%s\"", + LOGGER_PLUGIN_NAME, + weechat_buffer_get_string (buffer, "name"), + mask, mask_decoded5); } end: @@ -417,12 +415,12 @@ logger_get_filename (struct t_gui_buffer *buffer) mask = logger_get_mask_for_buffer (buffer); if (!mask) { - weechat_printf_tags (NULL, - "no_log", - _("%s%s: unable to find filename mask for buffer " - "\"%s\", logging is disabled for this buffer"), - weechat_prefix ("error"), LOGGER_PLUGIN_NAME, - weechat_buffer_get_string (buffer, "name")); + weechat_printf_date_tags ( + NULL, 0, "no_log", + _("%s%s: unable to find filename mask for buffer " + "\"%s\", logging is disabled for this buffer"), + weechat_prefix ("error"), LOGGER_PLUGIN_NAME, + weechat_buffer_get_string (buffer, "name")); return NULL; } @@ -470,11 +468,10 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer) log_filename = logger_get_filename (logger_buffer->buffer); if (!log_filename) { - weechat_printf_tags (NULL, - "no_log", - _("%s%s: not enough memory"), - weechat_prefix ("error"), - LOGGER_PLUGIN_NAME); + weechat_printf_date_tags (NULL, 0, "no_log", + _("%s%s: not enough memory"), + weechat_prefix ("error"), + LOGGER_PLUGIN_NAME); return; } @@ -482,15 +479,15 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer) ptr_logger_buffer = logger_buffer_search_log_filename (log_filename); if (ptr_logger_buffer) { - weechat_printf_tags (NULL, - "no_log", - _("%s%s: unable to start logging for buffer " - "\"%s\": filename \"%s\" is already used by " - "another buffer (check your log settings)"), - weechat_prefix ("error"), - LOGGER_PLUGIN_NAME, - weechat_buffer_get_string (logger_buffer->buffer, "name"), - log_filename); + weechat_printf_date_tags ( + NULL, 0, "no_log", + _("%s%s: unable to start logging for buffer " + "\"%s\": filename \"%s\" is already used by " + "another buffer (check your log settings)"), + weechat_prefix ("error"), + LOGGER_PLUGIN_NAME, + weechat_buffer_get_string (logger_buffer->buffer, "name"), + log_filename); free (log_filename); return; } @@ -538,12 +535,12 @@ logger_write_line (struct t_logger_buffer *logger_buffer, } if (!logger_create_directory ()) { - weechat_printf_tags (NULL, - "no_log", - _("%s%s: unable to create directory for logs " - "(\"%s\")"), - weechat_prefix ("error"), LOGGER_PLUGIN_NAME, - weechat_config_string (logger_config_file_path)); + weechat_printf_date_tags ( + NULL, 0, "no_log", + _("%s%s: unable to create directory for logs " + "(\"%s\")"), + weechat_prefix ("error"), LOGGER_PLUGIN_NAME, + weechat_config_string (logger_config_file_path)); logger_buffer_free (logger_buffer); return; } @@ -559,9 +556,8 @@ 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", + weechat_printf_date_tags ( + NULL, 0, "no_log", _("%s%s: unable to write log file \"%s\": %s"), weechat_prefix ("error"), LOGGER_PLUGIN_NAME, logger_buffer->log_filename, strerror (errno)); @@ -839,11 +835,10 @@ logger_flush () { if (weechat_logger_plugin->debug >= 2) { - weechat_printf_tags (NULL, - "no_log", - "%s: flush file %s", - LOGGER_PLUGIN_NAME, - ptr_logger_buffer->log_filename); + weechat_printf_date_tags (NULL, 0, "no_log", + "%s: flush file %s", + LOGGER_PLUGIN_NAME, + ptr_logger_buffer->log_filename); } fflush (ptr_logger_buffer->log_file); ptr_logger_buffer->flush_needed = 0; diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index 684a8dd10..52a7f4001 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -257,16 +257,16 @@ relay_client_handshake_timer_cb (const void *pointer, void *data, if (gnutls_error_is_fatal (rc)) { /* handshake error, disconnect client */ - weechat_printf_tags (NULL, "relay_client", - _("%s%s: TLS handshake failed for client %s%s%s: " - "error %d %s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT, - rc, - gnutls_strerror (rc)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: TLS handshake failed for client %s%s%s: error %d %s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT, + rc, + gnutls_strerror (rc)); weechat_unhook (client->hook_timer_handshake); client->hook_timer_handshake = NULL; relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); @@ -276,13 +276,14 @@ relay_client_handshake_timer_cb (const void *pointer, void *data, if (remaining_calls == 0) { /* handshake timeout, disconnect client */ - weechat_printf_tags (NULL, "relay_client", - _("%s%s: TLS handshake timeout for client %s%s%s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: TLS handshake timeout for client %s%s%s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); weechat_unhook (client->hook_timer_handshake); client->hook_timer_handshake = NULL; relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); @@ -386,15 +387,16 @@ relay_client_recv_text (struct t_relay_client *client, const char *data) "400 Bad Request"); if (weechat_relay_plugin->debug >= 1) { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: invalid websocket " - "handshake received for " - "client %s%s%s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: invalid websocket " + "handshake received for client " + "%s%s%s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); } break; case -2: @@ -402,13 +404,14 @@ relay_client_recv_text (struct t_relay_client *client, const char *data) "403 Forbidden"); if (weechat_relay_plugin->debug >= 1) { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: origin \"%s\" " - "not allowed for websocket"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - weechat_hashtable_get (client->http_headers, - "Origin")); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: origin \"%s\" " + "not allowed for websocket"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + weechat_hashtable_get (client->http_headers, + "Origin")); } break; } @@ -419,8 +422,8 @@ relay_client_recv_text (struct t_relay_client *client, const char *data) client->http_headers, "X-Real-IP"); if (ptr_real_ip) { - weechat_printf_tags ( - NULL, "relay_client", + weechat_printf_date_tags ( + NULL, 0, "relay_client", _("%s: websocket client %s%s%s has real IP " "address \"%s\""), RELAY_PLUGIN_NAME, @@ -610,13 +613,14 @@ relay_client_recv_cb (const void *pointer, void *data, int fd) if (!rc) { /* error when decoding frame: close connection */ - weechat_printf_tags (NULL, "relay_client", - _("%s%s: error decoding websocket frame " - "for client %s%s%s"), - weechat_prefix ("error"), RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: error decoding websocket frame for client " + "%s%s%s"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); return WEECHAT_RC_OK; } @@ -645,16 +649,17 @@ relay_client_recv_cb (const void *pointer, void *data, int fd) if ((num_read == 0) || ((num_read != GNUTLS_E_AGAIN) && (num_read != GNUTLS_E_INTERRUPTED))) { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: reading data on socket for " - "client %s%s%s: error %d %s"), - weechat_prefix ("error"), RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT, - num_read, - (num_read == 0) ? _("(connection closed by peer)") : - gnutls_strerror (num_read)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: reading data on socket for client %s%s%s: " + "error %d %s"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT, + num_read, + (num_read == 0) ? _("(connection closed by peer)") : + gnutls_strerror (num_read)); relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); } } @@ -664,16 +669,17 @@ relay_client_recv_cb (const void *pointer, void *data, int fd) if ((num_read == 0) || ((errno != EAGAIN) && (errno != EWOULDBLOCK))) { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: reading data on socket for " - "client %s%s%s: error %d %s"), - weechat_prefix ("error"), RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT, - errno, - (num_read == 0) ? _("(connection closed by peer)") : - strerror (errno)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: reading data on socket for client %s%s%s: " + "error %d %s"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT, + errno, + (num_read == 0) ? _("(connection closed by peer)") : + strerror (errno)); relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); } } @@ -956,16 +962,16 @@ relay_client_send (struct t_relay_client *client, } else { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: sending data to client %s%s%s: " - "error %d %s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT, - num_sent, - gnutls_strerror (num_sent)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: sending data to client %s%s%s: error %d %s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT, + num_sent, + gnutls_strerror (num_sent)); relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); } } @@ -981,16 +987,16 @@ relay_client_send (struct t_relay_client *client, } else { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: sending data to client %s%s%s: " - "error %d %s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT, - errno, - strerror (errno)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: sending data to client %s%s%s: error %d %s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT, + errno, + strerror (errno)); relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); } } @@ -1125,16 +1131,17 @@ relay_client_timer_cb (const void *pointer, void *data, int remaining_calls) } else { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: sending data to client " - "%s%s%s: error %d %s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - ptr_client->desc, - RELAY_COLOR_CHAT, - num_sent, - gnutls_strerror (num_sent)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: sending data to client %s%s%s: " + "error %d %s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + ptr_client->desc, + RELAY_COLOR_CHAT, + num_sent, + gnutls_strerror (num_sent)); relay_client_set_status (ptr_client, RELAY_STATUS_DISCONNECTED); } @@ -1149,16 +1156,17 @@ relay_client_timer_cb (const void *pointer, void *data, int remaining_calls) } else { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: sending data to client " - "%s%s%s: error %d %s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - ptr_client->desc, - RELAY_COLOR_CHAT, - errno, - strerror (errno)); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: sending data to client %s%s%s: " + "error %d %s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + ptr_client->desc, + RELAY_COLOR_CHAT, + errno, + strerror (errno)); relay_client_set_status (ptr_client, RELAY_STATUS_DISCONNECTED); } @@ -1238,12 +1246,12 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) { if (!relay_network_init_ssl_cert_key_ok) { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: warning: no SSL certificate/key " - "found (option " - "relay.network.ssl_cert_key)"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s%s: warning: no SSL certificate/key found (option " + "relay.network.ssl_cert_key)"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME); } new_client->status = RELAY_STATUS_CONNECTING; /* @@ -1310,13 +1318,13 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) last_relay_client = new_client; relay_clients = new_client; - weechat_printf_tags (NULL, "relay_client", - _("%s: new client on port %d: %s%s%s"), - RELAY_PLUGIN_NAME, - server->port, - RELAY_COLOR_CHAT_CLIENT, - new_client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags (NULL, 0, "relay_client", + _("%s: new client on port %d: %s%s%s"), + RELAY_PLUGIN_NAME, + server->port, + RELAY_COLOR_CHAT_CLIENT, + new_client->desc, + RELAY_COLOR_CHAT); new_client->hook_fd = weechat_hook_fd (new_client->sock, 1, 0, 0, @@ -1337,9 +1345,9 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) } else { - weechat_printf_tags (NULL, "relay_client", - _("%s%s: not enough memory for new client"), - weechat_prefix ("error"), RELAY_PLUGIN_NAME); + weechat_printf_date_tags (NULL, 0, "relay_client", + _("%s%s: not enough memory for new client"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); } return new_client; @@ -1488,22 +1496,23 @@ relay_client_set_status (struct t_relay_client *client, switch (client->status) { case RELAY_STATUS_AUTH_FAILED: - weechat_printf_tags (NULL, "relay_client", - _("%s%s: authentication failed with " - "client %s%s%s"), - weechat_prefix ("error"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags (NULL, 0, "relay_client", + _("%s%s: authentication failed with " + "client %s%s%s"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); break; case RELAY_STATUS_DISCONNECTED: - weechat_printf_tags (NULL, "relay_client", - _("%s: disconnected from client %s%s%s"), - RELAY_PLUGIN_NAME, - RELAY_COLOR_CHAT_CLIENT, - client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s: disconnected from client %s%s%s"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); break; default: break; diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 834984738..ab9835b18 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -231,11 +231,15 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(hdata) msg = relay_weechat_msg_new (id); if (msg) { - if (relay_weechat_msg_add_hdata (msg, argv[0], - (argc > 1) ? argv_eol[1] : NULL)) + if (!relay_weechat_msg_add_hdata (msg, argv[0], + (argc > 1) ? argv_eol[1] : NULL)) { - relay_weechat_msg_send (client, msg); + relay_weechat_msg_add_type (msg, RELAY_WEECHAT_MSG_OBJ_HDATA); + relay_weechat_msg_add_string (msg, NULL); /* h-path */ + relay_weechat_msg_add_string (msg, NULL); /* keys */ + relay_weechat_msg_add_int (msg, 0); /* count */ } + relay_weechat_msg_send (client, msg); relay_weechat_msg_free (msg); } diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c index aaf660204..a0d67ee3e 100644 --- a/src/plugins/trigger/trigger-buffer.c +++ b/src/plugins/trigger/trigger-buffer.c @@ -254,22 +254,23 @@ trigger_buffer_hashtable_map_cb (void *data, { value_no_color = (weechat_config_boolean (trigger_config_look_monitor_strip_colors)) ? weechat_string_remove_color ((const char *)value, NULL) : NULL; - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t %s: %s\"%s%s%s\"", - (char *)key, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - (value_no_color) ? value_no_color : (const char *)value, - weechat_color ("chat_delimiters")); + weechat_printf_date_tags ( + trigger_buffer, 0, "no_trigger", + "\t %s: %s\"%s%s%s\"", + (char *)key, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + (value_no_color) ? value_no_color : (const char *)value, + weechat_color ("chat_delimiters")); if (value_no_color) free (value_no_color); } else if (strcmp (value_type, "pointer") == 0) { - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t %s: 0x%lx", - (char *)key, - value); + weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", + "\t %s: 0x%lx", + (char *)key, + value); } } @@ -284,7 +285,7 @@ trigger_buffer_display_hashtable (const char *name, if (!trigger_buffer) return; - weechat_printf_tags (trigger_buffer, "no_trigger", " %s:", name); + weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", " %s:", name); weechat_hashtable_map (hashtable, &trigger_buffer_hashtable_map_cb, NULL); } @@ -310,21 +311,23 @@ trigger_buffer_display_trigger (struct t_trigger *trigger, if (!trigger_buffer_match_filters (trigger)) return 0; - weechat_printf_tags (trigger_buffer, "no_trigger", - "%s\t%s%s %s(%s%s%s)", - trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])], - weechat_color (weechat_config_string (trigger_config_color_trigger)), - trigger->name, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]), - weechat_color ("chat_delimiters")); + weechat_printf_date_tags ( + trigger_buffer, 0, "no_trigger", + "%s\t%s%s %s(%s%s%s)", + trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])], + weechat_color (weechat_config_string (trigger_config_color_trigger)), + trigger->name, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]), + weechat_color ("chat_delimiters")); if (buffer) { - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t buffer: %s%s", - weechat_color ("chat_buffer"), - weechat_buffer_get_string (buffer, "full_name")); + weechat_printf_date_tags ( + trigger_buffer, 0, "no_trigger", + "\t buffer: %s%s", + weechat_color ("chat_buffer"), + weechat_buffer_get_string (buffer, "full_name")); } if (pointers) trigger_buffer_display_hashtable ("pointers", pointers); diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index 3ac37a463..184394576 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -205,9 +205,9 @@ trigger_callback_replace_regex (struct t_trigger *trigger, { if (trigger_buffer && display_monitor) { - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t regex %d: %s", - i + 1, _("no variable")); + weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", + "\t regex %d: %s", + i + 1, _("no variable")); } continue; } @@ -217,9 +217,9 @@ trigger_callback_replace_regex (struct t_trigger *trigger, { if (trigger_buffer && display_monitor) { - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t regex %d (%s): %s", - i + 1, ptr_key, _("empty variable")); + weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", + "\t regex %d (%s): %s", + i + 1, ptr_key, _("empty variable")); } continue; } @@ -240,19 +240,19 @@ trigger_callback_replace_regex (struct t_trigger *trigger, /* display debug info on trigger buffer */ if (trigger_buffer && display_monitor) { - weechat_printf_tags (trigger_buffer, "no_trigger", - "\t regex %d %s(%s%s%s)%s: " - "%s\"%s%s%s\"", - i + 1, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - ptr_key, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - value, - weechat_color ("chat_delimiters")); + weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", + "\t regex %d %s(%s%s%s)%s: " + "%s\"%s%s%s\"", + i + 1, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + ptr_key, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + value, + weechat_color ("chat_delimiters")); } weechat_hashtable_set (extra_vars, ptr_key, value); free (value); @@ -299,19 +299,20 @@ trigger_callback_run_command (struct t_trigger *trigger, /* display debug info on trigger buffer */ if (trigger_buffer && display_monitor) { - weechat_printf_tags (trigger_buffer, "no_trigger", - _("%s running command %s\"%s%s%s\"%s " - "on buffer %s%s%s"), - "\t", - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - command_eval, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - weechat_color ("chat_buffer"), - weechat_buffer_get_string (buffer, - "full_name"), - weechat_color ("reset")); + weechat_printf_date_tags ( + trigger_buffer, 0, "no_trigger", + _("%s running command %s\"%s%s%s\"%s " + "on buffer %s%s%s"), + "\t", + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + command_eval, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + weechat_color ("chat_buffer"), + weechat_buffer_get_string (buffer, + "full_name"), + weechat_color ("reset")); } weechat_command (buffer, command_eval); trigger->hook_count_cmd++; diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 3affef98e..695a7322f 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -36,9 +36,9 @@ void trigger_command_display_status () { - weechat_printf_tags (NULL, "no_trigger", - (trigger_enabled) ? - _("Triggers enabled") : _("Triggers disabled")); + weechat_printf_date_tags (NULL, 0, "no_trigger", + (trigger_enabled) ? + _("Triggers enabled") : _("Triggers disabled")); } /* @@ -67,8 +67,8 @@ trigger_command_display_trigger_internal (const char *name, if (verbose >= 1) { - weechat_printf_tags ( - NULL, "no_trigger", + weechat_printf_date_tags ( + NULL, 0, "no_trigger", " %s%s%s: %s%s%s%s%s%s%s", (enabled) ? weechat_color (weechat_config_string (trigger_config_color_trigger)) : @@ -89,69 +89,73 @@ trigger_command_display_trigger_internal (const char *name, spaces[length] = '\0'; if (verbose >= 2) { - weechat_printf_tags (NULL, "no_trigger", - "%s hooks: %d", spaces, hooks_count); - weechat_printf_tags (NULL, "no_trigger", - "%s callback: %d", - spaces, hook_count_cb); - weechat_printf_tags (NULL, "no_trigger", - "%s commands: %d", - spaces, hook_count_cmd); + weechat_printf_date_tags (NULL, 0, "no_trigger", + "%s hooks: %d", spaces, hooks_count); + weechat_printf_date_tags (NULL, 0, "no_trigger", + "%s callback: %d", + spaces, hook_count_cb); + weechat_printf_date_tags (NULL, 0, "no_trigger", + "%s commands: %d", + spaces, hook_count_cmd); } if (conditions && conditions[0]) { - weechat_printf_tags (NULL, "no_trigger", - "%s %s=? %s\"%s%s%s\"", - spaces, - weechat_color (weechat_config_string (trigger_config_color_flag_conditions)), - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - conditions, - weechat_color ("chat_delimiters")); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + "%s %s=? %s\"%s%s%s\"", + spaces, + weechat_color (weechat_config_string (trigger_config_color_flag_conditions)), + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + conditions, + weechat_color ("chat_delimiters")); } for (i = 0; i < regex_count; i++) { - weechat_printf_tags (NULL, "no_trigger", - "%s %s~%d %s\"%s%s%s\" --> " - "\"%s%s%s\"%s%s%s%s", - spaces, - weechat_color (weechat_config_string (trigger_config_color_flag_regex)), - i + 1, - weechat_color ("chat_delimiters"), - weechat_color (weechat_config_string (trigger_config_color_regex)), - regex[i].str_regex, - weechat_color ("chat_delimiters"), - weechat_color (weechat_config_string (trigger_config_color_replace)), - regex[i].replace, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - (regex[i].variable) ? " (" : "", - (regex[i].variable) ? regex[i].variable : "", - (regex[i].variable) ? ")" : ""); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + "%s %s~%d %s\"%s%s%s\" --> " + "\"%s%s%s\"%s%s%s%s", + spaces, + weechat_color (weechat_config_string (trigger_config_color_flag_regex)), + i + 1, + weechat_color ("chat_delimiters"), + weechat_color (weechat_config_string (trigger_config_color_regex)), + regex[i].str_regex, + weechat_color ("chat_delimiters"), + weechat_color (weechat_config_string (trigger_config_color_replace)), + regex[i].replace, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + (regex[i].variable) ? " (" : "", + (regex[i].variable) ? regex[i].variable : "", + (regex[i].variable) ? ")" : ""); } if (commands) { for (i = 0; commands[i]; i++) { - weechat_printf_tags (NULL, "no_trigger", - "%s %s/%d %s\"%s%s%s\"", - spaces, - weechat_color (weechat_config_string (trigger_config_color_flag_command)), - i + 1, - weechat_color ("chat_delimiters"), - weechat_color ("reset"), - commands[i], - weechat_color ("chat_delimiters")); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + "%s %s/%d %s\"%s%s%s\"", + spaces, + weechat_color (weechat_config_string (trigger_config_color_flag_command)), + i + 1, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + commands[i], + weechat_color ("chat_delimiters")); } } if ((return_code >= 0) && (return_code != TRIGGER_RC_OK)) { - weechat_printf_tags (NULL, "no_trigger", - "%s %s=> %s%s", - spaces, - weechat_color (weechat_config_string (trigger_config_color_flag_return_code)), - weechat_color ("reset"), - trigger_return_code_string[return_code]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + "%s %s=> %s%s", + spaces, + weechat_color (weechat_config_string (trigger_config_color_flag_return_code)), + weechat_color ("reset"), + trigger_return_code_string[return_code]); } } else @@ -190,8 +194,8 @@ trigger_command_display_trigger_internal (const char *name, weechat_color (weechat_config_string (trigger_config_color_flag_return_code)), weechat_color ("reset")); } - weechat_printf_tags ( - NULL, "no_trigger", + weechat_printf_date_tags ( + NULL, 0, "no_trigger", " %s%s%s: %s%s%s%s%s%s%s%s%s%s%s%s", (enabled) ? weechat_color (weechat_config_string (trigger_config_color_trigger)) : @@ -246,16 +250,17 @@ trigger_command_list (const char *message, int verbose) { struct t_trigger *ptr_trigger; - weechat_printf_tags (NULL, "no_trigger", ""); + weechat_printf_date_tags (NULL, 0, "no_trigger", ""); trigger_command_display_status (); if (!triggers) { - weechat_printf_tags (NULL, "no_trigger", _("No trigger defined")); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("No trigger defined")); return; } - weechat_printf_tags (NULL, "no_trigger", message); + weechat_printf_date_tags (NULL, 0, "no_trigger", message); for (ptr_trigger = triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) @@ -280,8 +285,9 @@ trigger_command_list_default (int verbose) commands_count = 0; commands = NULL; - weechat_printf_tags (NULL, "no_trigger", ""); - weechat_printf_tags (NULL, "no_trigger", _("List of default triggers:")); + weechat_printf_date_tags (NULL, 0, "no_trigger", ""); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("List of default triggers:")); for (i = 0; trigger_config_default_list[i][0]; i++) { @@ -321,11 +327,12 @@ trigger_command_list_default (int verbose) void trigger_command_error_running (struct t_trigger *trigger, const char *action) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: action \"%s\" can not be executed on " - "trigger \"%s\" because it is currently running"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - action, trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: action \"%s\" can not be executed on " + "trigger \"%s\" because it is currently " + "running"), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + action, trigger->name); } /* @@ -354,16 +361,17 @@ trigger_command_set_enabled (struct t_trigger *trigger, if (weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED])) { trigger_hook (trigger); - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" restarted"), - trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" restarted"), + trigger->name); } else if (display_error) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: a disabled trigger can not be " - "restarted"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: a disabled trigger can not be " + "restarted"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME); } } else @@ -375,11 +383,11 @@ trigger_command_set_enabled (struct t_trigger *trigger, } weechat_config_option_set (trigger->options[TRIGGER_OPTION_ENABLED], (enable) ? "on" : "off", 1); - weechat_printf_tags (NULL, "no_trigger", - (enable) ? - _("Trigger \"%s\" enabled") : - _("Trigger \"%s\" disabled"), - trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + (enable) ? + _("Trigger \"%s\" enabled") : + _("Trigger \"%s\" disabled"), + trigger->name); } } @@ -404,36 +412,38 @@ trigger_command_rename (struct t_trigger *trigger, const char *new_name) /* check that new name is valid */ if (!trigger_name_valid (name2)) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid trigger name: \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - name2); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%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 */ if (trigger_search (name2)) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" already " - "exists"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - name2); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" already " + "exists"), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + name2); goto end; } /* rename the trigger */ if (trigger_rename (trigger, name2)) { - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" renamed to \"%s\""), - name, trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" renamed to \"%s\""), + name, trigger->name); } else { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: failed to rename trigger " - "\"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: failed to rename trigger " + "\"%s\""), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + name); } } @@ -498,19 +508,21 @@ trigger_command_trigger (const void *pointer, void *data, goto error; if (!trigger_name_valid (sargv[0])) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid trigger name: \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - sargv[0]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%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\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - sargv[1]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: invalid hook type: \"%s\""), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + sargv[1]); goto end; } if ((sargc > 4) && sargv[4][0]) @@ -551,10 +563,11 @@ trigger_command_trigger (const void *pointer, void *data, if ((sargc > 6) && sargv[6][0] && (trigger_search_return_code (sargv[6]) < 0)) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid return code: \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - sargv[6]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: invalid return code: \"%s\""), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + sargv[6]); goto end; } ptr_trigger = trigger_search (sargv[0]); @@ -574,22 +587,24 @@ trigger_command_trigger (const void *pointer, void *data, } else { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" already exists " - "(choose another name or use option " - "\"addreplace\" to overwrite it)"), - weechat_prefix ("error"), - TRIGGER_PLUGIN_NAME, sargv[0]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" already exists " + "(choose another name or use option " + "\"addreplace\" to overwrite it)"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, sargv[0]); goto end; } } ptr_trigger = trigger_alloc (sargv[0]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: failed to create trigger \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - sargv[0]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + _("%s%s: failed to create trigger \"%s\""), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + sargv[0]); goto end; } ptr_trigger = trigger_new ( @@ -603,15 +618,17 @@ trigger_command_trigger (const void *pointer, void *data, (sargc > 6) ? sargv[6] : ""); /* return code */ if (ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" created"), sargv[0]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + _("Trigger \"%s\" created"), sargv[0]); } else { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: failed to create trigger \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - sargv[0]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + _("%s%s: failed to create trigger \"%s\""), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + sargv[0]); } goto end; } @@ -625,10 +642,10 @@ trigger_command_trigger (const void *pointer, void *data, type = trigger_search_hook_type (argv[2]); if (type < 0) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid hook type: \"%s\""), - weechat_prefix ("error"), - TRIGGER_PLUGIN_NAME, argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: invalid hook type: \"%s\""), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, argv[2]); goto end; } } @@ -664,10 +681,11 @@ trigger_command_trigger (const void *pointer, void *data, ptr_trigger = trigger_search (argv[2]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" not found"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" not found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[2]); goto end; } add_rc = trigger_hook_default_rc[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0]; @@ -705,10 +723,11 @@ trigger_command_trigger (const void *pointer, void *data, ptr_trigger = trigger_search (argv[2]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" not found"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" not found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[2]); goto end; } if (ptr_trigger->hook_running) @@ -729,17 +748,17 @@ trigger_command_trigger (const void *pointer, void *data, { weechat_config_option_set (ptr_trigger->options[index_option], value, 1); - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" updated"), - ptr_trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" updated"), + ptr_trigger->name); } else { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger option \"%s\" not " - "found"), - weechat_prefix ("error"), - TRIGGER_PLUGIN_NAME, argv[3]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger option \"%s\" not " + "found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, argv[3]); } free (value); } @@ -754,10 +773,11 @@ trigger_command_trigger (const void *pointer, void *data, ptr_trigger = trigger_search (argv[2]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" not found"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" not found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[2]); goto end; } if (ptr_trigger->hook_running) @@ -777,46 +797,50 @@ trigger_command_trigger (const void *pointer, void *data, ptr_trigger = trigger_search (argv[2]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" not found"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" not found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[2]); goto end; } /* check that new name is valid */ if (!trigger_name_valid (argv[3])) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: invalid trigger name: \"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[3]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%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 */ if (trigger_search (argv[3])) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" already " - "exists"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[3]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" already " + "exists"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[3]); goto end; } /* copy the trigger */ ptr_trigger2 = trigger_copy (ptr_trigger, argv[3]); if (ptr_trigger2) { - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" copied to \"%s\""), - ptr_trigger->name, ptr_trigger2->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" copied to \"%s\""), + ptr_trigger->name, ptr_trigger2->name); } else { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: failed to copy trigger " - "\"%s\""), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - ptr_trigger->name); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: failed to copy trigger " + "\"%s\""), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + ptr_trigger->name); } goto end; } @@ -869,9 +893,10 @@ trigger_command_trigger (const void *pointer, void *data, 1); else { - weechat_printf_tags (NULL, "no_trigger", - _("%sTrigger \"%s\" not found"), - weechat_prefix ("error"), argv[i]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%sTrigger \"%s\" not found"), + weechat_prefix ("error"), + argv[i]); } } } @@ -902,8 +927,8 @@ trigger_command_trigger (const void *pointer, void *data, } count = count - triggers_count; if (count > 0) - weechat_printf_tags (NULL, "no_trigger", - _("%d triggers removed"), count); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%d triggers removed"), count); } else { @@ -919,15 +944,17 @@ trigger_command_trigger (const void *pointer, void *data, else { trigger_free (ptr_trigger); - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" removed"), argv[i]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" removed"), + argv[i]); } } else { - weechat_printf_tags (NULL, "no_trigger", - _("%sTrigger \"%s\" not found"), - weechat_prefix ("error"), argv[i]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%sTrigger \"%s\" not found"), + weechat_prefix ("error"), + argv[i]); } } } @@ -942,14 +969,15 @@ trigger_command_trigger (const void *pointer, void *data, ptr_trigger = trigger_search (argv[2]); if (!ptr_trigger) { - weechat_printf_tags (NULL, "no_trigger", - _("%s%s: trigger \"%s\" not found"), - weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, - argv[2]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("%s%s: trigger \"%s\" not found"), + weechat_prefix ("error"), + TRIGGER_PLUGIN_NAME, + argv[2]); goto end; } - weechat_printf_tags (NULL, "no_trigger", ""); - weechat_printf_tags (NULL, "no_trigger", _("Trigger:")); + weechat_printf_date_tags (NULL, 0, "no_trigger", ""); + weechat_printf_date_tags (NULL, 0, "no_trigger", _("Trigger:")); trigger_command_display_trigger (ptr_trigger, 2); goto end; } @@ -989,16 +1017,17 @@ trigger_command_trigger (const void *pointer, void *data, trigger_config_default_list[j][5], /* regex */ trigger_config_default_list[j][6], /* command */ trigger_config_default_list[j][7]); /* return code */ - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" restored"), - argv[i]); + weechat_printf_date_tags (NULL, 0, "no_trigger", + _("Trigger \"%s\" restored"), + argv[i]); } } else { - weechat_printf_tags (NULL, "no_trigger", - _("%sDefault trigger \"%s\" not found"), - weechat_prefix ("error"), argv[i]); + weechat_printf_date_tags ( + NULL, 0, "no_trigger", + _("%sDefault trigger \"%s\" not found"), + weechat_prefix ("error"), argv[i]); } } goto end; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index ece4de71d..0e0b623e0 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -57,7 +57,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20160423-01" +#define WEECHAT_PLUGIN_API_VERSION "20160618-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -1495,12 +1495,6 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); #define weechat_printf(__buffer, __message, __argz...) \ (weechat_plugin->printf_date_tags)(__buffer, 0, NULL, __message, \ ##__argz) -#define weechat_printf_date(__buffer, __date, __message, __argz...) \ - (weechat_plugin->printf_date_tags)(__buffer, __date, NULL, \ - __message, ##__argz) -#define weechat_printf_tags(__buffer, __tags, __message, __argz...) \ - (weechat_plugin->printf_date_tags)(__buffer, 0, __tags, __message, \ - ##__argz) #define weechat_printf_date_tags(__buffer, __date, __tags, __message, \ __argz...) \ (weechat_plugin->printf_date_tags)(__buffer, __date, __tags, \ diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c index ce620bdd9..f2325432f 100644 --- a/src/plugins/xfer/xfer-chat.c +++ b/src/plugins/xfer/xfer-chat.c @@ -200,16 +200,18 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd) (pv_tags && pv_tags[0]) ? pv_tags : "", (pv_tags && pv_tags[0]) ? "," : "", xfer->remote_nick); - weechat_printf_tags (xfer->buffer, - str_tags, - "%s%s%s%s%s%s", - weechat_prefix ("action"), - weechat_color ((xfer->remote_nick_color) ? - xfer->remote_nick_color : "chat_nick_other"), - xfer->remote_nick, - weechat_color ("chat"), - (ptr_buf2[0]) ? " " : "", - ptr_buf2); + weechat_printf_date_tags ( + xfer->buffer, + 0, + str_tags, + "%s%s%s%s%s%s", + weechat_prefix ("action"), + weechat_color ((xfer->remote_nick_color) ? + xfer->remote_nick_color : "chat_nick_other"), + xfer->remote_nick, + weechat_color ("chat"), + (ptr_buf2[0]) ? " " : "", + ptr_buf2); } else { @@ -224,13 +226,16 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd) xfer->remote_nick); if (str_color) free (str_color); - weechat_printf_tags (xfer->buffer, - str_tags, - "%s%s\t%s", - weechat_color ((xfer->remote_nick_color) ? - xfer->remote_nick_color : "chat_nick_other"), - xfer->remote_nick, - ptr_buf2); + weechat_printf_date_tags ( + xfer->buffer, + 0, + str_tags, + "%s%s\t%s", + weechat_color ( + (xfer->remote_nick_color) ? + xfer->remote_nick_color : "chat_nick_other"), + xfer->remote_nick, + ptr_buf2); } if (ptr_buf_decoded) free (ptr_buf_decoded); @@ -290,12 +295,14 @@ xfer_chat_buffer_input_cb (const void *pointer, void *data, input_data_color = weechat_hook_modifier_exec ("irc_color_decode", "1", input_data); - weechat_printf_tags (buffer, - str_tags, - "%s%s\t%s", - weechat_color ("chat_nick_self"), - ptr_xfer->local_nick, - (input_data_color) ? input_data_color : input_data); + weechat_printf_date_tags ( + buffer, + 0, + str_tags, + "%s%s\t%s", + weechat_color ("chat_nick_self"), + ptr_xfer->local_nick, + (input_data_color) ? input_data_color : input_data); if (input_data_color) free (input_data_color); } diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c index 3c643e58c..a548c6a62 100644 --- a/src/plugins/xfer/xfer-command.c +++ b/src/plugins/xfer/xfer-command.c @@ -62,14 +62,15 @@ xfer_command_me (const void *pointer, void *data, { xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\r\n", (argv_eol[1]) ? argv_eol[1] : ""); - weechat_printf_tags (buffer, - "no_highlight", - "%s%s%s %s%s", - weechat_prefix ("action"), - weechat_color ("chat_nick_self"), - ptr_xfer->local_nick, - weechat_color ("chat"), - (argv_eol[1]) ? argv_eol[1] : ""); + weechat_printf_date_tags (buffer, + 0, + "no_highlight", + "%s%s%s %s%s", + weechat_prefix ("action"), + weechat_color ("chat_nick_self"), + ptr_xfer->local_nick, + weechat_color ("chat"), + (argv_eol[1]) ? argv_eol[1] : ""); } return WEECHAT_RC_OK; diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c index f52345dee..a6871376d 100644 --- a/src/plugins/xfer/xfer-network.c +++ b/src/plugins/xfer/xfer-network.c @@ -620,8 +620,9 @@ xfer_network_connect_chat_recv_cb (const void *pointer, void *data, break; case WEECHAT_HOOK_CONNECT_MEMORY_ERROR: weechat_printf (NULL, - _("%s%s: not enough memory"), - weechat_prefix ("error"), XFER_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), XFER_PLUGIN_NAME, + (error) ? error : "-"); break; case WEECHAT_HOOK_CONNECT_TIMEOUT: weechat_printf (NULL, diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index fb7d5ff52..25b855124 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1119,16 +1119,18 @@ xfer_add_cb (const void *pointer, void *data, if (!path) { weechat_printf (NULL, - _("%s%s: not enough memory"), - weechat_prefix ("error"), XFER_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), XFER_PLUGIN_NAME, + "xfer_add, path"); goto error; } filename2 = malloc (strlen (path) + strlen (filename) + 4); if (!filename2) { weechat_printf (NULL, - _("%s%s: not enough memory"), - weechat_prefix ("error"), XFER_PLUGIN_NAME); + _("%s%s: not enough memory (%s)"), + weechat_prefix ("error"), XFER_PLUGIN_NAME, + "xfer_add, filename2"); free (path); goto error; } |