[evolution-data-server/gnome-2-32] Bug #638948 - NNTP folder doesn't implement Expunge
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] Bug #638948 - NNTP folder doesn't implement Expunge
- Date: Tue, 11 Jan 2011 10:41:41 +0000 (UTC)
commit 2d0f4a345e6b228171cbbd3e5b4cca1af04e6695
Author: Milan Crha <mcrha redhat com>
Date: Tue Jan 11 11:41:14 2011 +0100
Bug #638948 - NNTP folder doesn't implement Expunge
camel/camel-disco-folder.c | 13 +++++++++++++
camel/providers/nntp/camel-nntp-folder.c | 29 +++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c
index 0fdb9a3..825a59d 100644
--- a/camel/camel-disco-folder.c
+++ b/camel/camel-disco-folder.c
@@ -173,6 +173,7 @@ disco_refresh_info (CamelFolder *folder,
return TRUE;
disco_folder_class = CAMEL_DISCO_FOLDER_GET_CLASS (folder);
+ g_return_val_if_fail (disco_folder_class->refresh_info_online != NULL, FALSE);
success = disco_folder_class->refresh_info_online (folder, error);
CAMEL_CHECK_GERROR (folder, refresh_info_online, success, error);
@@ -199,16 +200,19 @@ disco_sync (CamelFolder *folder,
switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
case CAMEL_DISCO_STORE_ONLINE:
+ g_return_val_if_fail (disco_folder_class->sync_online != NULL, FALSE);
success = disco_folder_class->sync_online (folder, error);
CAMEL_CHECK_GERROR (folder, sync_online, success, error);
return success;
case CAMEL_DISCO_STORE_OFFLINE:
+ g_return_val_if_fail (disco_folder_class->sync_offline != NULL, FALSE);
success = disco_folder_class->sync_offline (folder, error);
CAMEL_CHECK_GERROR (folder, sync_offline, success, error);
return success;
case CAMEL_DISCO_STORE_RESYNCING:
+ g_return_val_if_fail (disco_folder_class->sync_resyncing != NULL, FALSE);
success = disco_folder_class->sync_resyncing (folder, error);
CAMEL_CHECK_GERROR (folder, sync_resyncing, success, error);
return success;
@@ -234,6 +238,7 @@ disco_expunge_uids (CamelFolder *folder,
switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
case CAMEL_DISCO_STORE_ONLINE:
+ g_return_val_if_fail (disco_folder_class->expunge_uids_online != NULL, FALSE);
success = disco_folder_class->expunge_uids_online (
folder, uids, error);
CAMEL_CHECK_GERROR (
@@ -241,6 +246,7 @@ disco_expunge_uids (CamelFolder *folder,
return success;
case CAMEL_DISCO_STORE_OFFLINE:
+ g_return_val_if_fail (disco_folder_class->expunge_uids_offline != NULL, FALSE);
success = disco_folder_class->expunge_uids_offline (
folder, uids, error);
CAMEL_CHECK_GERROR (
@@ -248,6 +254,7 @@ disco_expunge_uids (CamelFolder *folder,
return success;
case CAMEL_DISCO_STORE_RESYNCING:
+ g_return_val_if_fail (disco_folder_class->expunge_uids_resyncing != NULL, FALSE);
success = disco_folder_class->expunge_uids_resyncing (
folder, uids, error);
CAMEL_CHECK_GERROR (
@@ -303,18 +310,21 @@ disco_append_message (CamelFolder *folder,
switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
case CAMEL_DISCO_STORE_ONLINE:
+ g_return_val_if_fail (disco_folder_class->append_online != NULL, FALSE);
success = disco_folder_class->append_online (
folder, message, info, appended_uid, error);
CAMEL_CHECK_GERROR (folder, append_online, success, error);
return success;
case CAMEL_DISCO_STORE_OFFLINE:
+ g_return_val_if_fail (disco_folder_class->append_offline != NULL, FALSE);
success = disco_folder_class->append_offline (
folder, message, info, appended_uid, error);
CAMEL_CHECK_GERROR (folder, append_offline, success, error);
return success;
case CAMEL_DISCO_STORE_RESYNCING:
+ g_return_val_if_fail (disco_folder_class->append_resyncing != NULL, FALSE);
success = disco_folder_class->append_resyncing (
folder, message, info, appended_uid, error);
CAMEL_CHECK_GERROR (folder, append_resyncing, success, error);
@@ -341,6 +351,7 @@ disco_transfer_messages_to (CamelFolder *source,
switch (camel_disco_store_status (CAMEL_DISCO_STORE (parent_store))) {
case CAMEL_DISCO_STORE_ONLINE:
+ g_return_val_if_fail (disco_folder_class->transfer_online != NULL, FALSE);
success = disco_folder_class->transfer_online (
source, uids, dest, transferred_uids,
delete_originals, error);
@@ -348,6 +359,7 @@ disco_transfer_messages_to (CamelFolder *source,
return success;
case CAMEL_DISCO_STORE_OFFLINE:
+ g_return_val_if_fail (disco_folder_class->transfer_offline != NULL, FALSE);
success = disco_folder_class->transfer_offline (
source, uids, dest, transferred_uids,
delete_originals, error);
@@ -355,6 +367,7 @@ disco_transfer_messages_to (CamelFolder *source,
return success;
case CAMEL_DISCO_STORE_RESYNCING:
+ g_return_val_if_fail (disco_folder_class->transfer_resyncing != NULL, FALSE);
success = disco_folder_class->transfer_resyncing (
source, uids, dest, transferred_uids,
delete_originals, error);
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 15edc20..949a7d3 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -562,6 +562,32 @@ nntp_folder_transfer_message (CamelFolder *source,
return FALSE;
}
+static gboolean
+nntp_folder_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, GError **error)
+{
+ CamelFolderChangeInfo *changes;
+ gint ii;
+
+ g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_val_if_fail (CAMEL_IS_NNTP_FOLDER (folder), FALSE);
+ g_return_val_if_fail (uids != NULL, FALSE);
+ g_return_val_if_fail (folder->summary != NULL, FALSE);
+
+ /* can only remove deleted messages from a local cache */
+
+ changes = camel_folder_change_info_new ();
+ for (ii = 0; ii < uids->len; ii++) {
+ camel_folder_summary_remove_uid (folder->summary, uids->pdata[ii]);
+ camel_folder_change_info_remove_uid (changes, uids->pdata[ii]);
+ }
+
+ camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_changed (folder, changes);
+ camel_folder_change_info_free (changes);
+
+ return TRUE;
+}
+
static void
camel_nntp_folder_class_init (CamelNNTPFolderClass *class)
{
@@ -595,6 +621,9 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *class)
disco_folder_class->transfer_resyncing = nntp_folder_transfer_message;
disco_folder_class->transfer_offline = nntp_folder_transfer_message;
disco_folder_class->refresh_info_online = nntp_folder_refresh_info_online;
+ disco_folder_class->expunge_uids_online = nntp_folder_expunge_uids_offline;
+ disco_folder_class->expunge_uids_offline = nntp_folder_expunge_uids_offline;
+ disco_folder_class->expunge_uids_resyncing = nntp_folder_expunge_uids_offline;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]