evolution-exchange r1792 - in trunk: . camel mail
- From: abharath svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-exchange r1792 - in trunk: . camel mail
- Date: Fri, 12 Sep 2008 07:29:21 +0000 (UTC)
Author: abharath
Date: Fri Sep 12 07:29:21 2008
New Revision: 1792
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1792&view=rev
Log:
2008-09-12 Bharath Acharya <abharath novell com>
** Fix for bug #546972
* camel/camel-exchange-folder.c: (refresh_info),
(camel_exchange_folder_add_message):
* camel/camel-stub-constants.h:
* mail/mail-stub-exchange.c: (class_init),
(refresh_folder_internal), (sync_count):
* mail/mail-stub.c: (connection_handler):
* mail/mail-stub.h:
Added SYNC_COUNT to sync up counts on the operations needed. Any
operations that need syncing could just update the counts from mfld->
counts maintained at the mail side. So Camel could just pick it up from
there.
Modified:
trunk/ChangeLog
trunk/camel/camel-exchange-folder.c
trunk/camel/camel-stub-constants.h
trunk/mail/mail-stub-exchange.c
trunk/mail/mail-stub.c
trunk/mail/mail-stub.h
Modified: trunk/camel/camel-exchange-folder.c
==============================================================================
--- trunk/camel/camel-exchange-folder.c (original)
+++ trunk/camel/camel-exchange-folder.c Fri Sep 12 07:29:21 2008
@@ -174,14 +174,28 @@
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
+ guint32 unread_count, visible_count;
if (camel_exchange_store_connected (store, ex)) {
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);
+ CAMEL_STUB_ARG_END);
+ }
+
+ /* sync up the counts now */
+ if (!camel_stub_send (exch->stub, ex, CAMEL_STUB_CMD_SYNC_COUNT,
+ CAMEL_STUB_ARG_FOLDER, folder->full_name,
+ CAMEL_STUB_ARG_RETURN,
+ CAMEL_STUB_ARG_UINT32, &unread_count,
+ CAMEL_STUB_ARG_UINT32, &visible_count,
+ CAMEL_STUB_ARG_END)){
+ g_print("\n Error syncing up the counts");
}
+
+ folder->summary->unread_count = unread_count;
+ folder->summary->visible_count = visible_count;
}
static void
@@ -708,6 +722,7 @@
CamelFolderChangeInfo *changes;
CamelStream *stream;
CamelMimeMessage *msg;
+ guint32 unread_count, visible_count;
info = camel_folder_summary_uid (folder->summary, uid);
if (info) {
@@ -747,6 +762,18 @@
camel_folder_summary_add (folder->summary, info);
+ if (!camel_stub_send (exch->stub, NULL, CAMEL_STUB_CMD_SYNC_COUNT,
+ CAMEL_STUB_ARG_FOLDER, folder->full_name,
+ CAMEL_STUB_ARG_RETURN,
+ CAMEL_STUB_ARG_UINT32, &unread_count,
+ CAMEL_STUB_ARG_UINT32, &visible_count,
+ CAMEL_STUB_ARG_END)){
+ g_print("\n Error syncing up the counts");
+ }
+
+ folder->summary->unread_count = unread_count;
+ folder->summary->visible_count = visible_count;
+
changes = camel_folder_change_info_new ();
camel_folder_change_info_add_uid (changes, uid);
camel_folder_change_info_recent_uid (changes, uid);
@@ -1034,7 +1061,7 @@
if (summary->len - camel_folder_summary_cache_size (folder->summary) > 50)
camel_folder_summary_reload_from_db (folder->summary, ex);
-
+
for (i = 0; i < summary->len; i++) {
uids->pdata[i] = g_strdup(summary->pdata[i]);
info = camel_folder_summary_uid (folder->summary, uids->pdata[i]);
@@ -1083,7 +1110,7 @@
camel_operation_end (NULL);
if (!ok)
return FALSE;
-
+
camel_folder_summary_save_to_db (folder->summary, ex);
}
Modified: trunk/camel/camel-stub-constants.h
==============================================================================
--- trunk/camel/camel-stub-constants.h (original)
+++ trunk/camel/camel-stub-constants.h Fri Sep 12 07:29:21 2008
@@ -18,6 +18,7 @@
CAMEL_STUB_CMD_GET_TRASH_NAME,
CAMEL_STUB_CMD_SYNC_FOLDER,
CAMEL_STUB_CMD_REFRESH_FOLDER,
+ CAMEL_STUB_CMD_SYNC_COUNT,
CAMEL_STUB_CMD_EXPUNGE_UIDS,
CAMEL_STUB_CMD_APPEND_MESSAGE,
CAMEL_STUB_CMD_SET_MESSAGE_FLAGS,
Modified: trunk/mail/mail-stub-exchange.c
==============================================================================
--- trunk/mail/mail-stub-exchange.c (original)
+++ trunk/mail/mail-stub-exchange.c Fri Sep 12 07:29:21 2008
@@ -95,6 +95,7 @@
static void get_trash_name (MailStub *stub);
static void sync_folder (MailStub *stub, const char *folder_name);
static void refresh_folder (MailStub *stub, const char *folder_name);
+static void sync_count (MailStub *stub, const char *folder_name);
static void refresh_folder_internal (MailStub *stub, MailStubExchangeFolder *mfld,
gboolean background);
static void sync_deletions (MailStubExchange *mse, MailStubExchangeFolder *mfld);
@@ -155,6 +156,7 @@
stub_class->get_trash_name = get_trash_name;
stub_class->sync_folder = sync_folder;
stub_class->refresh_folder = refresh_folder;
+ stub_class->sync_count = sync_count;
stub_class->expunge_uids = expunge_uids;
stub_class->append_message = append_message;
stub_class->set_message_flags = set_message_flags;
@@ -1527,6 +1529,33 @@
}
static void
+sync_count (MailStub *stub, const char *folder_name)
+{
+ MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub);
+ MailStubExchangeFolder *mfld;
+ guint32 unread_count = 0, visible_count = 0;
+
+ mfld = folder_from_name (mse, folder_name, 0, FALSE);
+ if (!mfld) {
+ mail_stub_return_data (stub, CAMEL_STUB_RETVAL_RESPONSE,
+ CAMEL_STUB_ARG_UINT32, unread_count,
+ CAMEL_STUB_ARG_UINT32, visible_count,
+ CAMEL_STUB_ARG_END);
+ mail_stub_return_ok (stub);
+ return;
+ }
+
+ unread_count = mfld->unread_count;
+ visible_count = mfld->messages->len;
+
+ mail_stub_return_data (stub, CAMEL_STUB_RETVAL_RESPONSE,
+ CAMEL_STUB_ARG_UINT32, unread_count,
+ CAMEL_STUB_ARG_UINT32, visible_count,
+ CAMEL_STUB_ARG_END);
+ mail_stub_return_ok (stub);
+}
+
+static void
refresh_folder (MailStub *stub, const char *folder_name)
{
MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub);
Modified: trunk/mail/mail-stub.c
==============================================================================
--- trunk/mail/mail-stub.c (original)
+++ trunk/mail/mail-stub.c Fri Sep 12 07:29:21 2008
@@ -170,6 +170,21 @@
break;
}
+ case CAMEL_STUB_CMD_SYNC_COUNT:
+ {
+ char *folder_name;
+
+ if (!mail_stub_read_args (stub,
+ CAMEL_STUB_ARG_FOLDER, &folder_name,
+ CAMEL_STUB_ARG_END))
+ goto comm_fail;
+ d(printf("SYNC_COUNT %s\n", folder_name));
+ g_object_ref (stub);
+ MS_CLASS (stub)->sync_count (stub, folder_name);
+ g_free (folder_name);
+ break;
+ }
+
case CAMEL_STUB_CMD_EXPUNGE_UIDS:
{
char *folder_name;
Modified: trunk/mail/mail-stub.h
==============================================================================
--- trunk/mail/mail-stub.h (original)
+++ trunk/mail/mail-stub.h Fri Sep 12 07:29:21 2008
@@ -42,6 +42,7 @@
void (*get_trash_name) (MailStub *);
void (*sync_folder) (MailStub *, const char *folder_name);
void (*refresh_folder) (MailStub *, const char *folder_name);
+ void (*sync_count) (MailStub *, const char *folder_name);
void (*expunge_uids) (MailStub *, const char *folder_name,
GPtrArray *uids);
void (*append_message) (MailStub *, const char *folder_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]