[evolution-data-server/gnome-2-30] Bug 627627 - Evolution not saving mail labels



commit f139459ad2e1b67912fa0f4b68c641f265473aa4
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue Aug 31 17:44:51 2010 +0530

    Bug 627627 - Evolution not saving mail labels

 camel/providers/imapx/camel-imapx-server.c |   15 +++++++--------
 camel/providers/imapx/camel-imapx-utils.c  |   13 +++++++------
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 161ceb7..1618779 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -4265,20 +4265,19 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 		gint i;
 
 		for (i=0;i<job->u.sync_changes.changed_uids->len;i++) {
-			CamelIMAPXMessageInfo *info = (CamelIMAPXMessageInfo *) camel_folder_summary_uid (job->folder->summary,
+			CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) camel_folder_summary_uid (job->folder->summary,
 					job->u.sync_changes.changed_uids->pdata[i]);
 
-			if (!info)
+			if (!xinfo)
 				continue;
 
-			info->server_flags = ((CamelMessageInfoBase *)info)->flags & CAMEL_IMAPX_SERVER_FLAGS;
-			info->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-			info->info.dirty = TRUE;
+			xinfo->server_flags = ((CamelMessageInfoBase *)xinfo)->flags & CAMEL_IMAPX_SERVER_FLAGS;
+			xinfo->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
+			xinfo->info.dirty = TRUE;
+			camel_flag_list_copy (&xinfo->server_user_flags, &xinfo->info.user_flags);
 
 			camel_folder_summary_touch (job->folder->summary);
-			camel_message_info_free (info);
-
-			/* FIXME: move over user flags too */
+			camel_message_info_free (xinfo);
 		}
 		/* Apply the changes to server-side unread count; it won't tell
 		   us of these changes, of course. */
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 0157bbc..f77ed3a 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -89,7 +89,7 @@ imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fl
 {
 	gint tok, i;
 	guint len;
-	guchar *token, *p, c;
+	guchar *token;
 	guint32 flags = 0;
 
 	*flagsp = flags;
@@ -99,12 +99,10 @@ imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fl
 		do {
 			tok = camel_imapx_stream_token(stream, &token, &len, ex);
 			if (tok == IMAPX_TOK_TOKEN || tok == IMAPX_TOK_INT) {
-				p = token;
-				// FIXME: ascii_toupper
-				while ((c=*p))
-					*p++ = toupper(c);
+				gchar *upper = g_ascii_strup ((gchar *) token, len);
+
 				for (i = 0; i < G_N_ELEMENTS (flag_table); i++)
-					if (!strcmp((gchar *)token, flag_table[i].name)) {
+					if (!strcmp(upper, flag_table[i].name)) {
 						flags |= flag_table[i].flag;
 						goto found;
 					}
@@ -116,6 +114,7 @@ imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fl
 				}
 			found:
 				tok = tok; /* fixes stupid warning */
+				g_free (upper);
 			} else if (tok != ')') {
 				camel_exception_set (ex, 1, "expecting flag");
 				return;
@@ -221,12 +220,14 @@ imapx_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags)
 {
 	gboolean changed = FALSE;
 	CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
+	CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
 	gboolean set_cal = FALSE;
 
 	if (camel_flag_get (&binfo->user_flags, "$has_cal"))
 		set_cal = TRUE;
 
 	changed = camel_flag_list_copy(&binfo->user_flags, &server_user_flags);
+	camel_flag_list_copy (&xinfo->server_user_flags, &server_user_flags);
 
 	/* reset the calendar flag if it was set in messageinfo before */
 	if (set_cal)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]