static void outlook_backend_child_added (ECollectionBackend *backend, ESource *child_source) { ESource *collection_source; const gchar *extension_name; gboolean is_mail = FALSE; collection_source = e_backend_get_source (E_BACKEND (backend)); extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; is_mail |= e_source_has_extension (child_source, extension_name); extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; is_mail |= e_source_has_extension (child_source, extension_name); extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT; is_mail |= e_source_has_extension (child_source, extension_name); /* Synchronize mail-related user with the collection identity. */ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; 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); 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-Outlook server. */ if (auth_child_user == NULL) e_source_authentication_set_user ( auth_child_extension, collection_identity); } /* Chain up to parent's child_added() method. */ E_COLLECTION_BACKEND_CLASS (e_outlook_backend_parent_class)-> child_added (backend, child_source); }
static void yahoo_backend_child_added (ECollectionBackend *backend, ESource *child_source) { EYahooBackend *yahoo_backend; ESource *collection_source; const gchar *extension_name; gboolean is_mail = FALSE; /* Chain up to parent's child_added() method. */ E_COLLECTION_BACKEND_CLASS (e_yahoo_backend_parent_class)-> child_added (backend, child_source); yahoo_backend = E_YAHOO_BACKEND (backend); collection_source = e_backend_get_source (E_BACKEND (backend)); extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; is_mail |= e_source_has_extension (child_source, extension_name); /* Take special note of the mail identity source. * We need it to build the calendar CalDAV path. */ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; if (e_source_has_extension (child_source, extension_name)) { GWeakRef *weak_ref; weak_ref = &yahoo_backend->mail_identity_source; g_weak_ref_set (weak_ref, child_source); is_mail = TRUE; } extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT; is_mail |= e_source_has_extension (child_source, extension_name); /* Synchronize mail-related user with the collection identity. */ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; 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); 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); } }
static void google_backend_child_added (ECollectionBackend *backend, ESource *child_source) { ESource *collection_source; const gchar *extension_name; gboolean is_mail = FALSE; collection_source = e_backend_get_source (E_BACKEND (backend)); extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; is_mail |= e_source_has_extension (child_source, extension_name); extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; is_mail |= e_source_has_extension (child_source, extension_name); extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT; is_mail |= e_source_has_extension (child_source, extension_name); /* Synchronize mail-related user with the collection identity. */ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; 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); 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 calendar authentication method up-to-date. * * XXX Not using a property binding here in case I end up adding * other "support" interfaces which influence authentication. * Many-to-one property bindinds tend not to work so well. */ extension_name = E_SOURCE_EXTENSION_CALENDAR; if (e_source_has_extension (child_source, extension_name)) { google_backend_calendar_update_auth_method (child_source); g_signal_connect ( child_source, "notify::oauth2-support", G_CALLBACK (google_backend_calendar_update_auth_method), NULL); } /* Keep the contacts authentication method up-to-date. * * XXX Not using a property binding here in case I end up adding * other "support" interfaces which influence authentication. * Many-to-one property bindings tend not to work so well. */ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK; if (e_source_has_extension (child_source, extension_name)) { google_backend_contacts_update_auth_method (child_source); g_signal_connect ( child_source, "notify::oauth2-support", G_CALLBACK (google_backend_contacts_update_auth_method), NULL); } /* Chain up to parent's child_added() method. */ E_COLLECTION_BACKEND_CLASS (e_google_backend_parent_class)-> child_added (backend, child_source); }