mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
aliases: Drop characters when parsing, and support suffix-specific aliases
Today, when a user sets an alias with drop characters and/or suffixes, those go unused, since we always "clean" addresses before alias resolution. This results in unexpected and surprising behaviour, and it's not properly documented either. This patch resolves this unexpected behaviour as follows: - Drop characters are ignored, both at parsing time and at lookup time. - Lookups are done including the suffixes first, and if that results in no matches, they are retried without suffixes. This results in aliases working more intuitively for the most common use cases: of users wanting to have different aliases for specific suffixes, and not having to care for drop characters. Hooks can be used to get different behaviour if needed, since the first lookup is done with the address as-is. Thanks to znerol@ (lo+github@znerol.ch) for reporting this, and the discussion on how to fix it, in https://github.com/albertito/chasquid/issues/41.
This commit is contained in:
@@ -5,6 +5,9 @@ case "$1" in
|
||||
# Test one naked, one full. These exist in the static aliases file.
|
||||
echo pepe, joan@testserver
|
||||
;;
|
||||
"vic.uña+abc@testserver")
|
||||
echo uña
|
||||
;;
|
||||
"ñandú@testserver")
|
||||
echo "| writemailto ../.data/pipe_alias_worked"
|
||||
;;
|
||||
|
||||
@@ -50,8 +50,11 @@ mail_diff content .data/pipe_alias_worked
|
||||
mkdir -p config/hooks/
|
||||
cp alias-resolve-hook config/hooks/alias-resolve
|
||||
|
||||
# Test email aliases.
|
||||
# Test email aliases via the hook.
|
||||
send_and_check vicuña juan jose
|
||||
send_and_check vi.cu.ña juan jose
|
||||
send_and_check vi.cu.ña+abc juan jose
|
||||
send_and_check vic.uña+abc uña
|
||||
|
||||
# Test the pipe alias separately.
|
||||
rm -f .data/pipe_alias_worked
|
||||
|
||||
Reference in New Issue
Block a user