aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-04-03 22:57:37 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-03 22:57:37 +0800
commit97286a508b0229ca4e2d1e98a52e0ec6d28d6b35 (patch)
treefcd4c70dc9615daf5f374509c18755803c7f8ecb /libempathy-gtk/empathy-chat.c
parented89b5e1814d6c9498647a8650e4f09a1cea217b (diff)
downloadgsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar.gz
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar.bz2
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar.lz
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar.xz
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.tar.zst
gsoc2013-empathy-97286a508b0229ca4e2d1e98a52e0ec6d28d6b35.zip
Don't send unknown commands. Fixes bug #577026
From: Xavier Claessens <xclaesse@gmail.com> svn path=/trunk/; revision=2762
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 0064f1c0b..d11f33161 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