aboutsummaryrefslogtreecommitdiffstats
path: root/config/accounts.go
Commit message (Collapse)AuthorAgeFilesLines
* send: allow using envelope from addresshrdl2024-10-121-0/+1
| | | | | | | | | | Add a new boolean option in accounts.conf to use the envelope From address instead of the *from* configuration option when submitting via smtp, jmap or sendmail. Changelog-added: New `use-envelope-from` option in `accounts.conf`. Signed-off-by: hrdl <git@hrdl.eu> Acked-by: Robin Jarry <robin@jarry.cc>
* config: add pinentry support to cred commandsKoni Marti2024-10-121-1/+23
| | | | | | | | | Add pinentry support for the source-cred-cmd and outgoing-cred-cmd. Do a little dance around an unallowed import cycle. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* reply: allow copying to current folderRobin Jarry2024-08-031-0/+1
| | | | | | | | | Add a new copy-to-replied setting in accounts.conf to copy sent replies to the same folder than their replied message. Requested-by: Tristan Partin <tristan@partin.io> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tristan Partin <tristan@partin.io>
* templates: add .AccountBackendBence Ferdinandy2024-06-051-1/+21
| | | | | | | | | | | It's useful to know what the current account's backend is, especially if one has multiple configs where the same account name might use a different backend. Add AccountBackend to templates. Changelog-added: Added `{{.AccountBackend}}` to templates. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* accounts: skip accounts with errors instead of exitingBence Ferdinandy2024-06-051-6/+24
| | | | | | | | | | | | | | | | | | | | | | Currently, if something is wrong with an account, say the password command has issues, aerc will exit. When you have multiple accounts, not starting any of them does not make much sense. Instead of exiting, drop the account that failed to parse and log the appropriate error messages. Since the current behaviour when starting aerc with the -a flag is that if the user specifies an account that doesn't exist, aerc exits with an error, the above modification will still lead to aerc exiting when using the -a flag and having an unparsable account. Instead of exiting, log an error message. The only sideeffect of the above modifications, is that in case all the potential accounts are dropped, the user will be shown the new account dialog instead of exiting. Changelog-changed: Unparsable accounts are skipped, instead of aerc exiting with an error. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: allow global options in accounts.confJohannes Thyssen Tishman2024-04-131-0/+7
| | | | | | | | | | | | | Global options may be configured by placing them at the top of the accounts.conf file, before any account-specific sections. These can be overridden for an account by specifying them again in the account section. Changelog-added: Set global options in `accounts.conf` by placing them at the top of the file. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* gpg: add pgp-self-encrypt optionBartkk2024-04-031-0/+1
| | | | | | | | | | Add an option to encrypt outgoing messages to the sender or the key specified in pgp-key-id. Implements: https://todo.sr.ht/~rjarry/aerc/237 Changelog-added: New `pgp-self-encrypt` option in `accounts.conf`. Signed-off-by: Bartkk <bartkk@bartkk.xyz> Acked-by: Robin Jarry <robin@jarry.cc>
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: print file path in error messageMichal Siedlaczek2024-01-251-12/+20
| | | | | | | | | In case of a config parsing error, print the file path of the file in which the error occurred. Fixes: https://todo.sr.ht/~rjarry/aerc/218 Signed-off-by: Michal Siedlaczek <michal@siedlaczek.me> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: allow automatic attachment of signing keyRobin Jarry2024-01-251-0/+1
| | | | | | | | | | | | | | | | | | Add a new pgp-attach-key boolean setting in accounts.conf. When set to true, enabling message signing (either automatically via pgp-auto-sign or manually with :sign) will imply attaching the (public) key that will be used to sign the message before sending. The automatically attached key can be unattached like any other attachment with :detach. Implements: https://todo.sr.ht/~rjarry/aerc/207 Changelog-added: Automatically attach signing key with `pgp-attach-key` in `accounts.conf`. Requested-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Thomas Böhler <witcher@wiredspace.de> Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
* main: add flags to override config filesBence Ferdinandy2024-01-211-8/+10
| | | | | | | | | | | | Add --aerc-conf, --binds-conf and --accounts-conf CLI flags, which respectively override the default aerc.conf, binds.conf and accounts.conf configuration files. If the specified files do not exist or cannot be read, exit with an error. Implements: https://todo.sr.ht/~rjarry/aerc/209 Changelog-added: CLI flags to override paths to config files. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: ensure account order as requestedKoni Marti2023-10-221-1/+5
| | | | | | | | | | | | Ensure the account order as requested by the -a option on the command line. The current sorting is not working correctly, since it sorts Accounts []*AccountConfig by comparing the names instead of the indexes of the requested accounts. Fixes: https://todo.sr.ht/~rjarry/aerc/190 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: use email domain name in Message-IdAdnan Maolood2023-08-281-0/+1
| | | | | | | | | | | | | RFC 5322 recommends using a domain name on the right-hand side of the "@" in Message-Ids. Since the local host domain name cannot be obtained reliably, use the sender email domain name by default. Add a new configuration option to maintain the old behavior. Link: https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6.4 Signed-off-by: Adnan Maolood <adnan@maolood.com> Acked-by: Robin Jarry <robin@jarry.cc>
* wizard: properly initialize configurationRobin Jarry2023-07-151-42/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wizard constructs an AccountConfig object by hand without initializing default values. This causes a crash when replying to an email (rr) just after completing the account creation: ~/.config/aerc/aerc.conf not found, installing the system default~/.config/aerc/binds.conf not found, installing the system defaultpanic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x5d1550] ... regexp.(*Regexp).doExecute(0x7fc1089aa108?, {0x0?, 0x0?}, {0x0?, 0x0?, 0xc000fe5408?}, {0xc000698120?, 0x10?}, 0xad3a40?, 0x2, ...) regexp/exec.go:527 +0x90 regexp.(*Regexp).FindString(0x44e372?, {0xc000698120, 0x27}) regexp/regexp.go:852 +0x6c git.sr.ht/~rjarry/aerc/commands/msg.trimLocalizedRe({0xc000698120, 0x27}, 0xc00003e420?) git.sr.ht/~rjarry/aerc/commands/msg/reply.go:332 +0x36 git.sr.ht/~rjarry/aerc/commands/msg.reply.Execute({}, 0xc0002ba180, {0xc0002f8800?, 0x2, 0x2}) git.sr.ht/~rjarry/aerc/commands/msg/reply.go:157 +0x765 ... Extract the account parsing and initialization into a function. Reuse that function in both accounts.conf parsing and the wizard. Fixes: 40cc540357d9 ("reply: allow to override localized Re regexp in configuration") Reported-by: Mechiel Lukkien <mechiel@ueber.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Andrew Yu <andrew@andrewyu.org>
* headers: enable partial header fetchingTim Culverhouse2023-05-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Enable partial header fetching by creating config values for headers to specifically include, or specifically exclude. The References field will always be fetched, regardless of the include list. Envelope data is always fetched, but is not shown with :toggle-headers, since it isn't in the RFC822 struct unless explicitly included in the list. Partial headers can break the cache on changes. Update the cache tag key to include the state of the partially-fetched headers. Partial header fetching can have a significant performance increase for IMAP, and for all backends a resource improvement. Some data to support this is below. Gathered by opening aerc, selecting a mailbox with approximately 800 messages and scrolling to the end. Received measured with nethogs, RAM from btop Received | RAM ------------------------------------- All Headers | 9,656 kb | 103 MB Minimum Headers | 896 kb | 36 MB Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* accounts: warn for starttls deprecation only onceRobin Jarry2023-04-021-1/+3
| | | | | | | | | | | | | | If the user has several accounts with smtp-starttls=yes set, they will be warned multiple times for each account. This is confusing and may let the user believe that aerc is stuck because closing the dialog seems to have no effect. Only warn once. Fixes: c09b17a930cc ("smtp: replace smtp-starttls with schema option") Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* config: report accounts.conf format errorsRobin Jarry2023-03-261-12/+12
| | | | | | | | | | | When accounts.conf cannot be parsed, return an error instead of assuming that the file is non existent and wrongfully opening the new account wizard. Use the same ini delimiters for all configuration files. Fixes: https://todo.sr.ht/~rjarry/aerc/151 Reported-by: Jon Fineman <jon@fineman.me> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* smtp: replace smtp-starttls with schema optionMarcin Serwin2023-03-261-0/+10
| | | | | | | | | The "smtp-starttls" options is now ignored in favor of more detailed schema specification, similarly to IMAP. Fixes: https://todo.sr.ht/~rjarry/aerc/149 Signed-off-by: Marcin Serwin <marcin.serwin0@protonmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: use reflection to map ini keys to struct fieldsRobin Jarry2023-03-021-102/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default ini.Section.MapTo() function only handles basic types. Implement a more complete mapping solution that allows: * parsing templates, regexps, email addresses * defining a custom parsing method via the `parse:"MethodName"` tag * defining default values via the `default:"value"` tag * parsing rune values with the `type:"rune"` tag The field name must be specified in the `ini:"field-name"` tag as it was before. It is no longer optional. The `delim:"<separator>"` tag remains but can only be used to parse string arrays. It is now possible to override default values with "zero" values. For example: [ui] dirlist-delay = 0 Will override the default "200ms" value. Also: [statusline] status-columns = Will override the default "left<*,center>=,right>*" value. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* 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>