aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-store.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-05-12 14:26:58 +0800
committerMilan Crha <mcrha@redhat.com>2011-05-12 14:26:58 +0800
commitb6324935dbfe1e26ae883955f0939ce734a4d0ae (patch)
treec22fa0286bf618d9ffe9aad89d624c03b398595c /mail/e-mail-store.c
parent20ba4ae4bbd244b90e2c1af7df4db7f9be14fadd (diff)
downloadgsoc2013-evolution-b6324935dbfe1e26ae883955f0939ce734a4d0ae.tar.gz
gsoc2013-evolution-b6324935dbfe1e26ae883955f0939ce734a4d0ae.tar.zst
gsoc2013-evolution-b6324935dbfe1e26ae883955f0939ce734a4d0ae.zip
Cannot send message with just enabled account
Everything in UI seemed as working fine, but the message is just lost, even there was printed a runtime warning on the console. This is fixing couple things along this issue: - differentiate between NULL and invalid pointers/objects in new e_mail_folder_uri_...() functions - report error to UI if mail_session_send_to_thread() fails to find corresponding transport service - call e_mail_store_add_by_account() in mail_store_load_accounts() (a side-effect of this change is no code duplication and unified processing of the same action)
Diffstat (limited to 'mail/e-mail-store.c')
-rw-r--r--mail/e-mail-store.c91
1 files changed, 36 insertions, 55 deletions
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 214efb0bb3..d61f8521dc 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -235,67 +235,15 @@ mail_store_load_accounts (EMailSession *session,
account_list = e_get_account_list ();
for (iter = e_list_get_iterator ((EList *) account_list);
- e_iterator_is_valid (iter); e_iterator_next (iter)) {
-
+ e_iterator_is_valid (iter); e_iterator_next (iter)) {
EAccount *account;
- CamelURL *url;
- gchar *transport_uid;
- gboolean skip = FALSE;
- GError *error = NULL;
account = (EAccount *) e_iterator_get (iter);
if (!account->enabled)
continue;
- /* Do not add local-delivery files,
- * but make them ready for later use. */
- url = camel_url_new (account->source->url, NULL);
- if (url != NULL) {
- skip = em_utils_is_local_delivery_mbox_file (url);
- camel_url_free (url);
- }
-
- if (skip) {
- GError *error = NULL;
-
- camel_session_add_service (
- CAMEL_SESSION (session),
- account->uid, account->source->url,
- CAMEL_PROVIDER_STORE, &error);
-
- if (error != NULL) {
- g_warning (
- "Failed to add '%s' as store: %s",
- account->source->url,
- error->message);
- g_error_free (error);
- }
- } else {
- e_mail_store_add_by_account (session, account);
- }
-
- /* While we're at it, add the account's transport to the
- * CamelSession. The transport's UID is a kludge for now.
- * We take the EAccount's UID and tack on "-transport". */
-
- if (account->transport == NULL)
- continue;
-
- transport_uid = g_strconcat (
- account->uid, "-transport", NULL);
-
- camel_session_add_service (
- CAMEL_SESSION (session),
- transport_uid, account->transport->url,
- CAMEL_PROVIDER_TRANSPORT, &error);
-
- g_free (transport_uid);
-
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+ e_mail_store_add_by_account (session, account);
}
g_object_unref (iter);
@@ -344,6 +292,8 @@ e_mail_store_add_by_account (EMailSession *session,
{
CamelService *service;
CamelProvider *provider;
+ CamelURL *url;
+ gboolean skip;
GError *error = NULL;
g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
@@ -361,10 +311,41 @@ e_mail_store_add_by_account (EMailSession *session,
account->uid, account->source->url,
CAMEL_PROVIDER_STORE, &error);
+ if (account->transport) {
+ /* While we're at it, add the account's transport to the
+ * CamelSession. The transport's UID is a kludge for now.
+ * We take the EAccount's UID and tack on "-transport". */
+ gchar *transport_uid;
+ GError *transport_error = NULL;
+
+ transport_uid = g_strconcat (
+ account->uid, "-transport", NULL);
+
+ camel_session_add_service (
+ CAMEL_SESSION (session),
+ transport_uid, account->transport->url,
+ CAMEL_PROVIDER_TRANSPORT, &transport_error);
+
+ g_free (transport_uid);
+
+ if (transport_error) {
+ g_warning ("%s: Failed to add transport service: %s", G_STRFUNC, transport_error->message);
+ g_error_free (transport_error);
+ }
+ }
+
if (!CAMEL_IS_STORE (service))
goto fail;
- if (provider->flags & CAMEL_PROVIDER_IS_STORAGE)
+ /* Do not add local-delivery files,
+ * but make them ready for later use. */
+ url = camel_url_new (account->source->url, NULL);
+ if (url != NULL) {
+ skip = em_utils_is_local_delivery_mbox_file (url);
+ camel_url_free (url);
+ }
+
+ if (!skip && (provider->flags & CAMEL_PROVIDER_IS_STORAGE))
e_mail_store_add (
session, CAMEL_STORE (service), account->name);