diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-10-10 15:48:23 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-11-01 22:36:45 +0800 |
commit | d283411b3f1ba3685b329a7a41d59ae153bd15ba (patch) | |
tree | a4d3a0c0b0fd62c3b1334c1ec0a57158bdc0536b | |
parent | 940f9b60e27fe79d64357c651525cbf50a936567 (diff) | |
download | gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar.gz gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar.bz2 gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar.lz gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar.xz gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.tar.zst gsoc2013-empathy-d283411b3f1ba3685b329a7a41d59ae153bd15ba.zip |
Add support for /join command
https://bugzilla.gnome.org/show_bug.cgi?id=573407
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 6c712a54e..a8bddde3d 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -377,11 +377,26 @@ chat_sent_message_get_last (EmpathyChat *chat) } static void +chat_join_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 join chatroom")); + } +} + +static void chat_send (EmpathyChat *chat, const gchar *msg) { EmpathyChatPriv *priv; EmpathyMessage *message; + gchar *join = NULL; if (EMP_STR_EMPTY (msg)) { return; @@ -394,7 +409,7 @@ chat_send (EmpathyChat *chat, if (strcmp (msg, "/clear") == 0) { empathy_chat_view_clear (chat->view); return; - } else if (g_str_has_prefix (msg, "/topic")) { + } else if (g_str_has_prefix (msg, "/topic ")) { EmpathyTpChatProperty *property; GValue value = {0, }; gchar *topic; @@ -412,13 +427,26 @@ chat_send (EmpathyChat *chat, return; } - topic = g_strstrip (g_strdup (msg + strlen ("/topic"))); + topic = g_strstrip (g_strdup (msg + strlen ("/topic "))); g_value_init (&value, G_TYPE_STRING); g_value_take_string (&value, topic); empathy_tp_chat_set_property (priv->tp_chat, "subject", &value); g_value_unset (&value); return; + } else if (g_str_has_prefix (msg, "/join ")) { + join = g_strstrip (g_strdup (msg + strlen ("/join "))); + } else if (g_str_has_prefix (msg, "/j ")) { + join = g_strstrip (g_strdup (msg + strlen ("/j "))); + } + if (join != NULL) { + TpConnection *connection; + + connection = empathy_tp_chat_get_connection (priv->tp_chat); + empathy_dispatcher_join_muc (connection, join, + chat_join_command_cb, chat); + g_free (join); + return; } message = empathy_message_new_from_entry (msg); |