aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-14 04:08:29 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-14 04:08:29 +0800
commit070653be4fc60e713e83239c1c5f9b660ee48555 (patch)
tree9f711b9f0e5a9a231bc6cb75606712eed6b37c6f
parente85b96971560854bd81a038cdb29265883a69c37 (diff)
downloadgsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar.gz
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar.bz2
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar.lz
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar.xz
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.tar.zst
gsoc2013-evolution-070653be4fc60e713e83239c1c5f9b660ee48555.zip
Oops. If the number of messages in the folder is 0, don't fetch summaries
2000-07-13 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_get_summary): Oops. If the number of messages in the folder is 0, don't fetch summaries 1 thru 0, just return an empty summary. (imap_copy_message_to): Fixed to use message UID and also send the source folder as an arg to camel_imap_command rather than NULL. (imap_move_message_to): Same. (imap_init): If SELECT is successful, we need to set the current folder to the one selected, this was causing problems with move/copy svn path=/trunk/; revision=4154
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/providers/imap/camel-imap-folder.c37
-rw-r--r--camel/providers/imap/camel-imap-store.c3
3 files changed, 30 insertions, 15 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 1d29919f08..a9b17bba72 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -3,6 +3,11 @@
* providers/imap/camel-imap-folder.c (imap_get_summary): Oops.
If the number of messages in the folder is 0, don't fetch
summaries 1 thru 0, just return an empty summary.
+ (imap_copy_message_to): Fixed to use message UID and also send
+ the source folder as an arg to camel_imap_command rather than NULL.
+ (imap_move_message_to): Same.
+ (imap_init): If SELECT is successful, we need to set the current
+ folder to the one selected, this was causing problems with move/copy
2000-07-13 Dan Winship <danw@helixcode.com>
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 21b421232b..d5a80dce81 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -266,10 +266,10 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
"Could not SELECT %s on IMAP server %s: %s.",
folder->full_name, service->url->host,
- status == CAMEL_IMAP_ERR ? result :
- "Unknown error");
+ result ? result : "Unknown error");
} else {
- /* parse the mode we opened it in */
+ /* parse the mode we opened it in and set as current mailbox */
+ CAMEL_IMAP_STORE (store)->current_folder = folder;
}
g_free (result);
g_free (folder_path);
@@ -558,8 +558,8 @@ imap_copy_message_to (CamelFolder *source, const char *uid, CamelFolder *destina
else
folder_path = g_strdup (destination->full_name);
- status = camel_imap_command (CAMEL_IMAP_STORE (store), NULL, &result,
- "COPY %s %s", uid, folder_path);
+ status = camel_imap_command (CAMEL_IMAP_STORE (store), source, &result,
+ "UID COPY %s %s", uid, folder_path);
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (store);
@@ -594,9 +594,9 @@ imap_move_message_to (CamelFolder *source, const char *uid, CamelFolder *destina
else
folder_path = g_strdup (destination->full_name);
- status = camel_imap_command (CAMEL_IMAP_STORE (store), NULL, &result,
- "COPY %s %s", uid, folder_path);
-
+ status = camel_imap_command (CAMEL_IMAP_STORE (store), source, &result,
+ "UID COPY %s %s", uid, folder_path);
+
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
@@ -1020,7 +1020,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
GPtrArray *summary = NULL, *headers = NULL;
gint num, i, j, status = 0;
- char *result, *p, *q, *node;
+ char *result, *q, *node;
const char *received;
struct _header_raw *h, *tail = NULL;
@@ -1031,16 +1031,23 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
summary = g_ptr_array_new ();
- if (num == 0) {
+ switch (num) {
+ case 0:
imap_folder->summary = summary;
return summary;
+ case 1:
+ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
+ &result, "FETCH 1 (UID FLAGS BODY[HEADER.FIELDS "
+ "(SUBJECT FROM TO CC DATE MESSAGE-ID "
+ "REFERENCES IN-REPLY-TO)])");
+ break;
+ default:
+ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
+ &result, "FETCH 1:%d (UID FLAGS BODY[HEADER.FIELDS "
+ "(SUBJECT FROM TO CC DATE MESSAGE-ID "
+ "REFERENCES IN-REPLY-TO)])", num);
}
-
- status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
- &result, "FETCH 1:%d (UID FLAGS BODY[HEADER.FIELDS "
- "(SUBJECT FROM TO CC DATE MESSAGE-ID "
- "REFERENCES IN-REPLY-TO)])", num);
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 07630ed6f5..2fdbe5545a 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -532,6 +532,9 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
va_list ap;
gint status = CAMEL_IMAP_OK;
+ if (folder)
+ printf ("*** Current folder = %s\n", store->current_folder->full_name);
+
if (folder && store->current_folder != folder && strncmp (fmt, "STATUS", 6) &&
strncmp (fmt, "CREATE", 5) && strcmp (fmt, "CAPABILITY")) {
/* We need to select the correct mailbox first */