[evolution-data-server] evo-I#1512 - Choose account with which to forward message in filter rule
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] evo-I#1512 - Choose account with which to forward message in filter rule
- Date: Fri, 11 Jun 2021 09:33:39 +0000 (UTC)
commit e9c1d171f0a2a49c993e619cd544536577423862
Author: Milan Crha <mcrha redhat com>
Date: Fri Jun 11 11:31:44 2021 +0200
evo-I#1512 - Choose account with which to forward message in filter rule
Passes the value to the CamelSession in a header of the message to be sent,
to avoid an API change.
Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/1512
src/camel/camel-filter-driver.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/camel/camel-filter-driver.c b/src/camel/camel-filter-driver.c
index 74b7829ad..c0cd65665 100644
--- a/src/camel/camel-filter-driver.c
+++ b/src/camel/camel-filter-driver.c
@@ -695,6 +695,8 @@ do_forward_to (struct _CamelSExp *f,
struct _CamelSExpResult **argv,
CamelFilterDriver *driver)
{
+ const gchar *forward_with;
+
d (fprintf (stderr, "marking message for forwarding\n"));
/* requires one parameter, string with a destination address */
@@ -712,10 +714,17 @@ do_forward_to (struct _CamelSExp *f,
return NULL;
}
- camel_filter_driver_log (
- driver, FILTER_LOG_ACTION,
- "Forward message to '%s'",
- argv[0]->value.string);
+ forward_with = (argc > 1 && argv[1]->type == CAMEL_SEXP_RES_STRING) ? argv[1]->value.string : NULL;
+
+ if (forward_with && !*forward_with)
+ forward_with = NULL;
+
+ if (forward_with) {
+ camel_medium_set_header (CAMEL_MEDIUM (driver->priv->message), "X-Evolution-Forward-With",
forward_with);
+ camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Forward message to '%s' with '%s'",
argv[0]->value.string, forward_with);
+ } else {
+ camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Forward message to '%s'",
argv[0]->value.string);
+ }
/* XXX Not cancellable. */
camel_session_forward_to_sync (
@@ -726,6 +735,9 @@ do_forward_to (struct _CamelSExp *f,
NULL,
&driver->priv->error);
+ if (forward_with)
+ camel_medium_remove_header (CAMEL_MEDIUM (driver->priv->message), "X-Evolution-Forward-With");
+
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]