[evolution-data-server/meego-eds: 46/47] Fix IMAPX folderinfo to show server's unread count.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/meego-eds: 46/47] Fix IMAPX folderinfo to show server's unread count.
- Date: Wed, 15 Jun 2011 10:57:09 +0000 (UTC)
commit 216bc31b3855310d26680dd03fb533192f70e15e
Author: Srinivasa Ragavan <srini linux intel com>
Date: Wed Jun 15 01:18:24 2011 +0300
Fix IMAPX folderinfo to show server's unread count.
camel/providers/imapx/camel-imapx-server.c | 32 ++++++++++++++++++++++++++-
camel/providers/imapx/camel-imapx-utils.c | 5 +++-
2 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 16620ab..242e64f 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3865,7 +3865,8 @@ imapx_job_scan_changes_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
/* There's no sane way to get the server-side unseen count on the
select mailbox. So just work it out from the flags */
- ((CamelIMAPXFolder *)job->folder)->unread_on_server = job->folder->summary->unread_count;
+ if (!is->mobile)
+ ((CamelIMAPXFolder *)job->folder)->unread_on_server = job->folder->summary->unread_count;
g_array_free(job->u.refresh_info.infos, TRUE);
imapx_job_done (is, job);
@@ -4142,6 +4143,32 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
(!is_selected && isum->modseq != ifolder->modseq_on_server))
need_rescan = TRUE;
+ } else if (is->mobile) {
+ /* We need to issue Status command to get the total unread count */
+ CamelIMAPXCommand *ic;
+
+ ic = camel_imapx_command_new (is, "STATUS", NULL, "STATUS %f (MESSAGES UNSEEN UIDVALIDITY UIDNEXT)", folder);
+
+ ic->job = job;
+ ic->pri = job->pri;
+
+ imapx_command_run_sync (is, ic);
+
+ if (ic->error != NULL || ic->status->result != IMAPX_OK) {
+ if (ic->error == NULL)
+ g_set_error (
+ &job->error, CAMEL_IMAPX_ERROR, 1,
+ "Error refreshing folder: %s", ic->status->text);
+ else {
+ g_propagate_error (&job->error, ic->error);
+ ic->error = NULL;
+ }
+
+ camel_imapx_command_free (ic);
+ goto done;
+ }
+ camel_imapx_command_free (ic);
+
}
if (is->use_qresync && isum->modseq && ifolder->uidvalidity_on_server)
@@ -4627,7 +4654,8 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
if (si) {
if (si->total != job->folder->summary->saved_count || si->unread != job->folder->summary->unread_count) {
si->total = job->folder->summary->saved_count;
- si->unread = job->folder->summary->unread_count;
+ if (!is->mobile) /* Don't mess with server's unread count */
+ si->unread = job->folder->summary->unread_count;
camel_store_summary_touch ((CamelStoreSummary *)((CamelIMAPXStore *) parent_store)->summary);
}
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 1e89cf1..4b9a621 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -407,7 +407,10 @@ imapx_update_store_summary (CamelFolder *folder)
unread = folder->summary->unread_count;
if (si->unread != unread || si->total != total) {
- si->unread = unread;
+ if (!camel_url_get_param (((CamelService *)parent_store)->url, "mobile"))
+ si->unread = unread;
+ else
+ si->unread = ((CamelIMAPXFolder *)folder)->unread_on_server;
si->total = total;
camel_store_summary_touch ((CamelStoreSummary *)((CamelIMAPXStore *) parent_store)->summary);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]