[evolution-ews] Setup the Authentication extension so Camel can determine host reachability



commit 42bf5f3db281bfb9d7c498922bf7cab849e2b4ea
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Dec 12 21:42:11 2013 +0100

    Setup the Authentication extension so Camel can determine host reachability
    
    https://bugzilla.gnome.org/show_bug.cgi?id=715165

 src/collection/e-ews-backend.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index 89749e6..5b93815 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -603,12 +603,18 @@ ews_backend_finalize (GObject *object)
 static void
 ews_backend_constructed (GObject *object)
 {
+       EBackend *backend;
        ESource *source;
+       ESourceAuthentication *auth_extension;
+       const gchar *extension_name;
+       gchar *host = NULL;
+       guint16 port = 0;
 
        /* Chain up to parent's constructed() method. */
        G_OBJECT_CLASS (e_ews_backend_parent_class)->constructed (object);
 
-       source = e_backend_get_source (E_BACKEND (object));
+       backend = E_BACKEND (object);
+       source = e_backend_get_source (backend);
 
        /* XXX Wondering if we ought to delay this until after folders
         *     are initially populated, just to remove the possibility
@@ -620,9 +626,21 @@ ews_backend_constructed (GObject *object)
                source, "changed",
                G_CALLBACK (ews_backend_source_changed_cb), object);
 
+       /* Setup the Authentication extension so
+        * Camel can determine host reachability. */
+       extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+       auth_extension = e_source_get_extension (source, extension_name);
+
+       if (e_backend_get_destination_address (backend, &host, &port)) {
+               e_source_authentication_set_host (auth_extension, host);
+               e_source_authentication_set_port (auth_extension, port);
+       }
+
+       g_free (host);
+
        /* Reset the connectable, it steals data from Authentication extension,
           where is written incorrect address */
-       e_backend_set_connectable (E_BACKEND (object), NULL);
+       e_backend_set_connectable (backend, NULL);
 }
 
 static void


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