https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7826

Michael Storz <sa-...@lrz.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sa-...@lrz.de

--- Comment #71 from Michael Storz <sa-...@lrz.de> ---
I think the whole approach of this rewording is suboptimal. I would strongly
suggest to separate the renaming from the aliases management. The aliases
should be managed by an extra plugin. For this, the plugin must provide two new
commands:

add_eval_alias ALIAS SOURCE
add_command_alias ALIAS SOURCE

Example:
add_eval_alias check_from_in_whitelist check_from_in_welcomelist
add_command_alias whitelist_from welcomelist_from

These alias commands must be written in a central .pre file or in the
respective .pre file of the plugin after the loadplugin statement.

This approach has a number of advantages:
- After renaming, the plugins' code does not need to be touched.
- Depending on how the management of the .pre files is done, the alias commands
could be omitted in a new installation.
- If someone wants to do without the aliases after an upgrade, they could just
delete them.
- If someone would rather use allowlist/denylist or acceptlist/rejectlist for
their rules instead of welcomelist/blocklist, they could simply set aliases
accordingly.

If you want to make it clearer in a next release of SA that the aliases will
soon no longer be supported, you can extend the command for the eval functions
to

add_eval_alias check_from_in_whitelist check_from_in_welcomelist warn="rules:
eval function check_from_in_whitelist deprecated, use check_from_in_welcomelist
instead"

Instead of warn, you could use dbg or info.

If you don't want to go this way, then at least the stubs should be coded
better. Instead of 

sub check_from_in_whitelist {
  return check_from_in_welcomelist(@_);
}

an alias should simply be set in the symbol table:
*check_from_in_whitelist = \&check_from_in_welcomelist;
Then the two functions behave identically.

Or if you want to have the function with warn, then

sub check_from_in_whitelist {
  warn "rules: eval function check_from_in_whitelist deprecated, use
check_from_in_welcomelist instead"
  &check_from_in_welcomelist;
}

Important: Call with & and without arguments so that @_ remains visible for the
called function.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to