From b399609daf362b99ba73c10e91b3309d663f71d6 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 24 Sep 2012 10:38:05 +0200 Subject: tp-chat: set Private and InviteOnly props on conference channels Only the person invited are suppose to join these channels so tweak their settings to make them more secure. https://bugzilla.gnome.org/show_bug.cgi?id=684675 --- libempathy/empathy-tp-chat.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 39ed8e2ab..4857243c1 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -134,19 +134,46 @@ tp_chat_async_cb (TpChannel *proxy, DEBUG ("Error %s: %s", (gchar *) user_data, error->message); } +static void +update_config_cb (TpChannel *proxy, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + if (error != NULL) + DEBUG ("Failed to change config of the room: %s", error->message); +} + static void create_conference_cb (GObject *source, GAsyncResult *result, gpointer user_data) { + TpChannel *channel; GError *error = NULL; + GHashTable *props; - if (!tp_account_channel_request_create_channel_finish ( - TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) + channel = tp_account_channel_request_create_and_observe_channel_finish ( + TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error); + if (channel == NULL) { DEBUG ("Failed to create conference channel: %s", error->message); g_error_free (error); + return; } + + /* Make the channel more confidential as only people invited are supposed to + * join it. */ + props = tp_asv_new ( + "Private", G_TYPE_BOOLEAN, TRUE, + "InviteOnly", G_TYPE_BOOLEAN, TRUE, + NULL); + + tp_cli_channel_interface_room_config_call_update_configuration (channel, -1, + props, update_config_cb, NULL, NULL, NULL); + + g_object_unref (channel); + g_hash_table_unref (props); } void @@ -199,7 +226,7 @@ empathy_tp_chat_add (EmpathyTpChat *self, /* Although this is a MUC, it's anonymous, so CreateChannel is * valid. */ - tp_account_channel_request_create_channel_async (req, + tp_account_channel_request_create_and_observe_channel_async (req, EMPATHY_CHAT_BUS_NAME, NULL, create_conference_cb, NULL); g_object_unref (req); -- cgit v1.2.3