[evolution-patches] 73498/72968 Connector Mail Offline



Missing patch from Jeff.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.296
diff -u -r1.296 ChangeLog
--- ChangeLog	11 Mar 2005 14:58:26 -0000	1.296
+++ ChangeLog	15 Mar 2005 15:40:32 -0000
@@ -1,3 +1,14 @@
+2005-03-14  Jeffrey Stedfast  <fejj novell com>
+
+	* camel/camel-exchange-folder.c (camel_exchange_folder_construct):
+	Set the state file path and load it. Fixes bug #73498.
+	(transfer_messages_to): Updated to use journal_append().
+	(refresh_info): Replay the journal here. Fixes bug #72968.
+
+	* camel/camel-exchange-journal.c (exchange_entry_play_transfer):
+	Removed (not used).
+	(camel_exchange_journal_transfer): Removed.
+
 2005-03-11  Sushma Rai  <rsushma novell com>
 
 	* addressbook/e-book-backend-exchange.c (func_match): Handling the
Index: camel/camel-exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-folder.c,v
retrieving revision 1.15
diff -u -r1.15 camel-exchange-folder.c
--- camel/camel-exchange-folder.c	28 Feb 2005 15:20:39 -0000	1.15
+++ camel/camel-exchange-folder.c	15 Mar 2005 15:40:32 -0000
@@ -50,7 +50,6 @@
 /* Returns the class for a CamelFolder */
 #define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
-static void refresh_info (CamelFolder *folder, CamelException *ex);
 static void folder_sync (CamelFolder *folder, gboolean expunge,
 			 CamelException *ex);
 static void exchange_expunge (CamelFolder *folder, CamelException *ex);
@@ -81,7 +80,7 @@
 					      GPtrArray **transferred_uids,
 					      gboolean delete_originals,
 					      CamelException *ex);
-static void exchange_refresh_info (CamelFolder *folder, CamelException *ex);
+static void refresh_info (CamelFolder *folder, CamelException *ex);
 static void exchange_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
 
 static void
@@ -98,7 +97,7 @@
 	camel_folder_class->search_by_uids = search_by_uids;
 	camel_folder_class->search_free = search_free;
 	camel_folder_class->transfer_messages_to = transfer_messages_to;
-	camel_folder_class->refresh_info = exchange_refresh_info;
+	camel_folder_class->refresh_info = refresh_info;
 	camel_folder_class->sync = exchange_sync;
 }
 
@@ -198,7 +197,9 @@
 refresh_info (CamelFolder *folder, CamelException *ex)
 {
 	CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
-
+	
+	camel_offline_journal_replay (exch->journal, NULL);
+	
 	camel_stub_send (exch->stub, ex, CAMEL_STUB_CMD_REFRESH_FOLDER,
 			 CAMEL_STUB_ARG_FOLDER, folder->full_name,
 			 CAMEL_STUB_ARG_END);
@@ -617,9 +618,8 @@
 			
 			if (!(message = get_message (source, camel_message_info_uid (info), ex)))
 				break;
-
-			camel_exchange_journal_transfer (journal, (CamelExchangeFolder *)source, 
-							message, info, uids->pdata[i], NULL, ex);
+			
+			camel_exchange_journal_append (journal, message, info, NULL, ex);
 			camel_object_unref (message);
 
 			if (camel_exception_is_set (ex))
@@ -627,7 +627,7 @@
 			
 			if (delete_originals)
 				camel_folder_set_message_flags (source, camel_message_info_uid (info),
-					CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
+								CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
 		}
 		goto end;
  	}
@@ -920,7 +920,7 @@
 {
 	CamelExchangeFolder *exch = (CamelExchangeFolder *)folder;
 	const char *short_name;
-	char *summary_file, *journal_file;
+	char *summary_file, *journal_file, *path;
 	GPtrArray *summary, *uids;
 	GByteArray *flags;
 	guint32 folder_flags;
@@ -1041,14 +1041,13 @@
 
 	if (camel_exchange_summary_get_readonly (folder->summary))
 		folder->permanent_flags = 0;
-
+	
+	path = g_build_filename (folder_dir, "cmeta", NULL);
+	camel_object_set (folder, NULL, CAMEL_OBJECT_STATE_FILE, path, NULL);
+	g_free (path);
+	camel_object_state_read (folder);
+	
 	return TRUE;
-}
-
-static void 
-exchange_refresh_info (CamelFolder *folder, CamelException *ex)
-{
-	refresh_info (folder, ex);
 }
 
 static void 
Index: camel/camel-exchange-journal.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-journal.c,v
retrieving revision 1.2
diff -u -r1.2 camel-exchange-journal.c
--- camel/camel-exchange-journal.c	24 Jan 2005 14:22:38 -0000	1.2
+++ camel/camel-exchange-journal.c	15 Mar 2005 15:40:32 -0000
@@ -109,8 +109,6 @@
 	CamelExchangeJournalEntry *exchange_entry = (CamelExchangeJournalEntry *) entry;
 	
 	g_free (exchange_entry->uid);
-	g_free (exchange_entry->original_uid);
-	g_free (exchange_entry->folder_name);
 	g_free (exchange_entry);
 }
 
@@ -130,14 +128,6 @@
 			goto exception;
 		
 		break;
-	case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
-		if (camel_file_util_decode_string (in, &entry->uid) == -1)
-			goto exception;
-		if (camel_file_util_decode_string (in, &entry->original_uid) == -1)
-			goto exception;
-		if (camel_file_util_decode_string (in, &entry->folder_name) == -1)
-			goto exception;
-		break;
 	default:
 		goto exception;
 	}
@@ -146,9 +136,6 @@
 	
  exception:
 	
-	if (entry->type == CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER)
-		g_free (entry->folder_name);
-
 	g_free (entry->uid);
 	g_free (entry);
 	
@@ -168,13 +155,6 @@
 		if (camel_file_util_encode_string (out, exchange_entry->uid))
 			return -1;
 		break;
-	case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
-		if (camel_file_util_encode_string (out, exchange_entry->uid))
-			return -1;
-		if (camel_file_util_encode_string (out, exchange_entry->original_uid))
-			return -1;
-		if (camel_file_util_encode_string (out, exchange_entry->folder_name))
-			return -1;
 	default:
 		g_assert_not_reached ();
 	}
@@ -239,61 +219,6 @@
 	return 0;
 }
 
-static int 
-exchange_entry_play_transfer (CamelOfflineJournal *journal, CamelExchangeJournalEntry *entry, CamelException *ex)
-{
-	CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
-	CamelFolder *folder = journal->folder;
-	CamelExchangeMessageInfo *real;
-	CamelMessageInfoBase *info;
-	GPtrArray *xuids, *uids;
-	CamelException lex;
-	CamelFolder *src;
-
-	if (!(info = (CamelMessageInfoBase *) camel_folder_summary_uid (folder->summary, entry->uid))) {
-		/* Note: this should never happen, but rather than crash lets make a new info */
-		info = camel_message_info_new (NULL);
-	}
-
-	if (entry->folder_name && (src = camel_store_get_folder (folder->parent_store, folder->name, 0, ex))) {
-		uids = g_ptr_array_sized_new (1);
-		g_ptr_array_add (uids, entry->original_uid);
-
-		camel_exception_init (&lex);
-		camel_folder_transfer_messages_to (src, uids, folder, &xuids, FALSE, &lex);
-		if (!camel_exception_is_set (&lex)) {
-			real = (CamelExchangeMessageInfo *) camel_folder_summary_uid (folder->summary, xuids->pdata[0]);
-		
-			/* Transfer flags and uids */
-			exchange_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
-			camel_message_info_free (real);
-		} else {
-			camel_exception_xfer (ex, &lex);
-			goto exception;
-		}
-
-		g_ptr_array_free (xuids, TRUE);
-		g_ptr_array_free (uids, TRUE);
-		camel_object_unref (src);
-	} else if (!entry->folder_name) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("No folder name found\n"));
-		goto exception;
-	}
-
-	/* message was successfully transferred, remove the fake item from the cache/summary */
-	camel_folder_summary_remove_uid (folder->summary, entry->uid);
-	camel_data_cache_remove (exchange_folder->cache, "cache", entry->uid, NULL);
-	camel_message_info_free (info);
-
-	return 0;
-
-exception:
-	
-	camel_message_info_free (info);
-
-	return -1;
-}
-
 static int
 exchange_entry_play (CamelOfflineJournal *journal, EDListNode *entry, CamelException *ex)
 {
@@ -302,8 +227,6 @@
 	switch (exchange_entry->type) {
 	case CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND:
 		return exchange_entry_play_append (journal, exchange_entry, ex);
-	case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
-		return exchange_entry_play_transfer (journal, exchange_entry, ex);
 	default:
 		g_assert_not_reached ();
 		return -1;
@@ -383,7 +306,7 @@
 
 void
 camel_exchange_journal_append (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
-			    const CamelMessageInfo *mi, char **appended_uid, CamelException *ex)
+			       const CamelMessageInfo *mi, char **appended_uid, CamelException *ex)
 {
 	CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
 	CamelExchangeJournalEntry *entry;
@@ -402,28 +325,3 @@
 		*appended_uid = g_strdup (uid);
 
 }
-
-void 
-camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal, CamelExchangeFolder *source_folder,
-				CamelMimeMessage *message, const CamelMessageInfo *mi,
-				const char *original_uid, char **transferred_uid, CamelException *ex)
-{
-	CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
-	CamelExchangeJournalEntry *entry;
-	char *uid;
-	
-	if (!update_cache (exchange_journal, message, mi, &uid, ex))
-		return;
-
-	entry = g_new (CamelExchangeJournalEntry, 1);
-	entry->type = CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER;
-	entry->uid = uid;
-	entry->original_uid = g_strdup (original_uid);
-	entry->folder_name = g_strdup (((CamelFolder *)source_folder)->name);
-
-	e_dlist_addtail (&journal->queue, (EDListNode *) entry);
-	
-	if (transferred_uid)
-		*transferred_uid = g_strdup (uid);	
-}
-
Index: camel/camel-exchange-journal.h
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-journal.h,v
retrieving revision 1.2
diff -u -r1.2 camel-exchange-journal.h
--- camel/camel-exchange-journal.h	24 Jan 2005 14:22:38 -0000	1.2
+++ camel/camel-exchange-journal.h	15 Mar 2005 15:40:32 -0000
@@ -50,7 +50,6 @@
 
 enum {
 	CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND,
-	CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER
 };
 
 struct _CamelExchangeJournalEntry {
@@ -59,8 +58,6 @@
 	int type;
 
 	char *uid;
-	char *original_uid;
-	char *folder_name;
 };
 
 struct _CamelExchangeJournal {
@@ -80,11 +77,7 @@
 
 /* interfaces for adding a journal entry */
 void camel_exchange_journal_append (CamelExchangeJournal *journal, CamelMimeMessage *message, 
-				const CamelMessageInfo *mi, char **appended_uid, CamelException *ex);
-
-void camel_exchange_journal_transfer (CamelExchangeJournal *journal, CamelExchangeFolder *source_folder, 
-				CamelMimeMessage *message, const CamelMessageInfo *mi, const char *original_uid,
-				char **transferred_uid, CamelException *ex);
+				    const CamelMessageInfo *mi, char **appended_uid, CamelException *ex);
 
 #ifdef __cplusplus
 }


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