diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-07-29 13:24:22 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-07-29 13:24:22 +0800 |
commit | fc1c52175d824161b80938872b20b436e5b5a115 (patch) | |
tree | ede5a83b003fdca2be688d619970d34da0a03545 /camel | |
parent | 3a68f719775b66faeb267cea99879dd659ab1cdf (diff) | |
download | gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar.gz gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar.bz2 gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar.lz gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar.xz gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.tar.zst gsoc2013-evolution-fc1c52175d824161b80938872b20b436e5b5a115.zip |
New filter action to unset a system flag. The exact opposite of set_flag.
2002-07-29 Jeffrey Stedfast <fejj@ximian.com>
* camel-filter-driver.c (unset_flag): New filter action to unset a
system flag. The exact opposite of set_flag.
svn path=/trunk/; revision=17625
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-filter-driver.c | 55 |
2 files changed, 44 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 9242a0f964..93e7d05792 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2002-07-29 Jeffrey Stedfast <fejj@ximian.com> + + * camel-filter-driver.c (unset_flag): New filter action to unset a + system flag. The exact opposite of set_flag. + 2002-07-26 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-local-store.c (get_folder): If the path diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index 09b138f99b..eef5c2fa9e 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -134,7 +134,8 @@ static ESExpResult *do_move (struct _ESExp *f, int argc, struct _ESExpResult **a static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); -static ESExpResult *do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); +static ESExpResult *set_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); +static ESExpResult *unset_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); static ESExpResult *do_shell (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); static ESExpResult *do_beep (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); static ESExpResult *play_sound (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *); @@ -147,18 +148,19 @@ static struct { int type; /* set to 1 if a function can perform shortcut evaluation, or doesn't execute everything, 0 otherwise */ } symbols[] = { - { "delete", (ESExpFunc *) do_delete, 0 }, - { "forward-to", (ESExpFunc *) mark_forward, 0 }, - { "copy-to", (ESExpFunc *) do_copy, 0 }, - { "move-to", (ESExpFunc *) do_move, 0 }, - { "stop", (ESExpFunc *) do_stop, 0 }, - { "set-colour", (ESExpFunc *) do_colour, 0 }, - { "set-score", (ESExpFunc *) do_score, 0 }, - { "set-system-flag", (ESExpFunc *) do_flag, 0 }, - { "shell", (ESExpFunc *) do_shell, 0 }, - { "beep", (ESExpFunc *) do_beep, 0 }, - { "play-sound", (ESExpFunc *) play_sound, 0 }, - { "only-once", (ESExpFunc *) do_only_once, 0 } + { "delete", (ESExpFunc *) do_delete, 0 }, + { "forward-to", (ESExpFunc *) mark_forward, 0 }, + { "copy-to", (ESExpFunc *) do_copy, 0 }, + { "move-to", (ESExpFunc *) do_move, 0 }, + { "stop", (ESExpFunc *) do_stop, 0 }, + { "set-colour", (ESExpFunc *) do_colour, 0 }, + { "set-score", (ESExpFunc *) do_score, 0 }, + { "set-system-flag", (ESExpFunc *) set_flag, 0 }, + { "unset-system-flag", (ESExpFunc *) unset_flag, 0 }, + { "shell", (ESExpFunc *) do_shell, 0 }, + { "beep", (ESExpFunc *) do_beep, 0 }, + { "play-sound", (ESExpFunc *) play_sound, 0 }, + { "only-once", (ESExpFunc *) do_only_once, 0 } }; static CamelObjectClass *camel_filter_driver_parent; @@ -590,16 +592,18 @@ do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDri } static ESExpResult * -do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver) +set_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver) { struct _CamelFilterDriverPrivate *p = _PRIVATE (driver); + guint32 flags; d(fprintf (stderr, "setting flag\n")); if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) { + flags = camel_system_flag (argv[0]->value.string); if (p->source && p->uid && camel_folder_has_summary_capability (p->source)) - camel_folder_set_message_flags(p->source, p->uid, camel_system_flag(argv[0]->value.string), ~0); + camel_folder_set_message_flags (p->source, p->uid, flags, ~0); else - p->info->flags |= camel_system_flag (argv[0]->value.string)|CAMEL_MESSAGE_FOLDER_FLAGGED; + p->info->flags |= flags | CAMEL_MESSAGE_FOLDER_FLAGGED; camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string); } @@ -607,6 +611,25 @@ do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv } static ESExpResult * +unset_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver) +{ + struct _CamelFilterDriverPrivate *p = _PRIVATE (driver); + guint32 flags; + + d(fprintf (stderr, "unsetting flag\n")); + if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) { + flags = camel_system_flag (argv[0]->value.string); + if (p->source && p->uid && camel_folder_has_summary_capability (p->source)) + camel_folder_set_message_flags (p->source, p->uid, flags, 0); + else + p->info->flags = (p->info->flags & ~flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; + camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Unset %s flag", argv[0]->value.string); + } + + return NULL; +} + +static ESExpResult * do_shell (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver) { struct _CamelFilterDriverPrivate *p = _PRIVATE (driver); |