auth-factory: relay the auth-password-failed signal
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 28 Oct 2011 13:00:40 +0000 (15:00 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 23 Nov 2011 12:14:31 +0000 (13:14 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=661640

libempathy/empathy-auth-factory.c

index d88e9bfd890b260c4bdbd095b0e69124d7543daa..0aaea1c4afa2d5e62e6f7730b1a0036c0dc89efc 100644 (file)
@@ -59,6 +59,7 @@ struct _EmpathyAuthFactoryPriv {
 enum {
   NEW_SERVER_TLS_HANDLER,
   NEW_SERVER_SASL_HANDLER,
+  AUTH_PASSWORD_FAILED,
   LAST_SIGNAL,
 };
 
@@ -145,6 +146,18 @@ sasl_handler_invalidated_cb (EmpathyServerSASLHandler *handler,
   g_hash_table_remove (priv->sasl_handlers, tp_proxy_get_object_path (channel));
 }
 
+static void
+sasl_handler_auth_password_failed_cb (EmpathyServerSASLHandler *handler,
+    const gchar *password,
+    EmpathyAuthFactory *self)
+{
+  TpAccount *account;
+
+  account = empathy_server_sasl_handler_get_account (handler);
+
+  g_signal_emit (self, signals[AUTH_PASSWORD_FAILED], 0, account, password);
+}
+
 static void
 server_sasl_handler_ready_cb (GObject *source,
     GAsyncResult *res,
@@ -185,6 +198,9 @@ server_sasl_handler_ready_cb (GObject *source,
       tp_g_signal_connect_object (handler, "invalidated",
           G_CALLBACK (sasl_handler_invalidated_cb), data->self, 0);
 
+      tp_g_signal_connect_object (handler, "auth-password-failed",
+          G_CALLBACK (sasl_handler_auth_password_failed_cb), data->self, 0);
+
       g_signal_emit (data->self, signals[NEW_SERVER_SASL_HANDLER], 0,
           handler);
     }
@@ -626,6 +642,15 @@ empathy_auth_factory_class_init (EmpathyAuthFactoryClass *klass)
       g_cclosure_marshal_generic,
       G_TYPE_NONE,
       1, EMPATHY_TYPE_SERVER_SASL_HANDLER);
+
+  signals[AUTH_PASSWORD_FAILED] =
+    g_signal_new ("auth-password-failed",
+      G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0,
+      NULL, NULL,
+      g_cclosure_marshal_generic,
+      G_TYPE_NONE,
+      2, TP_TYPE_ACCOUNT, G_TYPE_STRING);
 }
 
 EmpathyAuthFactory *