diff options
author | Dan Winship <danw@src.gnome.org> | 2000-10-13 04:55:11 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-10-13 04:55:11 +0800 |
commit | e81e64f8dd9facde47e93e3f4e8b190978eeb91b (patch) | |
tree | 3e7634780b337f499d385447bcc71c7e20a280c4 /camel/providers/imap/camel-imap-command.c | |
parent | dd388c63f597303b2f0d6f4d8346574183f307b6 (diff) | |
download | gsoc2013-evolution-e81e64f8dd9facde47e93e3f4e8b190978eeb91b.tar.gz gsoc2013-evolution-e81e64f8dd9facde47e93e3f4e8b190978eeb91b.tar.zst gsoc2013-evolution-e81e64f8dd9facde47e93e3f4e8b190978eeb91b.zip |
Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY value
* providers/imap/camel-imap-summary.c: Simple subclass of
CamelFolderSummary that also keeps a UIDVALIDITY value (and
doesn't, for the moment, build content info).
* providers/imap/camel-imap-folder.c:
(various): Use a CamelImapSummary to store/fetch summary info.
(camel_imap_folder_new): Take a path to a file to use for the
summary. Set the folder's permanent_flags correctly according to
the server response. Read in the summary (checking the
UIDVALIDITY) and update it if it's out of date.
(imap_refresh_info): Just fetch UIDs and flags. If the UIDs all
match, update the flags as needed and be done with it. Otherwise,
delete messages that have been expunged from the server and fetch
full summary info for any new messages.
(imap_sync): Save the summary to disk.
(imap_update_summary): Renamed from imap_get_summary_internal. Can
now be told to get summary for only a subset of messages. Use
camel-mime-utils functions rather than rolling our own header
parsing.
(imap_get_message_info_internal): Merged into imap_update_summary.
(imap_set_message_flags): Don't marked the message FOLDER_FLAGGED
if we're not actually changing the value of any of the flags.
(camel_imap_folder_changed): Deal with EXISTS rather than RECENT.
* providers/imap/camel-imap-store.c (imap_connect): Call
camel_session_get_storage_path and save the value.
(get_folder): Create a local directory to store summary
information and pass a summary file name to camel_imap_folder_new.
Don't call camel_folder_refresh_info from here any more since
camel_imap_folder_new does it again.
* providers/imap/camel-imap-command.c (camel_imap_command): Add a
special case to this to make it possible to get the repsonses from
a SELECT and still have store->current_folder be updated
correctly.
(imap_read_response): parse EXISTS rather than RECENT
* camel-session.c (camel_session_get_storage_path): Use
e_mkdir_hier.
* camel-folder-summary.c (camel_folder_summary_remove_index): New
function.
* camel-mime-utils.c (header_raw_append_parse): fix this.
(camel-mime-parser.c doesn't use this code because of the MEMPOOL
optimization, so nothing was ever actually calling it before.)
svn path=/trunk/; revision=5891
Diffstat (limited to 'camel/providers/imap/camel-imap-command.c')
-rw-r--r-- | camel/providers/imap/camel-imap-command.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 70b6ea8149..ea1f3aaccf 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -48,9 +48,13 @@ static CamelImapResponse *imap_read_response (CamelImapStore *store, * @ex: a CamelException * @fmt: a printf-style format string, followed by arguments * - * This camel method sends the IMAP command specified by @fmt and the - * following arguments to the IMAP store specified by @store. It then - * reads the server's response(s) and parses the final result. + * This function makes sure that @folder (if non-%NULL) is the + * currently-selected folder on @store and then sends the IMAP command + * specified by @fmt and the following arguments. It then reads the + * server's response(s) and parses the final result. + * + * As a special case, if @fmt is %NULL, it will just select @folder + * and return the response from doing so. * * Return value: %NULL if an error occurred (in which case @ex will * be set). Otherwise, a CamelImapResponse describing the server's @@ -64,23 +68,25 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, va_list ap; /* Check for current folder */ - if (folder && folder != store->current_folder) { + if (folder && (!fmt || folder != store->current_folder)) { char *folder_path; CamelImapResponse *response; folder_path = camel_imap_store_folder_path (store, folder->full_name); + store->current_folder = NULL; response = camel_imap_command (store, NULL, ex, "SELECT \"%s\"", folder_path); g_free (folder_path); - if (!response) { - store->current_folder = NULL; + if (!response) return NULL; - } - camel_imap_response_free (response); - store->current_folder = folder; + + if (!fmt) + return response; + + camel_imap_response_free (response); } /* Send the command */ @@ -126,7 +132,7 @@ static CamelImapResponse * imap_read_response (CamelImapStore *store, CamelException *ex) { CamelImapResponse *response; - int number, recent = 0; + int number, exists = 0; GArray *expunged = NULL; char *respbuf, *retcode, *p; @@ -149,10 +155,10 @@ imap_read_response (CamelImapStore *store, CamelException *ex) * it ourselves. */ number = strtoul (respbuf + 2, &p, 10); - if (p != respbuf + 2) { + if (p != respbuf + 2 && store->current_folder) { p = imap_next_word (p); - if (!g_strcasecmp (p, "RECENT")) { - recent = number; + if (!g_strcasecmp (p, "EXISTS")) { + exists = number; g_free (respbuf); goto next; } else if (!g_strcasecmp (p, "EXPUNGE")) { @@ -174,8 +180,8 @@ imap_read_response (CamelImapStore *store, CamelException *ex) } /* Update the summary */ - if (store->current_folder && (recent > 0 || expunged)) { - camel_imap_folder_changed (store->current_folder, recent, + if (store->current_folder && (exists > 0 || expunged)) { + camel_imap_folder_changed (store->current_folder, exists, expunged, NULL); } if (expunged) |