aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-10-10 15:57:10 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-11-01 22:36:45 +0800
commita24f350a5e3423913f3456ddf7d5f5c6d3ad3300 (patch)
tree410a717c14d513e563cb219c172b2652720e7756 /libempathy-gtk/empathy-chat.c
parentd283411b3f1ba3685b329a7a41d59ae153bd15ba (diff)
downloadgsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar.gz
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar.bz2
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar.lz
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar.xz
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.tar.zst
gsoc2013-empathy-a24f350a5e3423913f3456ddf7d5f5c6d3ad3300.zip
Add support for /query command
https://bugzilla.gnome.org/show_bug.cgi?id=573407
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index a8bddde3d..8c38e5bf7 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -391,6 +391,20 @@ chat_join_command_cb (EmpathyDispatchOperation *dispatch,
}
static void
+chat_query_command_cb (EmpathyDispatchOperation *dispatch,
+ const GError *error,
+ gpointer user_data)
+{
+ EmpathyChat *chat = user_data;
+
+ if (error != NULL) {
+ DEBUG ("Error: %s", error->message);
+ empathy_chat_view_append_event (chat->view,
+ _("Failed to query contact"));
+ }
+}
+
+static void
chat_send (EmpathyChat *chat,
const gchar *msg)
{
@@ -438,7 +452,21 @@ chat_send (EmpathyChat *chat,
join = g_strstrip (g_strdup (msg + strlen ("/join ")));
} else if (g_str_has_prefix (msg, "/j ")) {
join = g_strstrip (g_strdup (msg + strlen ("/j ")));
+ } else if (g_str_has_prefix (msg, "/query ")) {
+ TpConnection *connection;
+ gchar *id;
+
+ /* FIXME: We should probably search in members alias. But this
+ * is enough for IRC */
+ id = g_strstrip (g_strdup (msg + strlen ("/query ")));
+ connection = empathy_tp_chat_get_connection (priv->tp_chat);
+ empathy_dispatcher_chat_with_contact_id (connection, id,
+ chat_query_command_cb,
+ chat);
+ g_free (id);
+ return;
}
+
if (join != NULL) {
TpConnection *connection;