[evolution-data-server] IMAPX: Don't recheck flags before moving to real Junk/Trash.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] IMAPX: Don't recheck flags before moving to real Junk/Trash.
- Date: Wed, 19 Dec 2012 16:35:18 +0000 (UTC)
commit 395ea6359ca7a6f9026df29ffa56155372c4a106
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Dec 19 11:14:51 2012 -0500
IMAPX: Don't recheck flags before moving to real Junk/Trash.
Out of paranoia, I made imapx_folder_claim_move_to_real_trash_uids()
recheck that the queued message UIDs still had a DELETED flag before
moving them to a real Trash folder. That turned out to be breaking
things because we _remove_ the DELETED flag when synchronizing, so
it's not going to still be set when we're ready to move messages.
Remove the uncertainty and rename public functions to reflect this:
- camel_imapx_folder_maybe_move_to_real_junk()
+ camel_imapx_folder_add_move_to_real_junk()
- camel_imapx_folder_maybe_move_to_real_trash()
+ camel_imapx_folder_add_move_to_real_trash()
camel/camel-imapx-folder.c | 76 +++++++------------------------
camel/camel-imapx-folder.h | 4 +-
camel/camel-imapx-server.c | 4 +-
docs/reference/camel/camel-sections.txt | 4 +-
4 files changed, 22 insertions(+), 66 deletions(-)
---
diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c
index 6220be4..5ab3828 100644
--- a/camel/camel-imapx-folder.c
+++ b/camel/camel-imapx-folder.c
@@ -75,30 +75,12 @@ imapx_folder_claim_move_to_real_junk_uids (CamelIMAPXFolder *folder,
g_mutex_lock (&folder->priv->move_to_hash_table_lock);
keys = g_hash_table_get_keys (folder->priv->move_to_real_junk_uids);
- g_list_foreach (keys, (GFunc) camel_pstring_strdup, NULL);
- g_hash_table_remove_all (folder->priv->move_to_real_junk_uids);
+ g_hash_table_steal_all (folder->priv->move_to_real_junk_uids);
g_mutex_unlock (&folder->priv->move_to_hash_table_lock);
while (keys != NULL) {
- CamelMessageInfo *info;
- CamelMessageFlags flags = 0;
- const gchar *uid = keys->data;
-
- /* Recheck the message flags before adding to the array.
- * Skip the UID if it's not still flagged as junk. */
-
- info = camel_folder_summary_get (summary, uid);
- if (info != NULL) {
- flags = camel_message_info_flags (info);
- camel_message_info_free (info);
- }
-
- if (flags & CAMEL_MESSAGE_JUNK)
- g_ptr_array_add (out_uids_to_copy, (gpointer) uid);
- else
- camel_pstring_free (uid);
-
+ g_ptr_array_add (out_uids_to_copy, keys->data);
keys = g_list_delete_link (keys, keys);
}
}
@@ -115,30 +97,12 @@ imapx_folder_claim_move_to_real_trash_uids (CamelIMAPXFolder *folder,
g_mutex_lock (&folder->priv->move_to_hash_table_lock);
keys = g_hash_table_get_keys (folder->priv->move_to_real_trash_uids);
- g_list_foreach (keys, (GFunc) camel_pstring_strdup, NULL);
- g_hash_table_remove_all (folder->priv->move_to_real_trash_uids);
+ g_hash_table_steal_all (folder->priv->move_to_real_trash_uids);
g_mutex_unlock (&folder->priv->move_to_hash_table_lock);
while (keys != NULL) {
- CamelMessageInfo *info;
- CamelMessageFlags flags = 0;
- const gchar *uid = keys->data;
-
- /* Recheck the message flags before adding to the array.
- * Skip the UID if it's not still flagged as deleted. */
-
- info = camel_folder_summary_get (summary, uid);
- if (info != NULL) {
- flags = camel_message_info_flags (info);
- camel_message_info_free (info);
- }
-
- if (flags & CAMEL_MESSAGE_DELETED)
- g_ptr_array_add (out_uids_to_copy, (gpointer) uid);
- else
- camel_pstring_free (uid);
-
+ g_ptr_array_add (out_uids_to_copy, keys->data);
keys = g_list_delete_link (keys, keys);
}
}
@@ -1249,17 +1213,13 @@ camel_imapx_folder_set_quota_root_names (CamelIMAPXFolder *folder,
}
/**
- * camel_imapx_folder_maybe_move_to_real_junk:
+ * camel_imapx_folder_add_move_to_real_junk:
* @folder: a #CamelIMAPXFolder
* @message_uid: a message UID
*
- * Adds @message_uid to a pool of messages that may need to be moved to a
- * real junk folder the next time @folder is explicitly synchronized by way
- * of camel_folder_synchronize() or camel_folder_synchronize_sync().
- *
- * The message flags for @message_uid are double checked before moving the
- * message to make sure it's still flagged as junk; hence the "maybe" part
- * of the function name.
+ * Adds @message_uid to a pool of messages to be moved to a real junk
+ * folder the next time @folder is explicitly synchronized by way of
+ * camel_folder_synchronize() or camel_folder_synchronize_sync().
*
* This only applies when using a real folder to track junk messages,
* as specified by the #CamelIMAPXSettings:use-real-junk-path setting.
@@ -1267,8 +1227,8 @@ camel_imapx_folder_set_quota_root_names (CamelIMAPXFolder *folder,
* Since: 3.8
**/
void
-camel_imapx_folder_maybe_move_to_real_junk (CamelIMAPXFolder *folder,
- const gchar *message_uid)
+camel_imapx_folder_add_move_to_real_junk (CamelIMAPXFolder *folder,
+ const gchar *message_uid)
{
g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
g_return_if_fail (message_uid != NULL);
@@ -1283,17 +1243,13 @@ camel_imapx_folder_maybe_move_to_real_junk (CamelIMAPXFolder *folder,
}
/**
- * camel_imapx_folder_maybe_move_to_real_trash:
+ * camel_imapx_folder_add_move_to_real_trash:
* @folder: a #CamelIMAPXFolder
* @message_uid: a message UID
*
- * Adds @message_uid to a pool of messages that may need to be moved to a
- * real trash folder the next time @folder is explicitly synchronized by way
- * of camel_folder_synchronize() or camel_folder_synchronize_sync().
- *
- * The message flags for @message_uid are double checked before moving the
- * message to make sure it's still flagged as deleted; hence the "maybe" part
- * of the function name.
+ * Adds @message_uid to a pool of messages to be moved to a real trash
+ * folder the next time @folder is explicitly synchronized by way of
+ * camel_folder_synchronize() or camel_folder_synchronize_sync().
*
* This only applies when using a real folder to track deleted messages,
* as specified by the #CamelIMAPXSettings:use-real-trash-path setting.
@@ -1301,8 +1257,8 @@ camel_imapx_folder_maybe_move_to_real_junk (CamelIMAPXFolder *folder,
* Since: 3.8
**/
void
-camel_imapx_folder_maybe_move_to_real_trash (CamelIMAPXFolder *folder,
- const gchar *message_uid)
+camel_imapx_folder_add_move_to_real_trash (CamelIMAPXFolder *folder,
+ const gchar *message_uid)
{
g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
g_return_if_fail (message_uid != NULL);
diff --git a/camel/camel-imapx-folder.h b/camel/camel-imapx-folder.h
index ccc495b..f96f561 100644
--- a/camel/camel-imapx-folder.h
+++ b/camel/camel-imapx-folder.h
@@ -98,10 +98,10 @@ gchar ** camel_imapx_folder_dup_quota_root_names
void camel_imapx_folder_set_quota_root_names
(CamelIMAPXFolder *folder,
const gchar **quota_root_names);
-void camel_imapx_folder_maybe_move_to_real_junk
+void camel_imapx_folder_add_move_to_real_junk
(CamelIMAPXFolder *folder,
const gchar *message_uid);
-void camel_imapx_folder_maybe_move_to_real_trash
+void camel_imapx_folder_add_move_to_real_trash
(CamelIMAPXFolder *folder,
const gchar *message_uid);
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index e1d7a85..3e223c6 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -7333,11 +7333,11 @@ imapx_server_sync_changes (CamelIMAPXServer *is,
(flags & CAMEL_MESSAGE_DELETED);
if (move_to_real_junk)
- camel_imapx_folder_maybe_move_to_real_junk (
+ camel_imapx_folder_add_move_to_real_junk (
CAMEL_IMAPX_FOLDER (folder), uid);
if (move_to_real_trash)
- camel_imapx_folder_maybe_move_to_real_trash (
+ camel_imapx_folder_add_move_to_real_trash (
CAMEL_IMAPX_FOLDER (folder), uid);
if (flags != sflags) {
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 46813f0..09ed1b3 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -796,8 +796,8 @@ CamelIMAPXFolder
camel_imapx_folder_new
camel_imapx_folder_dup_quota_root_names
camel_imapx_folder_set_quota_root_names
-camel_imapx_folder_maybe_move_to_real_junk
-camel_imapx_folder_maybe_move_to_real_trash
+camel_imapx_folder_add_move_to_real_junk
+camel_imapx_folder_add_move_to_real_trash
<SUBSECTION Standard>
CAMEL_IMAPX_FOLDER
CAMEL_IS_IMAPX_FOLDER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]