evolution-data-server r10050 - trunk/camel/providers/imap
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r10050 - trunk/camel/providers/imap
- Date: Thu, 12 Feb 2009 10:28:49 +0000 (UTC)
Author: mcrha
Date: Thu Feb 12 10:28:49 2009
New Revision: 10050
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10050&view=rev
Log:
2009-02-12 Milan Crha <mcrha redhat com>
** Fix for bug #534938
* camel-imap-private.h: (struct _CamelImapFolderPrivate): New property.
* camel-imap-folder.c: (camel_imap_folder_init), (imap_finalize),
(imap_folder_add_ignore_recent), (imap_folder_uid_in_ignore_recent),
(do_append), (handle_copyuid), (imap_update_summary):
Remember which IDs we added to the folder and ignore these in report
of recent messages, because we know about them already.
Modified:
trunk/camel/providers/imap/ChangeLog
trunk/camel/providers/imap/camel-imap-folder.c
trunk/camel/providers/imap/camel-imap-private.h
Modified: trunk/camel/providers/imap/camel-imap-folder.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-folder.c (original)
+++ trunk/camel/providers/imap/camel-imap-folder.c Thu Feb 12 10:28:49 2009
@@ -199,6 +199,7 @@
g_static_mutex_init(&imap_folder->priv->search_lock);
g_static_rec_mutex_init(&imap_folder->priv->cache_lock);
#endif
+ imap_folder->priv->ignore_recent = NULL;
imap_folder->journal = NULL;
imap_folder->need_rescan = TRUE;
@@ -450,6 +451,8 @@
g_static_mutex_free(&imap_folder->priv->search_lock);
g_static_rec_mutex_free(&imap_folder->priv->cache_lock);
#endif
+ if (imap_folder->priv->ignore_recent)
+ g_hash_table_unref (imap_folder->priv->ignore_recent);
if (imap_folder->journal) {
camel_offline_journal_write (imap_folder->journal, NULL);
@@ -1861,6 +1864,27 @@
g_free (uid);
}
+static void
+imap_folder_add_ignore_recent (CamelImapFolder *imap_folder, const char *uid)
+{
+ g_return_if_fail (imap_folder != NULL);
+ g_return_if_fail (uid != NULL);
+
+ if (!imap_folder->priv->ignore_recent)
+ imap_folder->priv->ignore_recent = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
+
+ g_hash_table_insert (imap_folder->priv->ignore_recent, g_strdup (uid), GINT_TO_POINTER (1));
+}
+
+static gboolean
+imap_folder_uid_in_ignore_recent (CamelImapFolder *imap_folder, const char *uid)
+{
+ g_return_val_if_fail (imap_folder != NULL, FALSE);
+ g_return_val_if_fail (uid != NULL, FALSE);
+
+ return imap_folder->priv->ignore_recent && g_hash_table_lookup (imap_folder->priv->ignore_recent, uid);
+}
+
static CamelImapResponse *
do_append (CamelFolder *folder, CamelMimeMessage *message,
const CamelMessageInfo *info, char **uid,
@@ -1957,6 +1981,9 @@
}
} else
*uid = NULL;
+
+ if (*uid)
+ imap_folder_add_ignore_recent (CAMEL_IMAP_FOLDER (folder), *uid);
return response2;
}
@@ -2152,6 +2179,8 @@
camel_imap_message_cache_copy (scache, src->pdata[i],
dcache, dest->pdata[i],
NULL);
+
+ imap_folder_add_ignore_recent (CAMEL_IMAP_FOLDER (destination), dest->pdata[i]);
}
CAMEL_IMAP_FOLDER_REC_UNLOCK (source, cache_lock);
CAMEL_IMAP_FOLDER_REC_UNLOCK (destination, cache_lock);
@@ -3573,15 +3602,22 @@
update_summary (folder->summary, (CamelMessageInfoBase *)mi);
camel_folder_change_info_add_uid (changes, camel_message_info_uid (mi));
- /* report all new messages as recent, even without that flag, thus new
- messages will be filtered even after saw by other software earlier */
- if ((mi->info.flags & CAMEL_IMAP_MESSAGE_RECENT) != 0 || getenv ("FILTER_RECENT") == NULL)
+ /* Report all new messages as recent, even without that flag, thus new
+ messages will be filtered even after saw by other software earlier.
+ Only skip those which we added ourself, like after drag&drop to this folder. */
+ if (!imap_folder_uid_in_ignore_recent (imap_folder, camel_message_info_uid (mi))
+ && ((mi->info.flags & CAMEL_IMAP_MESSAGE_RECENT) != 0 || getenv ("FILTER_RECENT") == NULL))
camel_folder_change_info_recent_uid (changes, camel_message_info_uid (mi));
}
g_ptr_array_free (messages, TRUE);
-
+
+ if (imap_folder->priv->ignore_recent) {
+ g_hash_table_unref (imap_folder->priv->ignore_recent);
+ imap_folder->priv->ignore_recent = NULL;
+ }
+
return;
lose:
@@ -3599,6 +3635,11 @@
}
g_ptr_array_free (messages, TRUE);
}
+
+ if (imap_folder->priv->ignore_recent) {
+ g_hash_table_unref (imap_folder->priv->ignore_recent);
+ imap_folder->priv->ignore_recent = NULL;
+ }
}
/* Called with the store's connect_lock locked */
Modified: trunk/camel/providers/imap/camel-imap-private.h
==============================================================================
--- trunk/camel/providers/imap/camel-imap-private.h (original)
+++ trunk/camel/providers/imap/camel-imap-private.h Thu Feb 12 10:28:49 2009
@@ -15,6 +15,7 @@
GStaticMutex search_lock; /* for locking the search object */
GStaticRecMutex cache_lock; /* for locking the cache object */
#endif
+ GHashTable *ignore_recent; /* hash table of UIDs to ignore as recent when updating folder */
};
#ifdef ENABLE_THREADS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]