diff options
Diffstat (limited to 'gnome-extra/evolution-data-server/files/evolution-data-server-2.22.3-mail-cleanup-delay.patch')
-rw-r--r-- | gnome-extra/evolution-data-server/files/evolution-data-server-2.22.3-mail-cleanup-delay.patch | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/gnome-extra/evolution-data-server/files/evolution-data-server-2.22.3-mail-cleanup-delay.patch b/gnome-extra/evolution-data-server/files/evolution-data-server-2.22.3-mail-cleanup-delay.patch new file mode 100644 index 000000000000..51030a14df37 --- /dev/null +++ b/gnome-extra/evolution-data-server/files/evolution-data-server-2.22.3-mail-cleanup-delay.patch @@ -0,0 +1,98 @@ +--- + +At http://bugzilla.gnome.org/show_bug.cgi?id=514827 + +I have POP account in web.de +I would like to leave in server only 1 days, and older messages should be +deleted. +I tried to do this with the pop account preference setting: +x Leave messages on server +x Delete messages older than 1 days + +However, the messages are still kept in the server although it is more than +several days. + +Index: b/camel/providers/pop3/camel-pop3-folder.c +=================================================================== +--- a/camel/providers/pop3/camel-pop3-folder.c (revision 9476) ++++ b/camel/providers/pop3/camel-pop3-folder.c (working copy) +@@ -356,6 +356,48 @@ + camel_pop3_store_expunge (pop3_store, ex); + } + ++static gboolean ++pop3_get_message_time_from_cache (CamelFolder *folder, const char *uid, time_t *message_time) ++{ ++ CamelPOP3Store *pop3_store; ++ CamelStream *stream = NULL; ++ char buffer[1]; ++ gboolean res = FALSE; ++ ++ g_return_val_if_fail (folder != NULL, FALSE); ++ g_return_val_if_fail (uid != NULL, FALSE); ++ g_return_val_if_fail (message_time != NULL, FALSE); ++ ++ pop3_store = CAMEL_POP3_STORE (folder->parent_store); ++ ++ g_return_val_if_fail (pop3_store->cache != NULL, FALSE); ++ ++ if ((stream = camel_data_cache_get (pop3_store->cache, "cache", uid, NULL)) != NULL ++ && camel_stream_read (stream, buffer, 1) == 1 ++ && buffer[0] == '#') { ++ CamelMimeMessage *message; ++ ++ message = camel_mime_message_new (); ++ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, stream) == -1) { ++ g_warning (_("Cannot get message %s: %s"), uid, g_strerror (errno)); ++ camel_object_unref ((CamelObject *)message); ++ message = NULL; ++ } ++ ++ if (message) { ++ res = TRUE; ++ *message_time = message->date + message->date_offset; ++ ++ camel_object_unref ((CamelObject *)message); ++ } ++ } ++ ++ if (stream) { ++ camel_object_unref (stream); ++ } ++ return res; ++} ++ + int + camel_pop3_delete_old(CamelFolder *folder, int days_to_delete, CamelException *ex) + { +@@ -363,8 +405,7 @@ + CamelPOP3FolderInfo *fi; + int i; + CamelPOP3Store *pop3_store; +- time_t temp; +- CamelMessageInfo *minfo; ++ time_t temp, message_time; + + pop3_folder = CAMEL_POP3_FOLDER (folder); + pop3_store = CAMEL_POP3_STORE (CAMEL_FOLDER(pop3_folder)->parent_store); +@@ -374,10 +415,8 @@ + for (i = 0; i < pop3_folder->uids->len; i++) { + fi = pop3_folder->uids->pdata[i]; + +- minfo = camel_folder_get_message_info (folder, fi->uid); + d(printf("%s(%d): fi->uid=[%s]\n", __FILE__, __LINE__, fi->uid)); +- if(minfo) { +- time_t message_time = ((CamelMessageInfoBase *)minfo)->date_received; ++ if (pop3_get_message_time_from_cache (folder, fi->uid, &message_time)) { + double time_diff = difftime(temp,message_time); + int day_lag = time_diff/(60*60*24); + +@@ -407,8 +446,6 @@ + camel_data_cache_remove(pop3_store->cache, "cache", fi->uid, NULL); + } + } +- /* free message - not used anymore */ +- camel_folder_free_message_info (folder, minfo); + } + } + |