[folks] eds: Add a dummy authentication handler



commit 8c0c98a26914f5b1014866ae889f24d461ba3877
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jan 9 18:24:21 2012 +0000

    eds: Add a dummy authentication handler
    
    This will deny any authentication requests, which goes some way to stopping
    address books remaining in the âopeningâ state indefinitely. However, it
    (curiously) doesnât entirely eliminate the problem.
    
    It also looks like this is a situation where the ::opened signal can return
    an error while the async open() call doesnât. Joy.

 backends/eds/lib/edsf-persona-store.vala |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 0bdcb7d..8290652 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -250,6 +250,8 @@ public class Edsf.PersonaStore : Folks.PersonaStore
 
           if (this._addressbook != null)
             {
+              ((!) this._addressbook).authenticate.disconnect (
+                  this._address_book_authenticate_cb);
               ((!) this._addressbook).notify["readonly"].disconnect (
                   this._address_book_notify_read_only_cb);
 
@@ -608,6 +610,8 @@ public class Edsf.PersonaStore : Folks.PersonaStore
 
               ((!) this._addressbook).notify["readonly"].connect (
                   this._address_book_notify_read_only_cb);
+              ((!) this._addressbook).authenticate.connect (
+                  this._address_book_authenticate_cb);
 
               yield this._open_address_book ();
               debug ("Successfully finished opening address book %p for " +
@@ -900,6 +904,17 @@ public class Edsf.PersonaStore : Folks.PersonaStore
         }
     }
 
+  private bool _address_book_authenticate_cb (Client address_book,
+      void *credentials)
+    {
+      /* FIXME: Add authentication support. That's:
+       * https://bugzilla.gnome.org/show_bug.cgi?id=653339
+       *
+       * For the moment, we just reject the authentication request, rather than
+       * leave it hanging. */
+      return false;
+    }
+
   /* Temporaries for _open_address_book(). See the complaint below. */
   Error? _open_address_book_error = null;
   SourceFunc? _open_address_book_callback = null; /* non-null iff yielded */
@@ -922,7 +937,14 @@ public class Edsf.PersonaStore : Folks.PersonaStore
 
       try
         {
+          this._open_address_book_error = null;
+
           yield ((!) this._addressbook).open (false, null);
+
+          if (this._open_address_book_error != null)
+            {
+              throw this._open_address_book_error;
+            }
         }
       catch (GLib.Error e1)
         {
@@ -942,6 +964,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
                * open() call above. */
               this._open_address_book_callback =
                   this._open_address_book.callback;
+              this._open_address_book_error = null;
 
               debug ("Yielding on opening address book %p for persona store " +
                   "â%sâ (%p)", this._addressbook, this.id, this);
@@ -985,9 +1008,10 @@ public class Edsf.PersonaStore : Folks.PersonaStore
       debug ("_address_book_opened_cb for store â%sâ (%p), address book %p " +
           "and error %p", this.id, this, address_book, (void*) err);
 
+      this._open_address_book_error = err;
+
       if (this._open_address_book_callback != null)
         {
-          this._open_address_book_error = err;
           this._open_address_book_callback ();
         }
     }



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