aboutsummaryrefslogtreecommitdiffstats
path: root/config/accounts.go
Commit message (Collapse)AuthorAgeFilesLines
* config: disable ini reflection for pgp-error-levelRobin Jarry2023-01-111-1/+1
| | | | | | | | | This field must be converted from a string value to an integer manually. The conversion cannot be automated via go ini reflection mechanism. Fixes: 2af81a743048 ("pgp: add configurable error level for opportunistic encryption") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jose Lombera <jose@lombera.dev>
* config: fix accounts backend specific parameters detectionRobin Jarry2023-01-111-16/+2
| | | | | | | | | | | | | | | | Since commit c56027b2e69e ("config: cleanup accounts.conf section parsing"), no backend-specific settings are parsed and stored into account.Params. The logic is completely broken. Any key is specific unless one field of the AccountConfig struct has a matching ini:"key" tag. The fields that are tagged ini:"-" are already handled in the parent switch block. Reported-by: Jose Lombera <jose@lombera.dev> Reported-by: Ben Cohen <ben@bencohen.net> Fixes: c56027b2e69e ("config: cleanup accounts.conf section parsing") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jose Lombera <jose@lombera.dev>
* pgp: add configurable error level for opportunistic encryptionTim Culverhouse2023-01-061-0/+21
| | | | | | | | | | | | | | Add a user-configurable error level for when opportunistic encryption is enabled but the message cannot be encrypted. Set the default level to this as "warn". This config option *only* applies when opportunistic encryption is enabled. If a user tries to manually encrypt a message, an error will still be shown. Don't show encryption status until at least one recipient is added. Fixes: https://todo.sr.ht/~rjarry/aerc/95 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: parse account from and aliases onceRobin Jarry2023-01-041-3/+16
| | | | | | | | | Instead of accepting any garbage for these configuration fields, parse them when parsing accounts.conf and store mail.Address objects. Reuse these objects everywhere. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: cleanup accounts.conf section parsingRobin Jarry2023-01-041-52/+48
| | | | | | | | | | Use go ini reflection capabilities where possible. Mark fields that can be trivially parsed and those who need manual parsing. Restrict backend-specific parameters to ini keys that are not listed as ini struct field tags. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: make various sections accessible via global varsRobin Jarry2022-12-141-5/+7
| | | | | | | | | | | | | | | | | | | | There is only one instance of AercConfig which is associated to the Aerc widget. Everywhere we need to access configuration options, we need somehow to get a reference either to the Aerc widget or to a pointer to the AercConfig instance. This makes the code cluttered. Remove the AercConfig structure and every place where it is referenced. Instead, declare global variables for every configuration section and access them directly from the `config` module. Since bindings and ui sections can be "contextual" (i.e. per account, per folder or per subject), leave most local references intact. Replacing them with config.{Ui,Binds}.For{Account,Folder,Subject} would make this patch even more unreadable. This is something that may be addressed in the future. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* logging: rename package to logRobin Jarry2022-12-021-3/+3
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* logging: homogenize levelsRobin Jarry2022-12-021-1/+1
| | | | | | | | | | | | | | | | | | The main goal is to ensure that by default, the log file (if configured) does not grow out of proportions. Most of the logging messages in aerc are actually for debugging and/or trace purposes. Define clear rules for logging levels. Enforce these rules everywhere. After this patch, here is what the log file looks like after starting up with a single account: INFO 2022/11/24 20:26:16.147164 aerc.go:176: Starting up version 0.13.0-100-g683981479c60 (go1.18.7 amd64 linux) INFO 2022/11/24 20:26:17.546448 account.go:254: [work] connected. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* config: move accounts.conf parsing in separate fileRobin Jarry2022-11-161-0/+256
The config.go file is getting too big. Move accounts.conf parsing logic into a dedicated accounts.go file. No functional change. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>