aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-10-25 02:49:30 +0800
committerDan Winship <danw@src.gnome.org>2000-10-25 02:49:30 +0800
commit5795833acac5ff6d1d2332b28390238e77022fd3 (patch)
tree65d9e0d26b5150795b09ebb1be59d2149b16c439
parent293ac91a07750088754b7ad4571550b4e3cf18dd (diff)
downloadgsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar.gz
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar.bz2
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar.lz
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar.xz
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.tar.zst
gsoc2013-evolution-5795833acac5ff6d1d2332b28390238e77022fd3.zip
Fill in the message_count and unread_message_count flags (if !fast).
* providers/imap/camel-imap-store.c (get_folder_info): Fill in the message_count and unread_message_count flags (if !fast). svn path=/trunk/; revision=6151
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/providers/imap/camel-imap-store.c39
2 files changed, 39 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 05a6a0d344..a3fdd32896 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2000-10-24 Dan Winship <danw@helixcode.com>
+
+ * providers/imap/camel-imap-store.c (get_folder_info): Fill in the
+ message_count and unread_message_count flags (if !fast).
+
2000-10-23 Dan Winship <danw@helixcode.com>
* camel-object.h: #include gnome-i18n.h (and gnome-defs.h since
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index a731ac9a68..d86e6a4cb6 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -507,7 +507,6 @@ parse_list_response_as_folder_info (const char *response,
if (!e_strstrcase (flags, "\\NoSelect"))
fi->url = g_strdup_printf ("%s%s", base_url, dir);
g_free (flags);
- /* FIXME: read/unread msg count */
return fi;
}
@@ -524,6 +523,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
CamelImapResponse *response;
GPtrArray *folders;
char *dir_sep, *namespace, *base_url, *list;
+ char *folder_path, *status, *p;
CamelFolderInfo *topfi = NULL, *fi;
if (!top)
@@ -549,9 +549,8 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
if (response) {
list = camel_imap_response_extract (response, "LIST", ex);
if (list) {
- topfi = parse_list_response_as_folder_info (list,
- namespace,
- base_url);
+ topfi = parse_list_response_as_folder_info (
+ list, namespace, base_url);
g_free (list);
}
}
@@ -595,11 +594,41 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
fi->full_name = g_strdup ("INBOX");
fi->name = g_strdup ("INBOX");
fi->url = g_strdup_printf ("%sINBOX", base_url);
- /* FIXME: read/unread msg count */
g_ptr_array_add (folders, fi);
}
+ if (!fast) {
+ /* Get read/unread counts */
+ for (i = 0; i < folders->len; i++) {
+ fi = folders->pdata[i];
+ if (!fi->url)
+ continue;
+
+ folder_path = camel_imap_store_folder_path (
+ imap_store, fi->full_name);
+ response = camel_imap_command (
+ imap_store, NULL, NULL,
+ "STATUS %s (MESSAGES UNSEEN)",
+ folder_path);
+ g_free (folder_path);
+ if (!response)
+ continue;
+ status = camel_imap_response_extract (
+ response, "STATUS", NULL);
+ if (!status)
+ continue;
+
+ p = e_strstrcase (status, "MESSAGES");
+ if (p)
+ fi->message_count = strtoul (p + 8, NULL, 10);
+ p = e_strstrcase (status, "UNSEEN");
+ if (p)
+ fi->unread_message_count = strtoul (p + 6, NULL, 10);
+ g_free (status);
+ }
+ }
+
/* And assemble */
camel_folder_info_build (folders, topfi, *dir_sep, TRUE);
g_ptr_array_free (folders, FALSE);