aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/archive.go
Commit message (Collapse)AuthorAgeFilesLines
* commands: refactor registrationRobin Jarry2024-01-201-1/+5
| | | | | | | | | | | | | | | | | | 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>
* ui: correct some push status messagesinwit2023-11-121-1/+7
| | | | | | | | | | | Upon success, commands :delete, :copy, :archive and :move show "Messages deleted/copied/archived/moved" in the status bar, which is obviously wrong if they are acting upon only one message. Make the success notification for those commands explicitly agree with the actual number of messages. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* completion: refactor filter list apiRobin Jarry2023-11-021-1/+1
| | | | | | | | | | | | Remove CompletionFromList which is a trivial wrapper around FilterList. Remove the prefix, suffix and isFuzzy arguments from FilterList. Replace prefix, suffix by an optional callback to allow post processing of completion results before presenting them to the user. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
* commands: use completion from go-optRobin Jarry2023-10-281-4/+3
| | | | | | | | | | | 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>
* commands: parse arguments with go-optRobin Jarry2023-10-281-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-11/+11
| | | | | | | | | | | | | | | 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-4/+4
| | | | | | | | | 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>
* archive: respect delimiterMoritz Poldrack2023-05-161-5/+11
| | | | | | | | | | | | Since we now have support for using a server's custom delimiter, it's only right to also make use of this circumstance in the :archive command. Use the provided delimiter to join the path elements in the :archive command. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* send: add option to send&archiveBence Ferdinandy2023-01-041-5/+11
| | | | | | | | | Add `:send -a flat|month|year` to send, which archives the message being replied to. Extract most of archive logic into a separate function to make sure it behaves as manual archiving. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: rename package to logRobin Jarry2022-12-021-2/+2
| | | | | | | | | | 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>
* move and archive: common code for common operationBence Ferdinandy2022-11-131-34/+1
| | | | | | | | | | | | The code of Archive and Move are slightly different, even though they essentially do the same thing sans the destination and archive always creating the destination if it doesn't exist. Extract common code into a function used by both. This will also result in Move now also respecting next-message-on-delete. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* 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>
* view: add peek flag and propagateKoni Marti2022-10-041-1/+1
| | | | | | | | | | | | Add a peek flag -p to the view commands to open the message viewer without setting the "seen" flag. If the flag is set, it would ignore the "auto-mark-read" config. The SetSeen flag will be propagated in case the message viewer moves on to other messages, i.e. with the delete or archive commands. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* viewer: option to not mark message as seenKoni Marti2022-10-041-1/+2
| | | | | | | | | | | | | | | | | Add option to open a message in the message viewer without setting the seen flag. Enables the message viewer to be used as a preview pane without changing the message flags unintentionally. Before, the message viewer would set the seen flag by default. The IMAP backend will now always fetch the message body with the peek option enabled (same as we fetch the headers). An "auto-mark-read" option is added to the ui config which is set to true by default. If set the false, the seen flag is not set by the message viewer. Co-authored-by: "James Cook" <falsifian@falsifian.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* archive: respect the next-message-on-delete flagBen Cohen2022-08-221-1/+31
| | | | | | | | Reuse the next-message-on-delete configuration flag to mirror the behavior of delete when archiving. Signed-off-by: Ben Cohen <ben@bencohen.net> Acked-by: Robin Jarry <robin@jarry.cc>
* store: extract marking behavior and add testsKoni Marti2022-08-221-2/+3
| | | | | | | | Separate the marking functions from the message store and extract the marking behavior into its own class with tests. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-011-2/+4
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: remove invalidate from commands which remove messagesTim Culverhouse2022-08-011-1/+0
| | | | | | | | | | Archive, delete, and move all remove messages from the message store. The commands themselves invalidated the message list. The message list was also invalidated for every MessagesDeleted message received. Remove the call in the command logic to reduce redraws of the message list Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* archive,move: fix reselect next messageTim Culverhouse2022-08-011-1/+5
| | | | | | | | | | Move and Archive used store.Next to select the next message. When moving or archiving multiple messages with an upward movement, this would result in a to-be-removed message being selected. Use findNextNonDeleted function to select the correct next message for these commands. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: leave visual-mark mode after certain commandsTim Culverhouse2022-08-011-0/+2
| | | | | | | | | | | | | | | | Commit "4753cfd visual-mode: deselect messages after performing command" introduced the behavior of leaving visual mark mode after performing certain commands. Add this behavior to additional commands: - Delete - Archive - Move Remark the selected mail files if an error occurred during the operation. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: added a log on panicMoritz Poldrack2022-03-231-0/+3
| | | | | | | | | | | | | Since panics still regularly "destroy" the terminal, it is hard to get a stack trace for panics you do not anticipate. This commit adds a panic handler that automatically creates a logfile inside the current working directory. It has to be added to every goroutine that is started and will repair the terminal on a panic. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* commands: implement fuzzy completion for commands and optionskt programs2022-03-071-1/+1
| | | | | | | | Change the option to enable fuzzy completion to be fuzzy-complete, since it's no longer only used for folders Signed-off-by: Kt Programs <ktprograms@gmail.com> Acked-by: Koni Marti <koni.marti@gmail.com>
* go.mod: change base git urlRobin Jarry2021-11-051-4/+4
| | | | | | | 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>
* Get rid of the aerc.PushError(" " + $string) idiomReto Brunner2021-01-301-1/+1
| | | | The individual callers should not be responsible for padding
* Rework msglist scrollingJeffas2020-06-091-1/+1
| | | | | | | | | | | | This changes the scrolling to be done on the draw, when the height is updated, ensuring that the selected item is kept on screen during resizing. Also, this ensures that messages will fill the screen when resizing the window, for instance, shrinking and then growing drags down more messages if possible. This is a transplant of the dirlist scrolling logic.
* Revert "Add Style configuration"Drew DeVault2020-05-281-1/+1
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Revert "Remove duration from the status methods"Drew DeVault2020-05-281-2/+3
| | | | This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
* Remove duration from the status methodsReto Brunner2020-05-271-3/+2
| | | | We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
* Add Style configurationReto Brunner2020-05-271-1/+1
| | | | | | | | | | The following functionalities are added to configure aerc ui styles. - Read stylesets from file with very basic fnmatch wildcard matching - Add default styleset - Support different stylesets as part of UiConfig allowing contextual styles. - Move widgets/ui elements to use the stylesets. - Add configuration manual for the styleset
* gofmt fixesDrew DeVault2020-04-241-1/+1
|
* Use aerc.PushError where appropriateBen Fiedler2020-04-231-4/+1
| | | | Forgot an unused import, to save you the hassle here is v2.
* msg/archive: complete the possible optionsReto Brunner2020-04-111-1/+2
|
* archive: adapt to ProvidesMessagesReto Brunner2019-12-211-22/+57
|
* all: purge redundant underscoresWagner Riffel2019-09-041-3/+3
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* commands: Don't crash when store is nilKevin Kuehler2019-07-151-1/+4
| | | | | | | On a slow network connection, running these commands without this guard will cause aerc to panic. Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
* Fix crashes when operating on empty folder (#216)Daniel Bridges2019-07-101-1/+4
|
* Implement basic tab completion supportGregory Mullen2019-06-291-2/+12
| | | | | Tab completion currently only works on commands. Contextual completion will be added in the future.
* Move select functionality from msglist to msgstoreKevin Kuehler2019-06-111-1/+2
| | | | | | Remove msglist Next and Prev commands Signed-off-by: Kevin Kuehler <kkuehler@brave.com>
* commands/msg/archive: Work with msgviwerKevin Kuehler2019-06-111-3/+4
| | | | | | | | Inside the generic msg command we cannot use aerc.SelectedAccount() because the method naively assumes the current tab is an AccountView. Use the ProvidesMessage interface instead. Signed-off-by: Kevin Kuehler <kkuehler@brave.com>
* Add archive commandRobert Günzler2019-06-091-0/+62
Adds an archive command that moves the current message into the folder specified in the account config entry. Supports three layouts at this point: - flat: puts all messages next to each other - year: creates a folder per year - month: same as above, plus folders per month This also adds a "-p" argument to "cp" and "mv" that works like "--parents" on mkdir(1). We use this to auto-create the directories for the archive layout.