aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-message.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-10-27 21:26:14 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-11-01 22:36:46 +0800
commit018af67a500b8bab6b8b374c32a887f399339834 (patch)
tree681b5bac72eb53d9cab0c83d194e0ac28ac1e3f6 /libempathy/empathy-message.c
parenta732461a6458478703b769b3ab5c6fb5d30c90a4 (diff)
downloadgsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar.gz
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar.bz2
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar.lz
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar.xz
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.tar.zst
gsoc2013-empathy-018af67a500b8bab6b8b374c32a887f399339834.zip
Move /me and /say support from EmpathyMessage to EmpathyChat.
Also make commands not case sensitive and use g_ascii_isspace to detect spaces.
Diffstat (limited to 'libempathy/empathy-message.c')
-rw-r--r--libempathy/empathy-message.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index a403766e4..705bd224b 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -234,62 +234,6 @@ message_set_property (GObject *object,
};
}
-static gboolean
-has_prefix_case (const gchar *s,
- const gchar *prefix)
-{
- return g_ascii_strncasecmp (s, prefix, strlen (prefix)) == 0;
-}
-
-/*
- * Constructs an EmpathyMessage based on user input, which may include "/me"
- * and friends.
- *
- * Returns: an #EmpathyMessage if @message could be parsed, or %NULL if
- * @message was an unknown command.
- */
-EmpathyMessage *
-empathy_message_new_from_entry (const gchar *message)
-{
- TpChannelTextMessageType t = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
-
- g_return_val_if_fail (message != NULL, NULL);
-
- if (message[0] == '/') {
- if (g_ascii_strcasecmp (message, "/me") == 0) {
- message = "";
- t = TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION;
- } else if (has_prefix_case (message, "/me ")) {
- message += strlen ("/me ");
- t = TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION;
- } else if (has_prefix_case (message, "/say ")) {
- message += strlen ("/say ");
- } else {
- /* Also allow messages with two slashes before the
- * first space, so it is possible to send a /unix/path.
- * This heuristic is kind of crap.
- */
- gboolean second_slash = FALSE;
- const gchar *m = message + 1;
-
- while (!second_slash && *m != '\0' && *m != ' ') {
- if (*m == '/')
- second_slash = TRUE;
-
- m++;
- }
-
- if (!second_slash)
- return NULL;
- }
- }
-
- return g_object_new (EMPATHY_TYPE_MESSAGE,
- "type", t,
- "body", message,
- NULL);
-}
-
EmpathyMessage *
empathy_message_new (const gchar *body)
{