1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-01 06:31:04 +01:00

accounts/email: provide realName option for alias (#6106)

This commit is contained in:
eum3l 2025-02-22 07:03:07 +00:00 committed by GitHub
parent f0f0d1ade2
commit c31b4e330e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 14 deletions

View file

@ -49,16 +49,25 @@ let
};
}));
getId = account: address:
if address == account.address then
account.id
else
(builtins.hashString "sha256" (if (builtins.isString address) then
address
else
(address.address + address.realName)));
toThunderbirdIdentity = account: address:
# For backwards compatibility, the primary address reuses the account ID.
let
id = if address == account.address then
account.id
else
builtins.hashString "sha256" address;
id = getId account address;
addressIsString = builtins.isString address;
in {
"mail.identity.id_${id}.fullName" = account.realName;
"mail.identity.id_${id}.useremail" = address;
"mail.identity.id_${id}.fullName" =
if addressIsString then account.realName else address.realName;
"mail.identity.id_${id}.useremail" =
if addressIsString then address else address.address;
"mail.identity.id_${id}.valid" = true;
"mail.identity.id_${id}.htmlSigText" =
if account.signature.showSignature == "none" then
@ -87,9 +96,7 @@ let
addresses = [ account.address ] ++ account.aliases;
in {
"mail.account.account_${id}.identities" = concatStringsSep ","
([ "id_${id}" ]
++ map (address: "id_${builtins.hashString "sha256" address}")
account.aliases);
(map (address: "id_${getId account address}") addresses);
"mail.account.account_${id}.server" = "server_${id}";
} // optionalAttrs account.primary {
"mail.accountmanager.defaultaccount" = "account_${id}";