changeset 2310:e26c7709e023

Let "::stuff" be treated as ":say :stuff" in chat mode
author Mikael Berthe <mikael@lilotux.net>
date Sat, 11 Feb 2017 20:19:36 +0100
parents e00ae0763468
children 962c98e4864d
files mcabber/mcabber/commands.c
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c	Sat Feb 11 12:40:43 2017 +0100
+++ b/mcabber/mcabber/commands.c	Sat Feb 11 20:19:36 2017 +0100
@@ -550,17 +550,22 @@
     return;
   }
 
-  if (*line != COMMAND_CHAR) {
-    // This isn't a command
-    if (scr_get_multimode())
-      scr_append_multiline(line);
-    else
-      say_cmd((char*)line, 0);
-    return;
+  if (*line == COMMAND_CHAR && scr_get_multimode() != 2) {
+    if (*(line+1) != COMMAND_CHAR) {
+      /* It is a command */
+      process_command(line, FALSE);
+      return;
+    } else {
+      /* Skip the first COMMAND_CHAR */
+      line++;
+    }
   }
 
-  /* It is _probably_ a command -- except for verbatim multi-line mode */
-  process_command(line, FALSE);
+  // This isn't a command
+  if (scr_get_multimode())
+    scr_append_multiline(line);
+  else
+    say_cmd((char*)line, 0);
 }
 
 // Helper routine for buffer item_{lock,unlock,toggle_lock}