]> git.0d.be Git - empathy.git/commitdiff
Remove validation from chat_send.
authorWill Thompson <will.thompson@collabora.co.uk>
Wed, 26 Aug 2009 18:51:49 +0000 (19:51 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Thu, 27 Aug 2009 20:16:53 +0000 (21:16 +0100)
Instead, call empathy_message_new_from_entry (), which parses the
entered text for us.

libempathy-gtk/empathy-chat.c

index 118baff701b6bf70cb193d42610700d3e0646210..a979c9e76203349645d5d30f4f460fef86f595c2 100644 (file)
@@ -396,29 +396,15 @@ chat_send (EmpathyChat  *chat,
                return;
        }
 
-       /* Blacklist messages begining by '/', except for "/me" and "/say"
-        * because they are handled in EmpathyMessage */
-       if (msg[0] == '/' &&
-           !g_str_has_prefix (msg, "/me") &&
-           !g_str_has_prefix (msg, "/say")) {
-               /* 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;
-               }
-       }
+       message = empathy_message_new_from_entry (msg);
 
-       /* We can send the message */
-       message = empathy_message_new (msg);
-       empathy_tp_chat_send (priv->tp_chat, message);
-       g_object_unref (message);
+       if (message == NULL) {
+               empathy_chat_view_append_event (chat->view,
+                       _("Unsupported command"));
+       } else {
+               empathy_tp_chat_send (priv->tp_chat, message);
+               g_object_unref (message);
+       }
 }
 
 static void