Commit df96db8f authored by Matthew Barnes's avatar Matthew Barnes Committed by Rodrigo Moya
Browse files

Adapt to X-Evolution-Source headers storing UIDs.

parent b5c7c656
......@@ -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 *
......
......@@ -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]);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment