diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-06 23:31:29 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-06 23:31:29 +0800 |
commit | 49c833b128823ffc7bf8c3ad68ec3fc656e76464 (patch) | |
tree | effc15d18dc6c94147d11d6dbde5ff9c7fc413d2 | |
parent | e3f577a5b9c6c9fd8ed45dc025cc3fe9f27da63d (diff) | |
download | gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.gz gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.zst gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.zip |
Adapt to X-Evolution-Source headers storing UIDs.
-rw-r--r-- | mail/em-utils.c | 8 | ||||
-rw-r--r-- | mail/mail-ops.c | 38 |
2 files changed, 13 insertions, 33 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c index 81a702ce6b..07957ec456 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2069,13 +2069,11 @@ guess_account_from_folder (CamelFolder *folder) static EAccount * guess_account_from_message (CamelMimeMessage *message) { - const gchar *source_url; + const gchar *uid; - source_url = camel_mime_message_get_source (message); - if (source_url == NULL) - return NULL; + uid = camel_mime_message_get_source (message); - return e_get_account_by_source_url (source_url); + return (uid != NULL) ? e_get_account_by_uid (uid) : NULL; } GHashTable * diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 340890c8eb..0526084016 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1688,37 +1688,16 @@ mail_refresh_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gpo /* ******************************************************************************** */ static gboolean -folder_is_from_source_url (CamelFolder *folder, const gchar *source_url) +folder_is_from_source_uid (CamelFolder *folder, + const gchar *source_uid) { CamelStore *store; - CamelService *service; - CamelProvider *provider; - CamelURL *service_url; - CamelURL *url; - gboolean res = FALSE; - - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (source_url != NULL, FALSE); + const gchar *uid; store = camel_folder_get_parent_store (folder); - g_return_val_if_fail (store != NULL, FALSE); - - service = CAMEL_SERVICE (store); - g_return_val_if_fail (service != NULL, FALSE); + uid = camel_service_get_uid (CAMEL_SERVICE (store)); - provider = camel_service_get_provider (service); - g_return_val_if_fail (provider != NULL, FALSE); - g_return_val_if_fail (provider->url_equal != NULL, FALSE); - - url = camel_url_new (source_url, NULL); - g_return_val_if_fail (url != NULL, FALSE); - - service_url = camel_service_get_camel_url (service); - res = provider->url_equal (service_url, url); - - camel_url_free (url); - - return res; + return (g_strcmp0 (uid, source_uid) == 0); } /* This is because pop3 accounts are hidden under local Inbox, thus whenever an expunge @@ -1795,8 +1774,11 @@ expunge_pop3_stores (CamelFolder *expunging, EMailSession *session, GCancellable if (uids) { for (i = 0; i < uids->len; i++) { /* ensure the ID is from this account, as it's generated by evolution */ - const gchar *source_url = g_hash_table_lookup (expunging_uids, uids->pdata[i]); - if (source_url && folder_is_from_source_url (folder, source_url)) { + const gchar *source_uid; + + source_uid = g_hash_table_lookup ( + expunging_uids, uids->pdata[i]); + if (folder_is_from_source_uid (folder, source_uid)) { any_found = TRUE; camel_folder_delete_message (folder, uids->pdata[i]); } |