From: Xavier Claessens Date: Fri, 3 Apr 2009 14:57:37 +0000 (+0000) Subject: Don't send unknown commands. Fixes bug #577026 X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=97286a508b0229ca4e2d1e98a52e0ec6d28d6b35 Don't send unknown commands. Fixes bug #577026 From: Xavier Claessens svn path=/trunk/; revision=2762 --- diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 0064f1c0..d11f3316 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -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