evolution-data-server r8929 - trunk/camel/providers/imap
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8929 - trunk/camel/providers/imap
- Date: Thu, 5 Jun 2008 10:04:25 +0000 (UTC)
Author: mcrha
Date: Thu Jun 5 10:04:25 2008
New Revision: 8929
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8929&view=rev
Log:
2008-06-05 Milan Crha <mcrha redhat com>
** Fix for bug #530241
* camel-imap-folder.c: (imap_sync_online): Recognize no-flag situation
properly and in that case use two commands, one set and one unset,
because we do not track previously set user flags.
Modified:
trunk/camel/providers/imap/ChangeLog
trunk/camel/providers/imap/camel-imap-folder.c
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 Jun 5 10:04:25 2008
@@ -1124,12 +1124,10 @@
imap_sync_online (CamelFolder *folder, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response = NULL;
CamelImapMessageInfo *info;
CamelException local_ex;
GPtrArray *matches;
char *set, *flaglist;
- gboolean unset;
int i, j, max;
if (folder->permanent_flags == 0) {
@@ -1146,6 +1144,9 @@
*/
max = camel_folder_summary_count (folder->summary);
for (i = 0; i < max; i++) {
+ gboolean unset = FALSE;
+ CamelImapResponse *response = NULL;
+
if (!(info = (CamelImapMessageInfo *)camel_folder_summary_index (folder->summary, i)))
continue;
@@ -1154,11 +1155,6 @@
continue;
}
- /* Note: Cyrus is broken and will not accept an
- empty-set of flags so... if this is true then we
- want to unset the previously set flags.*/
- unset = !(info->info.flags & folder->permanent_flags);
-
/* Note: get_matching() uses UID_SET_LIMIT to limit
the size of the uid-set string. We don't have to
loop here to flush all the matching uids because
@@ -1176,15 +1172,32 @@
break;
}
- /* FIXME: since we don't know the previously set flags,
- if unset is TRUE then just unset all the flags? */
- /* FIXME: Sankar: What about custom flags ? */
- flaglist = imap_create_flag_list (unset ? folder->permanent_flags : info->info.flags & folder->permanent_flags, (CamelMessageInfo *)info, folder->permanent_flags);
+ flaglist = imap_create_flag_list (info->info.flags & folder->permanent_flags, (CamelMessageInfo *)info, folder->permanent_flags);
+
+ if (strcmp (flaglist, "()") == 0) {
+ /* Note: Cyrus is broken and will not accept an
+ empty-set of flags so... if this is true then we
+ set and unset \Seen flag. It's necessary because
+ we do not know the previously set user flags. */
+ unset = TRUE;
+ g_free (flaglist);
+ flaglist = strdup ("(\\Seen)");
+
+ response = camel_imap_command (store, folder, &local_ex,
+ "UID STORE %s FLAGS.SILENT %s",
+ set, flaglist);
+ if (response)
+ camel_imap_response_free (store, response);
+
+ response = NULL;
+ }
/* Note: to 'unset' flags, use -FLAGS.SILENT (<flag list>) */
- response = camel_imap_command (store, folder, &local_ex,
+ if (!camel_exception_is_set (&local_ex))
+ response = camel_imap_command (store, folder, &local_ex,
"UID STORE %s %sFLAGS.SILENT %s",
set, unset ? "-" : "", flaglist);
+
g_free (set);
g_free (flaglist);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]