aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-06 23:31:29 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-06 23:31:29 +0800
commit49c833b128823ffc7bf8c3ad68ec3fc656e76464 (patch)
treeeffc15d18dc6c94147d11d6dbde5ff9c7fc413d2 /mail/mail-ops.c
parente3f577a5b9c6c9fd8ed45dc025cc3fe9f27da63d (diff)
downloadgsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.gz
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.bz2
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.lz
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.xz
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.tar.zst
gsoc2013-evolution-49c833b128823ffc7bf8c3ad68ec3fc656e76464.zip
Adapt to X-Evolution-Source headers storing UIDs.
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c38
1 files changed, 10 insertions, 28 deletions
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]);
}