From 935d2f62ebc72edfe86ccf4449b7d95ef758bb74 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 28 Jan 2011 16:44:56 +0000 Subject: chat: save room passwords in the keyring if requested Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 455fb0e8e..eb7325339 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -2973,6 +2973,7 @@ typedef struct GtkWidget *label; GtkWidget *entry; GtkWidget *spinner; + gchar *password; } PasswordData; static void @@ -2994,12 +2995,18 @@ remember_password_infobar_response_cb (GtkWidget *info_bar, gint response_id, PasswordData *data) { + EmpathyChatPriv *priv = GET_PRIV (data->self); + if (response_id == GTK_RESPONSE_OK) { DEBUG ("Saving room password"); - /* TODO: implement this */ + empathy_keyring_set_room_password_async (priv->account, + empathy_tp_chat_get_id (priv->tp_chat), + data->password, + NULL, NULL); } gtk_widget_destroy (info_bar); + g_free (data->password); g_slice_free (PasswordData, data); } @@ -3014,6 +3021,9 @@ chat_prompt_to_save_password (EmpathyChat *self, GtkWidget *alig; GtkWidget *button; + /* save the password in case it needs to be saved */ + data->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->entry))); + /* Remove all previous widgets */ content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (data->info_bar)); gtk_container_forall (GTK_CONTAINER (content_area), -- cgit v1.2.3