]> git.0d.be Git - empathy.git/commitdiff
Let messages with two slashes without spaces in between pass
authorFrédéric Péters <fpeters@0d.be>
Tue, 28 Jul 2009 08:36:47 +0000 (10:36 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 7 Aug 2009 14:16:29 +0000 (15:16 +0100)
This makes it possible to send /unix/path (GNOME bug 589335)

libempathy-gtk/empathy-chat.c

index a8ca745e29ead8b2fca9273aa90bf734c599c935..bdd2e4c1713a563349d981dc6b3e37fff6fb1e84 100644 (file)
@@ -400,9 +400,18 @@ chat_send (EmpathyChat  *chat,
        if (msg[0] == '/' &&
            !g_str_has_prefix (msg, "/me") &&
            !g_str_has_prefix (msg, "/say")) {
-               empathy_chat_view_append_event (chat->view,
-                       _("Unsupported command"));
-               return;
+               /* Also allow messages with two slashes before the first space,
+                * so it is possible to send an /unix/path */
+               int slash_count = 0, i;
+               for (i = 0; msg[i] && msg[i] != ' ' && slash_count < 2; i++) {
+                       if (msg[i] == '/')
+                               slash_count++;
+               }
+               if (slash_count == 1) {
+                       empathy_chat_view_append_event (chat->view,
+                               _("Unsupported command"));
+                       return;
+               }
        }
 
        /* We can send the message */