[evolution-data-server] Bug #445439 - Delete mail from pop-server when deleted from Inbox/Trash
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #445439 - Delete mail from pop-server when deleted from Inbox/Trash
- Date: Wed, 27 Oct 2010 08:06:07 +0000 (UTC)
commit f5f6794c2aa6d0e9de46e9196ff7434dc3b04de4
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 27 10:04:42 2010 +0200
Bug #445439 - Delete mail from pop-server when deleted from Inbox/Trash
camel/providers/pop3/camel-pop3-folder.c | 8 +++++---
camel/providers/pop3/camel-pop3-provider.c | 2 ++
camel/providers/pop3/camel-pop3-store.c | 11 ++++++++---
camel/providers/pop3/camel-pop3-store.h | 2 ++
4 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index abcb299..fd83494 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -455,6 +455,9 @@ pop3_folder_get_message_sync (CamelFolder *folder,
g_prefix_error (error, _("Cannot get message %s: "), uid);
g_object_unref (message);
message = NULL;
+ } else {
+ /* because the UID in the local store doesn't match with the UID in the pop3 store */
+ camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution-POP3-UID", uid);
}
done:
g_object_unref (stream);
@@ -551,7 +554,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
pop3_folder = CAMEL_POP3_FOLDER (folder);
pop3_store = CAMEL_POP3_STORE (parent_store);
- if (pop3_store->delete_after && !expunge) {
+ if (pop3_store->delete_after > 0 && !expunge) {
d(printf("%s(%d): pop3_store->delete_after = [%d], expunge=[%d]\n",
__FILE__, __LINE__, pop3_store->delete_after, expunge));
camel_operation_push_message (
@@ -564,7 +567,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
camel_operation_pop_message (cancellable);
}
- if (!expunge) {
+ if (!expunge || (pop3_store->keep_on_server && !pop3_store->delete_expunged)) {
return TRUE;
}
@@ -792,4 +795,3 @@ camel_pop3_delete_old (CamelFolder *folder,
return 0;
}
-
diff --git a/camel/providers/pop3/camel-pop3-provider.c b/camel/providers/pop3/camel-pop3-provider.c
index 1c1196f..8f99731 100644
--- a/camel/providers/pop3/camel-pop3-provider.c
+++ b/camel/providers/pop3/camel-pop3-provider.c
@@ -41,6 +41,8 @@ static CamelProviderConfEntry pop3_conf_entries[] = {
N_("_Leave messages on server"), "0" },
{ CAMEL_PROVIDER_CONF_CHECKSPIN, "delete_after", "keep_on_server",
N_("_Delete after %s day(s)"), "0:1:7:365" },
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "delete_expunged", "keep_on_server",
+ N_("Delete _expunged from local Inbox"), "0" },
{ CAMEL_PROVIDER_CONF_CHECKBOX, "disable_extensions", NULL,
N_("Disable _support for all POP3 extensions"), "0" },
{ CAMEL_PROVIDER_CONF_SECTION_END },
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index d8ef07d..6cf38e7 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -119,7 +119,7 @@ connect_to_server (CamelService *service,
guint32 flags = 0;
gint clean_quit = TRUE;
gint ret;
- const gchar *delete_days;
+ const gchar *param;
if (ssl_mode != MODE_CLEAR) {
#ifdef CAMEL_HAVE_SSL
@@ -167,8 +167,13 @@ connect_to_server (CamelService *service,
if (camel_url_get_param (service->url, "disable_extensions"))
flags |= CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS;
- if ((delete_days = (gchar *) camel_url_get_param(service->url,"delete_after")))
- store->delete_after = atoi (delete_days);
+ store->keep_on_server = camel_url_get_param (service->url, "keep_on_server") != NULL;
+ store->delete_expunged = camel_url_get_param (service->url, "delete_expunged") != NULL;
+
+ if ((param = camel_url_get_param (service->url, "delete_after")))
+ store->delete_after = atoi (param);
+ else
+ store->delete_after = 0;
if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
g_set_error (
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
index 3b27aef..bc16917 100644
--- a/camel/providers/pop3/camel-pop3-store.h
+++ b/camel/providers/pop3/camel-pop3-store.h
@@ -61,7 +61,9 @@ struct _CamelPOP3Store {
CamelDataCache *cache;
+ gboolean keep_on_server;
guint delete_after;
+ gboolean delete_expunged;
};
struct _CamelPOP3StoreClass {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]