From 8523d53b5c5a88c2581ca15d92e253c9d3bc38bf Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 13 Nov 2009 22:36:48 +0100 Subject: Implement /nick command --- libempathy-gtk/empathy-chat.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 62b3d437b..67c8426cb 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -711,6 +711,26 @@ chat_command_msg (EmpathyChat *chat, chat_command_msg_internal (chat, strv[1], strv[2]); } +static void +chat_command_nick (EmpathyChat *chat, + GStrv strv) +{ + EmpathyChatPriv *priv = GET_PRIV (chat); + TpConnection *connection; + GHashTable *new_alias; + TpHandle handle; + + connection = tp_account_get_connection (priv->account); + handle = tp_connection_get_self_handle (connection); + new_alias = g_hash_table_new (g_direct_hash, g_direct_equal); + g_hash_table_insert (new_alias, GUINT_TO_POINTER (handle), strv[1]); + + tp_cli_connection_interface_aliasing_call_set_aliases (connection, -1, + new_alias, NULL, NULL, NULL, NULL); + + g_hash_table_destroy (new_alias); +} + static void chat_command_me (EmpathyChat *chat, GStrv strv) @@ -767,6 +787,9 @@ static ChatCommandItem commands[] = { {"msg", 3, 3, chat_command_msg, N_("/msg , open a private chat")}, + {"nick", 2, 2, chat_command_nick, + N_("/nick , change your nickname on current server")}, + {"me", 2, 2, chat_command_me, N_("/me , send an ACTION message to the current conversation")}, -- cgit v1.2.3