diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-02-23 00:22:27 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-02-23 00:22:27 +0800 |
commit | 0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff (patch) | |
tree | 85dd6846cead42f8d25398b644460c10849a9db5 /camel | |
parent | 93a285353c8ee1052422a2d526434bc7c009f971 (diff) | |
download | gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar.gz gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar.bz2 gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar.lz gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar.xz gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.tar.zst gsoc2013-evolution-0a3fde6ecdb3ee07ab13fcf5bdf39289bf2a07ff.zip |
Remove the 'FIXME: remove because this isn't required...' comment for
2001-02-22 Jeffrey Stedfast <fejj@ximian.com>
* camel-folder.h: Remove the 'FIXME: remove because this isn't
required...' comment for copy_message_to since we now need and
cherish its existance in the filter-driver code ;-)
* camel-filter-driver.c (camel_filter_driver_filter_message): Now
takes a UID and CamelFolder arguments (which can be NULL) to allow
for possible optimizations when copying messages between folders
on the same store.
(camel_filter_driver_filter_mbox): Updated (passes NULL for both
since this case can't be optimized anyway).
(camel_filter_driver_filter_folder): Updated to pass in the uid
and folder of the message.
svn path=/trunk/; revision=8346
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 15 | ||||
-rw-r--r-- | camel/camel-filter-driver.c | 54 | ||||
-rw-r--r-- | camel/camel-filter-driver.h | 15 | ||||
-rw-r--r-- | camel/camel-folder.h | 1 |
4 files changed, 62 insertions, 23 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index bfa6e7e0c3..97c4f23808 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,18 @@ +2001-02-22 Jeffrey Stedfast <fejj@ximian.com> + + * camel-folder.h: Remove the 'FIXME: remove because this isn't + required...' comment for copy_message_to since we now need and + cherish its existance in the filter-driver code ;-) + + * camel-filter-driver.c (camel_filter_driver_filter_message): Now + takes a UID and CamelFolder arguments (which can be NULL) to allow + for possible optimizations when copying messages between folders + on the same store. + (camel_filter_driver_filter_mbox): Updated (passes NULL for both + since this case can't be optimized anyway). + (camel_filter_driver_filter_folder): Updated to pass in the uid + and folder of the message. + 2001-02-22 Dan Winship <danw@ximian.com> * providers/imap/camel-imap-summary.h (CAMEL_IMAP_SERVER_FLAGS): diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index ede9aa6936..08d2b06265 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -71,7 +71,7 @@ struct _CamelFilterDriverPrivate { /* run-time data */ GHashTable *folders; /* folders that message has been copied to */ - int closed; /* close count */ + int closed; /* close count */ GHashTable *forwards; /* addresses that have been forwarded the message */ gboolean terminated; /* message processing was terminated */ @@ -80,10 +80,12 @@ struct _CamelFilterDriverPrivate { CamelMimeMessage *message; /* input message */ CamelMessageInfo *info; /* message summary info */ + const char *uid; /* message uid */ + CamelFolder *source; /* message source folder */ FILE *logfile; /* log file */ - EDList rules; /* list of _filter_rule structs */ + EDList rules; /* list of _filter_rule structs */ CamelException *ex; @@ -369,10 +371,14 @@ do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv break; p->copied = TRUE; - camel_folder_append_message (outbox, p->message, p->info, p->ex); + if (p->uid && p->source) + camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex); + else + camel_folder_append_message (outbox, p->message, p->info, p->ex); service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", service_url); + camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", + service_url); g_free (service_url); } } @@ -402,10 +408,14 @@ do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv p->copied = TRUE; p->deleted = TRUE; /* a 'move' is a copy & delete */ - camel_folder_append_message (outbox, p->message, p->info, p->ex); + if (p->uid && p->source) + camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex); + else + camel_folder_append_message (outbox, p->message, p->info, p->ex); service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", service_url); + camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", + service_url); g_free (service_url); } } @@ -634,7 +644,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, Ca goto fail; } - camel_filter_driver_filter_message (driver, msg, NULL, source_url, ex); + camel_filter_driver_filter_message (driver, msg, NULL, NULL, NULL, source_url, ex); camel_object_unref (CAMEL_OBJECT (msg)); if (camel_exception_is_set (ex)) { report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed message %d", i); @@ -686,11 +696,13 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde for (i = 0; i < uids->len; i++) { int pc = (100 * i)/uids->len; - report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d of %d", i+1, uids->len); + report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d of %d", i+1, + uids->len); message = camel_folder_get_message (folder, uids->pdata[i], ex); if (camel_exception_is_set (ex)) { - report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", i+1, uids->len); + report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", + i+1, uids->len); break; } @@ -699,13 +711,15 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde else info = NULL; - camel_filter_driver_filter_message (driver, message, info, source_url, ex); - + camel_filter_driver_filter_message (driver, message, info, uids->pdata[i], + folder, source_url, ex); + if (camel_folder_has_summary_capability (folder)) camel_folder_free_message_info (folder, info); if (camel_exception_is_set (ex)) { - report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", i+1, uids->len); + report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", + i+1, uids->len); break; } @@ -718,7 +732,6 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde if (freeuids) camel_folder_free_uids (folder, uids); - if (p->defaultfolder) { report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, "Syncing folder"); @@ -733,8 +746,10 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde } void -camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info, - const char *source_url, CamelException *ex) +camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, + CamelMessageInfo *info, const char *uid, + CamelFolder *source, const char *source_url, + CamelException *ex) { struct _CamelFilterDriverPrivate *p = _PRIVATE (driver); ESExpResult *r; @@ -758,7 +773,9 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage p->copied = FALSE; p->message = message; p->info = info; - + p->uid = uid; + p->source = source; + node = (struct _filter_rule *)p->rules.head; while (node->next) { d(fprintf (stderr, "applying rule %s\n action %s\n", node->match, node->action)); @@ -794,7 +811,10 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage /* copy it to the default inbox */ filtered = TRUE; camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder"); - camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex); + if (p->uid && p->source) + camel_folder_copy_message_to (p->source, p->uid, p->defaultfolder, p->ex); + else + camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex); } error: diff --git a/camel/camel-filter-driver.h b/camel/camel-filter-driver.h index 74803acfcd..113eec28ed 100644 --- a/camel/camel-filter-driver.h +++ b/camel/camel-filter-driver.h @@ -64,15 +64,20 @@ CamelFilterDriver *camel_filter_driver_new (CamelFilterGetFolderFunc fetche /* modifiers */ void camel_filter_driver_set_logfile (CamelFilterDriver *d, FILE *logfile); -void camel_filter_driver_set_status_func (CamelFilterDriver *d, CamelFilterStatusFunc *func, void *data); +void camel_filter_driver_set_status_func (CamelFilterDriver *d, CamelFilterStatusFunc *func, + void *data); void camel_filter_driver_set_default_folder (CamelFilterDriver *d, CamelFolder *def); -void camel_filter_driver_add_rule (CamelFilterDriver *d, const char *name, const char *match, const char *action); +void camel_filter_driver_add_rule (CamelFilterDriver *d, const char *name, const char *match, + const char *action); /*void camel_filter_driver_set_global(CamelFilterDriver *, const char *name, const char *value);*/ -void camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info, - const char *source_url, CamelException *ex); -void camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, CamelException *ex); +void camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, + CamelMessageInfo *info, const char *uri, + CamelFolder *source, const char *source_url, + CamelException *ex); +void camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, + CamelException *ex); void camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder, GPtrArray *uids, gboolean remove, CamelException *ex); diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 0f1c772346..53fa626e85 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -253,7 +253,6 @@ void camel_folder_search_free (CamelFolder *folder, GPtrArray *); CamelMessageInfo *camel_folder_get_message_info (CamelFolder *folder, const char *uid); void camel_folder_free_message_info (CamelFolder *folder, CamelMessageInfo *info); -/* FIXME: copy-message-to is not required */ void camel_folder_copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, |