From 2ac5b884fe9cca11f9fed05b0f2cd5f50aba3d84 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 5 Apr 2001 02:31:47 +0000 Subject: merge from evolution-0-10-branch to evolution-0-10-merge-0 2001-04-05 Not Zed * merge from evolution-0-10-branch to evolution-0-10-merge-0 svn path=/trunk/; revision=9194 --- camel/ChangeLog | 99 +++++++++++++++++ camel/camel-filter-driver.c | 4 +- camel/camel-folder-search.c | 3 +- camel/camel-folder-summary.c | 4 + camel/camel-operation.c | 164 +++++++++++++++++++++++++---- camel/camel-operation.h | 1 + camel/camel-vee-folder.c | 2 +- camel/providers/local/camel-mbox-summary.c | 4 + camel/providers/pop3/camel-pop3-folder.c | 2 +- 9 files changed, 257 insertions(+), 26 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 0009cfff2d..9febdce133 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,7 @@ +2001-04-05 Not Zed + + * merge from evolution-0-10-branch to evolution-0-10-merge-0 + 2001-04-03 Jeffrey Stedfast * Makefile.am: Added tests/ back in @@ -315,6 +319,101 @@ * camel-service.c (construct): Update calls to camel_url_to_string (pass CAMEL_URL_HIDE_PASSWORD) +2001-04-03 Jeffrey Stedfast + + * camel-mime-utils.c (header_decode_text): Ignore whitespace + between encoded words (there were a few cases where it didn't + before). + (header_encode_string): Preserve whitespace between words that are + to be encoded by encoding them too. + (header_encode_phrase): Same here but with phrases. + +2001-04-04 Kjartan Maraas + + * camel-filter-driver.c: Added #include . Marked + a bunch of strings for translation. + * camel-folder-search.c: Added #include . + * camel-folder-summary.c: Same here. + * camel-movemail.c: Marked strings for translation. + * camel-provider.c: Same here. + * camel-search-private.c: #include + * camel-vee-folder.c: Mark string for translation. + * providers/local/camel-mbox-summary.c: #include + +2001-04-03 Dan Winship + + * providers/imap/camel-imap-folder.c (imap_sync): If we don't + change any flags or expunge, send a NOOP to give the server a + chance to send EXISTS, etc, messages. + (imap_get_message): If the server_level < IMAP4rev1, always fetch + messages all-at-once, since they don't support the [#.MIME] + syntax. + +2001-04-01 Jeffrey Stedfast + + * providers/imap/camel-imap-store.c (get_folder_info): Don't + blindly append "/INBOX", construct a CamelURL and set the path + that way. + (parse_list_response_as_folder_info): Don't blindly append + "/", construct a CamelURL and set the path that way + instead. + (get_folders_offline): And again here. + +2001-03-31 Not Zed + + * camel-operation.c (struct _status_stack): change stamp to + unsigned to avoid overflow. + (camel_operation_end): + (camel_operation_progress_count): + (camel_operation_progress): Double the delay before transient + events start showing their own progress. + +2001-03-30 Not Zed + + * providers/pop3/camel-pop3-folder.c (pop3_get_message): Change + the pop download into a transient event. + + * camel-operation.c (stamp): Get a timestamp that changes 4x a + second (or rather, arbitrarily more often than 1/second). + (camel_operation_progress): Use stamp() for time updates. + (camel_operation_progress_count): " + (camel_operation_start): Store the status as a struct status_stack + item. + (camel_operation_start_transient): New function to start a + transient event, which is only reported if it runs for too + long/and is reset afterwards. + (camel_operation_progress): + (camel_operation_progress_count): Fix for status_stack changes, + and account for transient updates. + + * camel-filter-driver.c (camel_filter_driver_filter_folder): When + we remove things (set deleted), always set seen too, to mirror + interface behaviour when you delete. + (camel_filter_driver_filter_message): And same here too. + +2001-03-30 Dan Winship + + * providers/pop3/camel-pop3-store.c (connect_to_server, + query_auth_types, pop3_connect): Move things around here to make + this all work right again (so you don't get prompted for a + password when checking the supported authtypes.) + +2001-03-29 Dan Winship + + * camel-url.c (camel_url_to_string): change "gboolean show_passwd" + to "guint32 flags". + + * tests/misc/url.c (main): Update calls to camel_url_to_string + + * providers/imap/camel-imap-store.c (construct): Call + camel_url_to_string with flags to hide password, authtype, and + params to create the base_url. + (etc): Update for the fact that the base_url no longer has the "/" + at the end. + + * camel-service.c (construct): Update calls to camel_url_to_string + (pass CAMEL_URL_HIDE_PASSWORD) + 2001-03-28 Jeffrey Stedfast * camel-pgp-context.[c,h]: New class for PGP encrypting, diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index 84faf9ae20..08d01da694 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -776,7 +776,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde if (remove) camel_folder_set_message_flags (folder, uids->pdata[i], - CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); + CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN); camel_object_unref (CAMEL_OBJECT (message)); } @@ -880,7 +880,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage /* *Now* we can set the DELETED flag... */ if (p->deleted) - info->flags = info->flags | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED; + info->flags = info->flags | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_SEEN; /* Logic: if !Moved and there exists a default folder... */ if (!(p->copied && p->deleted) && p->defaultfolder) { diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 7110d7c8ed..18f49868ac 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -30,10 +30,11 @@ #include #include #include -#include #include #include +#include + #include "camel-folder-search.h" #include "string-utils.h" diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 65de498783..69444641cd 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -19,6 +19,10 @@ * USA */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/camel/camel-operation.c b/camel/camel-operation.c index c17d24e7a4..4433fa5d1a 100644 --- a/camel/camel-operation.c +++ b/camel/camel-operation.c @@ -7,6 +7,9 @@ #include #endif +#include +#include + #include #include "camel-operation.h" #include "e-util/e-msgport.h" @@ -15,6 +18,13 @@ /* ********************************************************************** */ +struct _status_stack { + guint32 flags; + char *msg; + int pc; /* last pc reported */ + unsigned int stamp; /* last stamp reported */ +}; + struct _CamelOperation { pthread_t id; /* id of running thread */ guint32 flags; /* cancelled ? */ @@ -23,10 +33,11 @@ struct _CamelOperation { CamelOperationStatusFunc status; void *status_data; - time_t status_update; + unsigned int status_update; - /* stack of status messages (char *) */ + /* stack of status messages (struct _status_stack *) */ GSList *status_stack; + struct _status_stack *lastreport; #ifdef ENABLE_THREADS EMsgPort *cancel_port; @@ -36,6 +47,7 @@ struct _CamelOperation { }; #define CAMEL_OPERATION_CANCELLED (1<<0) +#define CAMEL_OPERATION_TRANSIENT (1<<1) #ifdef ENABLE_THREADS #define CAMEL_OPERATION_LOCK(cc) pthread_mutex_lock(&cc->lock) @@ -405,6 +417,7 @@ void camel_operation_start(CamelOperation *cc, char *what, ...) { va_list ap; char *msg; + struct _status_stack *s; if (operation_active == NULL) return; @@ -425,10 +438,67 @@ void camel_operation_start(CamelOperation *cc, char *what, ...) va_end(ap); cc->status(cc, msg, CAMEL_OPERATION_START, cc->status_data); cc->status_update = 0; - cc->status_stack = g_slist_prepend(cc->status_stack, msg); + s = g_malloc0(sizeof(*s)); + s->msg = msg; + s->flags = 0; + cc->lastreport = s; + cc->status_stack = g_slist_prepend(cc->status_stack, s); + d(printf("start '%s'\n", msg, pc)); +} + +/** + * camel_operation_start_transient: + * @cc: + * @what: + * @: + * + * Start a transient event. We only update this to the display if it + * takes very long to process, and if we do, we then go back to the + * previous state when finished. + **/ +void camel_operation_start_transient(CamelOperation *cc, char *what, ...) +{ + va_list ap; + char *msg; + struct _status_stack *s; + + if (operation_active == NULL) + return; + + if (cc == NULL) { + CAMEL_ACTIVE_LOCK(); + cc = g_hash_table_lookup(operation_active, (void *)pthread_self()); + CAMEL_ACTIVE_UNLOCK(); + if (cc == NULL) + return; + } + + if (cc->status == NULL) + return; + + va_start(ap, what); + msg = g_strdup_vprintf(what, ap); + va_end(ap); + /* we dont report it yet */ + /*cc->status(cc, msg, CAMEL_OPERATION_START, cc->status_data);*/ + cc->status_update = 0; + s = g_malloc0(sizeof(*s)); + s->msg = msg; + s->flags = CAMEL_OPERATION_TRANSIENT; + s->stamp = stamp(); + cc->status_stack = g_slist_prepend(cc->status_stack, s); d(printf("start '%s'\n", msg, pc)); } +static unsigned int stamp(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + /* update 4 times/second */ + return (tv.tv_sec * 4) + tv.tv_usec / (1000000/4); +} + /** * camel_operation_progress: * @cc: Operation to report to. @@ -443,8 +513,8 @@ void camel_operation_start(CamelOperation *cc, char *what, ...) **/ void camel_operation_progress(CamelOperation *cc, int pc) { - char *msg; - time_t now; + unsigned int now; + struct _status_stack *s; if (operation_active == NULL) return; @@ -463,19 +533,31 @@ void camel_operation_progress(CamelOperation *cc, int pc) if (cc->status_stack == NULL) return; - now = time(0); + s = cc->status_stack->data; + s->pc = pc; + + now = stamp(); if (cc->status_update != now) { - msg =cc->status_stack->data; - cc->status(cc, msg, pc, cc->status_data); - d(printf("progress '%s' %d %%\n", msg, pc)); - cc->status_update = now; + if (s->flags & CAMEL_OPERATION_TRANSIENT) { + if (s->stamp/16 < now/16) { + s->stamp = now; + cc->status(cc, s->msg, pc, cc->status_data); + cc->status_update = now; + cc->lastreport = s; + } + } else { + cc->status(cc, s->msg, pc, cc->status_data); + d(printf("progress '%s' %d %%\n", s->msg, pc)); + s->stamp = cc->status_update = now; + cc->lastreport = s; + } } } void camel_operation_progress_count(CamelOperation *cc, int sofar) { - char *msg; - time_t now; + unsigned int now; + struct _status_stack *s; if (operation_active == NULL) return; @@ -495,12 +577,23 @@ void camel_operation_progress_count(CamelOperation *cc, int sofar) return; /* FIXME: generate some meaningful pc value */ - now = time(0); + s = cc->status_stack->data; + s->pc = sofar; + now = stamp(); if (cc->status_update != now) { - msg =cc->status_stack->data; - cc->status(cc, msg, sofar, cc->status_data); - d(printf("progress '%s' %d done\n", msg, sofar)); - cc->status_update = now; + if (s->flags & CAMEL_OPERATION_TRANSIENT) { + if (s->stamp/16 < now/16) { + s->stamp = now; + cc->status(cc, s->msg, sofar, cc->status_data); + cc->status_update = now; + cc->lastreport = s; + } + } else { + cc->status(cc, s->msg, sofar, cc->status_data); + d(printf("progress '%s' %d done\n", msg, sofar)); + s->stamp = cc->status_update = now; + cc->lastreport = s; + } } } @@ -515,7 +608,8 @@ void camel_operation_progress_count(CamelOperation *cc, int sofar) **/ void camel_operation_end(CamelOperation *cc) { - char *msg; + struct _status_stack *s, *p; + unsigned int now; if (operation_active == NULL) return; @@ -534,8 +628,36 @@ void camel_operation_end(CamelOperation *cc) if (cc->status_stack == NULL) return; - msg = cc->status_stack->data; - cc->status(cc, msg, CAMEL_OPERATION_END, cc->status_data); - g_free(msg); + /* so what we do here is this. If the operation that just + * ended was transient, see if we have any other transient + * messages that haven't been updated yet above us, otherwise, + * re-update as a non-transient at the last reported pc */ + now = stamp(); + s = cc->status_stack->data; + if (s->flags & CAMEL_OPERATION_TRANSIENT) { + if (cc->lastreport == s) { + GSList *l = cc->status_stack->next; + while (l) { + p = l->data; + if (p->flags & CAMEL_OPERATION_TRANSIENT) { + if (p->stamp/16 < now/16) { + cc->status(cc, p->msg, p->pc, cc->status_data); + cc->lastreport = p; + break; + } + } else { + cc->status(cc, p->msg, p->pc, cc->status_data); + cc->lastreport = p; + break; + } + l = l->next; + } + } + } else { + cc->status(cc, s->msg, CAMEL_OPERATION_END, cc->status_data); + cc->lastreport = s; + } + g_free(s->msg); + g_free(s); cc->status_stack = g_slist_remove_link(cc->status_stack, cc->status_stack); } diff --git a/camel/camel-operation.h b/camel/camel-operation.h index 4a61b40dfc..8bf5cfa2dc 100644 --- a/camel/camel-operation.h +++ b/camel/camel-operation.h @@ -55,6 +55,7 @@ int camel_operation_cancel_check(CamelOperation *cc); int camel_operation_cancel_fd(CamelOperation *cc); void camel_operation_start(CamelOperation *cc, char *what, ...); +void camel_operation_start_transient(CamelOperation *cc, char *what, ...); void camel_operation_progress(CamelOperation *cc, int pc); void camel_operation_progress_count(CamelOperation *cc, int sofar); void camel_operation_end(CamelOperation *cc); diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index 04a06ecbf2..13b15c3b30 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -448,7 +448,7 @@ vee_get_message(CamelFolder *folder, const char *uid, CamelException *ex) camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi); } else { camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, - "No such message %s in %s", uid, + _("No such message %s in %s"), uid, folder->name); } diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index a37d1633ff..389b1f356c 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -35,6 +35,10 @@ #include #include +#include "camel-mbox-summary.h" +#include "camel/camel-mime-message.h" +#include "camel/camel-operation.h" + #define io(x) #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/ diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index 3b1366ba27..96b5471828 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -286,7 +286,7 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) return NULL; } - camel_operation_start(NULL, _("Retrieving POP message %d"), num); + camel_operation_start_transient(NULL, _("Retrieving POP message %d"), num); status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store), &result, ex, "RETR %d", num); -- cgit