Let "::stuff" be treated as ":say :stuff" in chat mode
authorMikael Berthe <mikael@lilotux.net>
Sat, 11 Feb 2017 20:19:36 +0100
changeset 2310 e26c7709e023
parent 2309 e00ae0763468
child 2311 962c98e4864d
Let "::stuff" be treated as ":say :stuff" in chat mode
mcabber/mcabber/commands.c
--- 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}