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 yahoo_backend_config_calendar_child (ECollectionBackend *backend, ESource *source) { EYahooBackend *yahoo_backend; ESource *collection_source; ESource *mail_identity_source; ESourceExtension *extension; ESourceCollection *collection_extension; const gchar *extension_name; const gchar *identity; gchar *display_name = NULL; /* FIXME As a future enhancement, we should query Yahoo! * for a list of user calendars and add them to the * collection with matching display names and colors. */ yahoo_backend = E_YAHOO_BACKEND (backend); collection_source = e_backend_get_source (E_BACKEND (backend)); collection_extension = e_source_get_extension ( collection_source, E_SOURCE_EXTENSION_COLLECTION); identity = e_source_collection_get_identity (collection_extension); /* XXX Assume the calendar's display name can be derived from * the user's mail identity. As mentioned above, we should * really just query Yahoo! for a list of user calendars. */ mail_identity_source = g_weak_ref_get (&yahoo_backend->mail_identity_source); if (mail_identity_source != NULL) { extension = e_source_get_extension ( mail_identity_source, E_SOURCE_EXTENSION_MAIL_IDENTITY); display_name = e_source_mail_identity_dup_name ( E_SOURCE_MAIL_IDENTITY (extension)); if (display_name != NULL) g_strdelimit (display_name, " ", '_'); g_object_unref (mail_identity_source); } extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; extension = e_source_get_extension (source, extension_name); e_source_authentication_set_host ( E_SOURCE_AUTHENTICATION (extension), YAHOO_CALENDAR_HOST); e_binding_bind_property ( collection_extension, "identity", extension, "user", G_BINDING_SYNC_CREATE); extension_name = E_SOURCE_EXTENSION_SECURITY; extension = e_source_get_extension (source, extension_name); e_source_security_set_secure ( E_SOURCE_SECURITY (extension), TRUE); extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND; extension = e_source_get_extension (source, extension_name); e_source_webdav_set_display_name ( E_SOURCE_WEBDAV (extension), display_name); if (identity != NULL && display_name != NULL) { gchar *resource_path; resource_path = g_strdup_printf ( YAHOO_CALENDAR_CALDAV_PATH, identity, display_name); e_source_webdav_set_resource_path ( E_SOURCE_WEBDAV (extension), resource_path); g_free (resource_path); } g_free (display_name); }
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); }