From 1072cdab0add1389d0ab6667aceecf64e583fcc4 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 12 Feb 2020 14:45:26 +0100 Subject: xep-0308: Fix sending corrections for multiple words --- src/command/cmd_ac.c | 3 ++- src/command/cmd_defs.c | 6 ++++-- src/command/cmd_funcs.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 386e8939..c91bb447 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -3765,8 +3765,9 @@ _correct_autocomplete(ProfWin *window, const char *const input, gboolean previou return NULL; } - GString *result_str = g_string_new("/correct "); + GString *result_str = g_string_new("/correct \""); g_string_append(result_str, last_message); + g_string_append(result_str, "\""); char *result = result_str->str; g_string_free(result_str, FALSE); diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index db719b17..a7b7e49c 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2393,8 +2393,10 @@ static struct cmd_t command_defs[] = CMD_DESC( "Correct and resend the last message (XEP-0308).") CMD_ARGS( - { "", "The corrected message."}) - CMD_NOEXAMPLES + { "\"message\"", "The corrected message. Multiple words need quotation marks."}) + CMD_EXAMPLES( + "/correct Profanity", + "/correct \"Profanity is the best\"") }, }; diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h index 768e14a2..f283c910 100644 --- a/src/command/cmd_funcs.h +++ b/src/command/cmd_funcs.h @@ -54,7 +54,7 @@ typedef struct cmd_help_t { * cmd - The command string including leading '/' * parser - The function used to parse arguments * min_args - Minimum number of arguments - * max_args - Maximum number of arguments + * max_args - Maximum number of arguments, -1 for infinite * setting_func - Function to display current settings to the console * sub_funcs - Optional list of functions mapped to the first argument * func - Main function to call when no arguments, or sub_funcs not implemented -- cgit 1.4.1-2-gfad0