]> git.0d.be Git - empathy.git/commitdiff
Don't send unknown commands. Fixes bug #577026
authorXavier Claessens <xclaesse@gmail.com>
Fri, 3 Apr 2009 14:57:37 +0000 (14:57 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 3 Apr 2009 14:57:37 +0000 (14:57 +0000)
From: Xavier Claessens <xclaesse@gmail.com>

svn path=/trunk/; revision=2762

libempathy-gtk/empathy-chat.c

index 0064f1c0baa6a2427147c86abaef8aab058d86c0..d11f331610670887e24a875e44bc85733acd60f5 100644 (file)
@@ -349,26 +349,33 @@ chat_send (EmpathyChat  *chat,
           const gchar *msg)
 {
        EmpathyChatPriv *priv;
-       EmpathyMessage  *message;
-
-       priv = GET_PRIV (chat);
 
        if (EMP_STR_EMPTY (msg)) {
                return;
        }
 
+       priv = GET_PRIV (chat);
+
        chat_sent_message_add (chat, msg);
 
+       /* If this is not a command, send the message */
+       if (msg[0] != '/') {
+               EmpathyMessage  *message;
+
+               message = empathy_message_new (msg);
+               empathy_tp_chat_send (priv->tp_chat, message);
+               g_object_unref (message);
+               return;
+       }
+
+       /* Check for all supported commands */
        if (g_str_has_prefix (msg, "/clear")) {
                empathy_chat_view_clear (chat->view);
                return;
        }
 
-       message = empathy_message_new (msg);
-
-       empathy_tp_chat_send (priv->tp_chat, message);
-
-       g_object_unref (message);
+       /* This is an unknown command, display a message to the user */
+       empathy_chat_view_append_event (chat->view, _("Unsupported command"));
 }
 
 static void