From 85617fe554d6de26b4582ce187df1e2e34921897 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 1 Sep 2019 21:39:52 +0200 Subject: rules.patch applied --- pith/detoken.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'pith/detoken.c') diff --git a/pith/detoken.c b/pith/detoken.c index cb4fc5f3..bc902e35 100644 --- a/pith/detoken.c +++ b/pith/detoken.c @@ -25,7 +25,7 @@ static char rcsid[] = "$Id: detoken.c 769 2007-10-24 00:15:40Z hubert@u.washingt #include "../pith/reply.h" #include "../pith/mailindx.h" #include "../pith/options.h" - +#include "../pith/rules.h" /* * Hook to read signature from local file @@ -91,6 +91,8 @@ detoken(ACTION_S *role, ENVELOPE *env, int prenewlines, int postnewlines, if(is_sig){ /* + * First we check if there is a rule about signatures, if there is + * use it, otherwise keep going and do the following: * If role->litsig is set, we use it; * Else, if VAR_LITERAL_SIG is set, we use that; * Else, if role->sig is set, we use that; @@ -104,14 +106,25 @@ detoken(ACTION_S *role, ENVELOPE *env, int prenewlines, int postnewlines, * there is no reason to mix them, so we don't provide support to * do so. */ - if(role && role->litsig) - literal_sig = role->litsig; - else if(ps_global->VAR_LITERAL_SIG) - literal_sig = ps_global->VAR_LITERAL_SIG; - else if(role && role->sig) - sigfile = role->sig; - else - sigfile = ps_global->VAR_SIGNATURE_FILE; + { RULE_RESULT *rule; + rule = get_result_rule(V_COMPOSE_RULES, FOR_COMPOSE, env); + if (rule){ + sigfile = cpystr(rule->result); + if (rule->result) + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + } + if (!sigfile){ + if(role && role->litsig) + literal_sig = role->litsig; + else if(ps_global->VAR_LITERAL_SIG) + literal_sig = ps_global->VAR_LITERAL_SIG; + else if(role && role->sig) + sigfile = role->sig; + else + sigfile = ps_global->VAR_SIGNATURE_FILE; + } } else if(role && role->template) sigfile = role->template; @@ -302,7 +315,7 @@ top: } } } - else if(pt->what_for & FOR_REPLY_INTRO) + else if(pt->what_for & (FOR_REPLY_INTRO | FOR_RULE)) repl = get_reply_data(env, role, pt->ctype, subbuf, sizeof(subbuf)-1); -- cgit v1.2.3-54-g00ecf