aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/unsubscribe.go
Commit message (Collapse)AuthorAgeFilesLines
* commands: refactor registrationRobin Jarry2024-01-201-1/+6
| | | | | | | | | | | | | | | | | | Register all commands with the same function and store them in the same map. Use bit flags to determine in which contexts each command should be available. Remove duplicate commands now that the same command can be exposed in multiple contexts. Refactor API to allow executing commands from other commands without import cycles. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* commands: use completion from go-optRobin Jarry2023-10-281-5/+0
| | | | | | | | | | | Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* open: run commands with sh -cRobin Jarry2023-10-281-1/+1
| | | | | | | | | | | Allow running shell commands in openers. Changelog-changed: `:open` commands are now executed with `sh -c`. Requested-by: Vitaly Ovchinnikov <v@postbox.nz> Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: parse arguments with go-optRobin Jarry2023-10-281-19/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the argument parsing framework introduced earlier to unify the parsing of (almost) all command options. Remove custom parsing code and to avoid extraneous types, add fields with `opt` tags on command structs that have options and arguments. Commands that take no argument do not need anything. Since the command objects now carry data, create a new temporary instance of them before passing them to opt.ArgsToStruct when executing a command. A few of the commands use specific semantics for parsing (:choose), or are delegating argument parsing to another function (:sort, :search, :filter). For these commands, simply add a dummy "-" passthrough argument. Since all commands still have the argument list (after split) nothing needs to be changed in this area. There should be no functional change besides the Usage strings and reported errors which are now generated automatically. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* app: export global functionsRobin Jarry2023-10-101-22/+22
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-11/+11
| | | | | | | | | This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* compose: allow changing edit-headers on the flyRobin Jarry2023-07-171-4/+20
| | | | | | | | | Add -e|-E flags to all compose commands to allow switching between edit-headers = true/false without restarting aerc. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* compose: only allow setting content at creationRobin Jarry2023-07-171-1/+1
| | | | | | | | | | | | | Add a parameter for the initial value of the body to be inserted *before* the signature when composing a message. Make AppendContents and SetContents private methods to ensure there is no other way to change the composer contents from the outside after creation. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* openers: add mime type handling for open-linkRobin Jarry2023-03-131-1/+2
| | | | | | | | | Provide a way to configure link openers. Based on the URL mime type: x-scheme-handler/$scheme. Signed-off-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* tabs: use template for compose tabsTim Culverhouse2023-02-121-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | Use a template for compose tabs. Other available values: Account string Subject string To []*mail.Address From []*mail.Address Cc []*mail.Address Bcc []*mail.Address OriginalFrom []*mail.Address When you use To, From, CC, BCC, or OriginalFrom the title will only be updated when an editing field has lost focus. This is so we don't end up calling "PrepareHeader" on every keystroke, which will likely error out anyways since it will be an invalid header. Subject still updates every keystroke. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: add missing panic handlers in goroutinesRobin Jarry2023-01-061-0/+1
| | | | | | | | These issues were all reported by the new custom analyzer introduced in previous commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* templates: change fields as lazy functionsRobin Jarry2023-01-041-2/+1
| | | | | | | | | No need to pre-render fields that are not necessarily accessed in templates. Change fields to functions that are evaluated only when required. 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-1/+0
| | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | 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>
* invalidatable: cleanup dead codeTim Culverhouse2022-10-121-1/+2
| | | | | | | | Remove invalidatable type and all associated calls. All items can directly invalidate the UI. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* open: simplify codeRobin Jarry2022-10-011-3/+5
| | | | | | | | | | | | There is no need for convoluted channels and other async fanciness. Expose a single XDGOpen static function that runs a command and returns an error if any. Caller is responsible of running this in an async goroutine if needed. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* lint: remove redundant returns (S1023)Moritz Poldrack2022-08-041-2/+0
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: fix function parameters being overwritten before they are used (SA4009)Moritz Poldrack2022-08-041-2/+2
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-231-2/+3
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* tabs: rename SelectedTab to SelectedTabContentRobin Jarry2022-07-231-2/+2
| | | | | | | | | This function returns an ui.Drawable. Use a more explicit name. This prepares for adding a new SelectedTab function which will return an ui.Tab. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* unsubscribe: select method with the selector dialogKoni Marti2022-05-311-10/+77
| | | | | | | | | | | | Provide a choice to the user with the selector dialog to select the desired unsubscribe method. Before, the first method that appeared in the list-unsubscribe header was used. For the http method, the user can now also confirm whether he wants to open the provided link in the browser or not. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: always check SelectedAccount return valueRobin Jarry2022-02-251-0/+3
| | | | | | | | | | | | | | | | aerc.SelectedAccount() is used in lots of places. Most of them without checking the return value. In some cases, the currently selected tab is not related to any account (widget.Terminal for example). This can lead to unexpected crashes when accessing account specific configuration. When possible, return an error when no account is currently selected. If no error can be returned, fallback to non-account specific configuration. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com>
* unsubscribe: parse internationalized headersKoni Marti2022-02-191-1/+5
| | | | | | | Fix the parsing of internationalized headers (RFC 6532). Enable unsubscribe to work with regular and encoded headers. Signed-off-by: Koni Marti <koni.marti@gmail.com>
* go.mod: change base git urlRobin Jarry2021-11-051-3/+3
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* Refactor lib/open to accept user provided argumentsReto Brunner2021-01-301-2/+1
| | | | | | | | | | | | * Get rid of open_darwin It just lead to code duplication for a simple one string change. Instead we query it during initialization * Accept user provided arguments "open" on MacOS accepts things like -A to use a specific application Pass trough arguments the user provided in order to facilitate this * Refactor the function to a struct This makes it more convenient for the caller and avoids signatures like lib.OpenFile(nil, u.String(), nil) which are fairly unreadable
* compose: use a proper header instead of a string mapReto Brunner2020-11-141-4/+8
| | | | | | | | | | | | | Prior to this commit, the composer was based on a map[string]string. While this approach was very versatile, it lead to a constant encoding / decoding of addresses and other headers. This commit switches to a different model, where the composer is based on a header. Commands which want to interact with it can simply set some defaults they would like to have. Users can overwrite them however they like. In order to get access to the functions generating / getting the msgid go-message was upgraded.
* Allow open to be asynchronousAndrew Jeffery2020-07-081-1/+1
| | | | | | This stops the ui being blocked while the resource is opened. The wait ensures that resources are reclaimed when the process finishes while aerc is still running.
* Add postpone commandJeffas2020-04-241-0/+1
| | | | | | | This command uses the Postpone folder from the account config to save messages to. Messages are saved as though they were sent so have a valid 'to' recipient address and should be able to be read back in for later editing.
* Make the http handler of the unsubscribe command asyncNicolai Dagestad2020-04-161-1/+2
|
* create OriginalMail structLeszek CimaƂa2020-01-091-0/+2
|
* Add Templates with ParsingSrivathsan Murali2019-11-101-1/+5
| | | | | | | | | | | | | | | + Changes NewComposer to return error. + Add lib to handle templates using "text/template". + Add -T option to following commands - compose. - reply - forward + Quoted replies using templates. + Forwards as body using templates + Default templates are installed similar to filters. + Templates Config in aerc.conf. - Required templates are parsed while loading config. + Add aerc-templates.7 manual for using template data.
* Add signaturesJeffas2019-09-121-0/+1
| | | | | | | | | | | | | This adds the ability for per-account signatures in the accounts.conf config file. The signature is added to emails in the editor at the bottom of the email. This includes when forwarding, replying to, and composing emails. There are two config options: signature-file and signature-cmd. The former allows a signature to be read from a file and the latter allows an arbitrary command to be executed to return the signature. The config options have been documented in aerc-config
* Support configurable header layout in compose widgetDaniel Bridges2019-07-261-5/+9
|
* Fix crashes when operating on empty folder (#216)Daniel Bridges2019-07-101-1/+5
|
* Add unsubscribe commandBen Burwell2019-07-041-0/+103
The unsubscribe command, available when in a message viewer context, enables users to easily unsubscribe from mailing lists. When the command is executed, aerc looks for a List-Unsubscribe header as defined in RFC 2369. If found, aerc will attempt to present the user with a suitable interface for completing the request. Currently, mailto and http(s) URLs are supported. In the case of a HTTP(S) URL, aerc will open the link in a browser. For mailto links, a new composer tab will be opened with a message filled out according to the URL. The message is not sent automatically in order to provide the user a chance to review it first. Closes #101