[empathy: 15/27] server-sasl-handler: save the password if requested



commit b66750b8540761c03b935ff93d50c642c9d1f07c
Author: Jonny Lamb <jonny lamb collabora co uk>
Date:   Mon Dec 6 10:06:51 2010 +0000

    server-sasl-handler: save the password if requested
    
    Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

 libempathy/empathy-server-sasl-handler.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c
index b71cbdb..d9f5049 100644
--- a/libempathy/empathy-server-sasl-handler.c
+++ b/libempathy/empathy-server-sasl-handler.c
@@ -359,6 +359,25 @@ start_mechanism_with_data_cb (TpChannel *proxy,
   DEBUG ("Started mechanism successfully");
 }
 
+static void
+empathy_server_sasl_handler_set_password_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  GError *error = NULL;
+
+  if (!empathy_keyring_set_password_finish (TP_ACCOUNT (source), result,
+          &error))
+    {
+      DEBUG ("Failed to set password: %s", error->message);
+      g_clear_error (&error);
+    }
+  else
+    {
+      DEBUG ("Password set successfully.");
+    }
+}
+
 void
 empathy_server_sasl_handler_provide_password (
     EmpathyServerSASLHandler *handler,
@@ -389,7 +408,8 @@ empathy_server_sasl_handler_provide_password (
 
   if (remember)
     {
-      /* TODO */
+      empathy_keyring_set_password_async (priv->account, password,
+          empathy_server_sasl_handler_set_password_cb, NULL);
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]