diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-09-24 16:38:05 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-09-25 15:31:55 +0800 |
commit | b399609daf362b99ba73c10e91b3309d663f71d6 (patch) | |
tree | 2453d6e6967ccbfb6cc06a5135e9dd10f6dc9db8 /libempathy | |
parent | d848cdc6f54c985f2f146387ccc7d3925eebedd7 (diff) | |
download | gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar.gz gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar.bz2 gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar.lz gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar.xz gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.tar.zst gsoc2013-empathy-b399609daf362b99ba73c10e91b3309d663f71d6.zip |
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
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 33 |
1 files changed, 30 insertions, 3 deletions
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 @@ -135,18 +135,45 @@ tp_chat_async_cb (TpChannel *proxy, } 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); |