diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-11-01 03:39:02 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-11-01 03:39:02 +0800 |
commit | 84664338374cb9e52d9d33512bebde4708f866a7 (patch) | |
tree | 436cdbc448f60a4a161af69c82edb21cb8f711c5 /filter/filter-driver.c | |
parent | b3a536d46bfc6f4ed4524ec6252abfcea2f97423 (diff) | |
download | gsoc2013-evolution-84664338374cb9e52d9d33512bebde4708f866a7.tar.gz gsoc2013-evolution-84664338374cb9e52d9d33512bebde4708f866a7.tar.zst gsoc2013-evolution-84664338374cb9e52d9d33512bebde4708f866a7.zip |
Updated to add an action to set message flags.
2000-10-31 Jeffrey Stedfast <fejj@helixcode.com>
* filtertypes.xml: Updated to add an action to set message flags.
* filter-driver.c (do_flag): New callback to set message info
flags.
* filter-element.c (filter_element_set_data): New convenience
function to set the data on a FilterElement.
* filter-url.c (get_widget): Set the sources list to point to the
FilterElement data.
svn path=/trunk/; revision=6298
Diffstat (limited to 'filter/filter-driver.c')
-rw-r--r-- | filter/filter-driver.c | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/filter/filter-driver.c b/filter/filter-driver.c index 744ca6e526..ac49bf0ac4 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -90,6 +90,7 @@ static ESExpResult *do_move (struct _ESExp *f, int argc, struct _ESExpResult **a static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); +static ESExpResult *do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); /* these are our filter actions - each must have a callback */ static struct { @@ -104,7 +105,8 @@ static struct { { "move-to", (ESExpFunc *) do_move, 0 }, { "stop", (ESExpFunc *) do_stop, 0 }, { "set-colour", (ESExpFunc *) do_colour, 0 }, - { "set-score", (ESExpFunc *) do_score, 0 } + { "set-score", (ESExpFunc *) do_score, 0 }, + { "set-flag", (ESExpFunc *) do_flag, 0 } }; static GtkObjectClass *filter_driver_parent; @@ -410,6 +412,45 @@ do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver * return NULL; } +static ESExpResult * +do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) +{ + struct _FilterDriverPrivate *p = _PRIVATE (driver); + + d(fprintf (stderr, "setting flag\n")); + if (argc > 0 && argv[0]->type == ESEXP_RES_INT) { + char *flag; + + switch (argv[0]->value.number) { + case CAMEL_MESSAGE_ANSWERED: + p->info->flags |= CAMEL_MESSAGE_ANSWERED; + flag = "Answered"; + break; + case CAMEL_MESSAGE_DELETED: + p->info->flags |= CAMEL_MESSAGE_DELETED; + flag = "Deleted"; + break; + case CAMEL_MESSAGE_DRAFT: + p->info->flags |= CAMEL_MESSAGE_DRAFT; + flag = "Draft"; + break; + case CAMEL_MESSAGE_FLAGGED: + p->info->flags |= CAMEL_MESSAGE_FLAGGED; + flag = "Flagged"; + break; + case CAMEL_MESSAGE_SEEN: + p->info->flags |= CAMEL_MESSAGE_SEEN; + flag = "Seen"; + break; + default: + flag = "Unknown"; + } + report_status (driver, FILTER_STATUS_ACTION, "Set %s flag", flag); + } + + return NULL; +} + static CamelFolder * open_folder (FilterDriver *driver, const char *folder_url) { @@ -478,16 +519,16 @@ filter_driver_status_log (FilterDriver *driver, enum filter_status_t status, FILE *out = data; switch(status) { - case FILTER_STATUS_END: { + case FILTER_STATUS_START: { /* write log header */ time_t t; char date[50]; char *from = NULL; char *subject = NULL; - + if (msg) { - from = camel_mime_message_get_from(msg); - subject = camel_mime_message_get_subject(msg); + from = camel_mime_message_get_from (msg); + subject = camel_mime_message_get_subject (msg); } time (&t); @@ -497,7 +538,7 @@ filter_driver_status_log (FilterDriver *driver, enum filter_status_t status, subject ? subject : "", date); break; } - case FILTER_STATUS_START: + case FILTER_STATUS_END: fprintf (out, "\n"); break; case FILTER_STATUS_ACTION: @@ -544,7 +585,7 @@ filter_driver_filter_mbox (FilterDriver *driver, const char *mbox, const char *s if (st.st_size > 0) pc = (int)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size)); - + report_status (driver, FILTER_STATUS_START, "Getting message %d (%d%% of file)", i, pc); msg = camel_mime_message_new (); |