about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c3
-rw-r--r--src/command/cmd_defs.c8
-rw-r--r--src/command/cmd_funcs.c10
-rw-r--r--src/tools/parser.c4
4 files changed, 14 insertions, 11 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index c91bb447..386e8939 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -3765,9 +3765,8 @@ _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 a7b7e49c..60fb262e 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2382,7 +2382,7 @@ static struct cmd_t command_defs[] =
     },
 
     { "/correct",
-        parse_args, 1, 1, NULL,
+        parse_args, 1, -1, NULL,
         CMD_NOSUBFUNCS
         CMD_MAINFUNC(cmd_correct)
         CMD_TAGS(
@@ -2393,10 +2393,8 @@ static struct cmd_t command_defs[] =
         CMD_DESC(
             "Correct and resend the last message (XEP-0308).")
         CMD_ARGS(
-            { "\"message\"",    "The corrected message. Multiple words need quotation marks."})
-        CMD_EXAMPLES(
-            "/correct Profanity",
-            "/correct \"Profanity is the best\"")
+            { "message",    "The corrected message."})
+        CMD_NOEXAMPLES
     },
 };
 
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index cfb78cd4..40f5d8f4 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -8701,7 +8701,10 @@ cmd_correct(ProfWin *window, const char *const command, gchar **args)
         }
 
         // send message again, with replace flag
-        cl_ev_send_msg_correct(chatwin, args[0], FALSE, TRUE);
+        gchar *message = g_strjoinv(" ", args);
+        cl_ev_send_msg_correct(chatwin, message, FALSE, TRUE);
+
+        free(message);
         return TRUE;
     } else if (window->type == WIN_MUC) {
         ProfMucWin *mucwin = (ProfMucWin*)window;
@@ -8713,7 +8716,10 @@ cmd_correct(ProfWin *window, const char *const command, gchar **args)
         }
 
         // send message again, with replace flag
-        cl_ev_send_muc_msg_corrected(mucwin, args[0], FALSE, TRUE);
+        gchar *message = g_strjoinv(" ", args);
+        cl_ev_send_muc_msg_corrected(mucwin, message, FALSE, TRUE);
+
+        free(message);
         return TRUE;
     }
 
diff --git a/src/tools/parser.c b/src/tools/parser.c
index aa739330..fb21571c 100644
--- a/src/tools/parser.c
+++ b/src/tools/parser.c
@@ -48,7 +48,7 @@
  *
  * inp - The line of input
  * min - The minimum allowed number of arguments
- * max - The maximum allowed number of arguments
+ * max - The maximum allowed number of arguments, -1 for infinite
  *
  * Returns - An NULL terminated array of strings representing the arguments
  * of the command, or NULL if the validation fails.
@@ -135,7 +135,7 @@ parse_args(const char *const inp, int min, int max, gboolean *result)
     int num = g_slist_length(tokens) - 1;
 
     // if num args not valid return NULL
-    if ((num < min) || (num > max)) {
+    if ((num < min) || ((max != -1) && (num > max))) {
         g_slist_free_full(tokens, free);
         g_free(copy);
         *result = FALSE;
id='n253' href='#n253'>253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485