about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-08-06 22:46:36 +0100
committerJames Booth <boothj5@gmail.com>2014-08-06 22:46:36 +0100
commitac68cc77f86d41a0f25ded9bdf4df10692dfc8ec (patch)
tree3b119eb7f12a6eaf964166488b6a32f7b87ff13a
parente38ebe8a85e53a11a38b83f4dca1d586c499bb5c (diff)
downloadprofani-tty-ac68cc77f86d41a0f25ded9bdf4df10692dfc8ec.tar.gz
Allow escaping commands using double slash "//"
-rw-r--r--src/command/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index ed2708c4..42fee1ce 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1391,14 +1391,18 @@ cmd_execute_alias(const char * const inp, gboolean *ran)
 }
 
 gboolean
-cmd_execute_default(const char * const inp)
+cmd_execute_default(const char * inp)
 {
     win_type_t win_type = ui_current_win_type();
     jabber_conn_status_t status = jabber_get_connection_status();
     char *recipient = ui_current_recipient();
 
+    // handle escaped commands - treat as normal message
+    if (g_str_has_prefix(inp, "//")) {
+        inp++;
+
     // handle unknown commands
-    if ((inp[0] == '/') && (!g_str_has_prefix(inp, "/me "))) {
+    } else if ((inp[0] == '/') && (!g_str_has_prefix(inp, "/me "))) {
         cons_show("Unknown command: %s", inp);
         cons_alert();
         return TRUE;