[empathy: 3/12] Add support for /query command



commit a24f350a5e3423913f3456ddf7d5f5c6d3ad3300
Author: Xavier Claessens <xclaesse gmail com>
Date:   Sat Oct 10 09:57:10 2009 +0200

    Add support for /query command
    
    https://bugzilla.gnome.org/show_bug.cgi?id=573407

 libempathy-gtk/empathy-chat.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index a8bddde..8c38e5b 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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]