Bug 699024 - [google/yahoo] Don't override username
authorMatthew Barnes <mbarnes@redhat.com>
Mon, 6 May 2013 14:02:41 +0000 (10:02 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 6 May 2013 14:02:41 +0000 (10:02 -0400)
When mail child sources are added to a google or yahoo collection, avoid
overriding an existing user name setting.  The IMAP or (especially) SMTP
configuration may have been modified to use a non-Google/Yahoo! server.

modules/google-backend/module-google-backend.c
modules/yahoo-backend/module-yahoo-backend.c

index 594e813..d5684bb 100644 (file)
@@ -313,19 +313,28 @@ google_backend_child_added (ECollectionBackend *backend,
        if (is_mail && e_source_has_extension (child_source, extension_name)) {
                ESourceAuthentication *auth_child_extension;
                ESourceCollection *collection_extension;
+               const gchar *collection_identity;
+               const gchar *auth_child_user;
 
                extension_name = E_SOURCE_EXTENSION_COLLECTION;
                collection_extension = e_source_get_extension (
                        collection_source, extension_name);
+               collection_identity = e_source_collection_get_identity (
+                       collection_extension);
 
                extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
                auth_child_extension = e_source_get_extension (
                        child_source, extension_name);
-
-               g_object_bind_property (
-                       collection_extension, "identity",
-                       auth_child_extension, "user",
-                       G_BINDING_SYNC_CREATE);
+               auth_child_user = e_source_authentication_get_user (
+                       auth_child_extension);
+
+               /* XXX Do not override an existing user name setting.
+                *     The IMAP or (especially) SMTP configuration may
+                *     have been modified to use a non-Google server. */
+               if (auth_child_user == NULL)
+                       e_source_authentication_set_user (
+                               auth_child_extension,
+                               collection_identity);
        }
 
        /* Keep the contacts authentication method up-to-date.
index a6fd4e8..4f53516 100644 (file)
@@ -308,19 +308,28 @@ yahoo_backend_child_added (ECollectionBackend *backend,
        if (is_mail && e_source_has_extension (child_source, extension_name)) {
                ESourceAuthentication *auth_child_extension;
                ESourceCollection *collection_extension;
+               const gchar *collection_identity;
+               const gchar *auth_child_user;
 
                extension_name = E_SOURCE_EXTENSION_COLLECTION;
                collection_extension = e_source_get_extension (
                        collection_source, extension_name);
+               collection_identity = e_source_collection_get_identity (
+                       collection_extension);
 
                extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
                auth_child_extension = e_source_get_extension (
                        child_source, extension_name);
-
-               g_object_bind_property (
-                       collection_extension, "identity",
-                       auth_child_extension, "user",
-                       G_BINDING_SYNC_CREATE);
+               auth_child_user = e_source_authentication_get_user (
+                       auth_child_extension);
+
+               /* XXX Do not override an existing user name setting.
+                *     The IMAP or (especially) SMTP configuration may
+                *     have been modified to use a non-Yahoo! server. */
+               if (auth_child_user == NULL)
+                       e_source_authentication_set_user (
+                               auth_child_extension,
+                               collection_identity);
        }
 
        /* Chain up to parent's child_added() method. */