From a24f350a5e3423913f3456ddf7d5f5c6d3ad3300 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sat, 10 Oct 2009 09:57:10 +0200 Subject: Add support for /query command https://bugzilla.gnome.org/show_bug.cgi?id=573407 --- libempathy-gtk/empathy-chat.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 @@ -390,6 +390,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; -- cgit v1.2.3