aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose
Commit message (Collapse)AuthorAgeFilesLines
* compose: warn before sending without attachmentJason Cox2022-10-171-2/+37
| | | | | | | | | | Prevent the embarrassing forgotten attachment scenario by warning the user before sending a message that may need an attachment but does not have one. Whether a message needs an attachment is determined by testing a configurable regex against the message body. Signed-off-by: Jason Cox <dev@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap,smtp: add XOAUTH2 supportJulian Pidancet2022-10-011-0/+22
| | | | | | | | | | | | | | | | | | | | | Add XOAUTH2 authentication support for IMAP and SMTP. Although XOAUTH2 is now deprecated in favor of OAuthBearer, it is the only way to connect to Office365 since Basic Auth is now completely removed. Since XOAUTH2 is very similar to OAuthBearer and uses the same configuration parameters, this is basically a copy-paste of the existing OAuthBearer code. However, XOAUTH2 support was removed from go-sasl library, so this change reimports the code that was removed from go-sasl and offers it a new home in lib/xoauth2.go. Hopefully it shouldn't be too hard to maintain, being less than 50 SLOC. Link: https://github.com/emersion/go-sasl/commit/7bfe0ed36a21 Implements: https://todo.sr.ht/~rjarry/aerc/78 Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* switch: update status lineKoni Marti2022-09-201-1/+5
| | | | | | | | | Update status line when switching accounts in the composer. Fixes: 371c1a ("commands: add switch-account command for composer") Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* switch: add -n and -p flags for relative switchRobin Jarry2022-09-201-5/+33
| | | | | | | | | Allow switching to next or previous account with switch-account -n and switch-account -p, respectively. By default, these are bound to Alt-n and Alt-p. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* commands: add switch-account command for composerKoni Marti2022-09-191-0/+47
| | | | | | | | | | | | | | | Switch accounts when in the composer mode. When switching accounts, the From header, the crypto status and the address completer will be updated. Accounts can be switched with :switch-account <account-name>. The completions for the switch-account command will list the available accounts. If switch-account is run without arguments, the current account name with the correct usage is displayed. Fixes: https://todo.sr.ht/~rjarry/aerc/72 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* attach: enable path globbingMoritz Poldrack2022-08-301-10/+32
| | | | | | | | | Enable path globbing using Go's standard library globbing capabilities, which allows for attaching multiple files at once. Suggested-by: Anderson John Njahi <johnjahi55@gmail.com> Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-042-15/+13
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-013-20/+15
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* outgoing-cred-cmd: delay execution until an email needs to be sentStas Rudakou2022-07-311-2/+6
| | | | | | | | | | | | | | | | | | This can be useful in cases when: 1. outgoing-cred-cmd requires a user action or confirmation (e.g. when using pass with a Yubikey or similar smart card that requires a user to enter a pin or touch the device when decrypting the password) 2. A user starts aerc frequently, but not all the sessions end up with sending emails 3. So the user only wants to execute outgoing-cred-cmd when the password is really used, so the user doesn't have to enter pin or touch their Yubikey each time aerc starts Signed-off-by: Stas Rudakou <stas@garage22.net> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-231-2/+2
| | | | | | | | | | | | 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: make fields privateRobin Jarry2022-07-232-4/+12
| | | | | | | | | | | | | | The Tabs object exposes an array of Tab objects and the current selected index in that array. The these two fields are sometimes modified in goroutines, which can lead to data races causing fatal out of bounds accesses on the tab array. Hide these fields as private API. Expose only what needs to be seen from the outside. This will prepare for protecting concurrent access with a lock in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* tabs: rename SelectedTab to SelectedTabContentRobin Jarry2022-07-2312-13/+13
| | | | | | | | | 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>
* send: enter no-quit mode until message is sentKoni Marti2022-07-141-0/+7
| | | | | | | | | Protect the sending of a message by entering the no-quit mode. This prevents aerc from exiting with the :quit command until the operation is done or the exit is forced. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* postpone: avoid calling WriteMessage twiceKoni Marti2022-07-101-9/+4
| | | | | | | | Postpone will currently call composer.WriteMessage twice: once for counting the bytes and another time for appending the message. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: refactor attachment handlingKoni Marti2022-07-021-2/+1
| | | | | | | | | | | | Refactor the attachment handling process in the composer. The composer can currently only handle attachments that are stored as files (or pgp keys). This patch removes this limitation so that any message part can be handled as an attachment. With this we can treat files, pgp keys and message parts on an equal footing and it will enable us also to easily forward attachments. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* pgp: add attach key commandTim Culverhouse2022-05-061-0/+32
| | | | | | | | | Add compose command ("attach-key") to attach the public key associated with the sending account. Public key is attached in ascii armor format, with the mimetype set according to RFC 3156 ("application/pgp-keys"). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: check encryption keys before sending messageTim Culverhouse2022-05-061-12/+0
| | | | | | | | | | | | | | | | Add check for public keys of all message recipients (to, cc, and bcc) before sending the message. Adds an OnFocusLost callback to header editors to facilitate a callback for checking keys whenever a new recipient is added (OnChange results in too many keyring checks). Once encryption is initially set, the callbacks are registered. If a public key is not available for any recipient, encryption is turned off. However, notably, the callbacks are still registered meaning as s soon as the user removes the recipients with missing keys, encryption is turned back on. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
* pgp: check for signing key before signing timeTim Culverhouse2022-05-041-1/+4
| | | | | | | | | | Check that the signing key exists when the user issues the :sign command. The signing key ID will be displayed in the security status also, allowing the user to see what key will be used to sign the message. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Jens Grassel <jens@wegtam.com>
* fix: out-of-bounds error in command headerMoritz Poldrack2022-04-061-0/+6
| | | | | | | | This commit fixes an out-of-bound error that happened while parsing commands. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* header: remove trailing colon in header fieldMoritz Poldrack2022-04-061-0/+2
| | | | | | | | With this commit trailing colons in the :header command's field are removed to prevent double-colon-headers from being sent. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: added a log on panicMoritz Poldrack2022-03-232-0/+8
| | | | | | | | | | | | | 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>
* all: fix minor issues found by staticcheckMoritz Poldrack2022-03-121-1/+1
| | | | Signed-off-by: Moritz Poldrack <git@moritz.sh>
* 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>
* aerc: always check SelectedAccount return valueRobin Jarry2022-02-251-1/+5
| | | | | | | | | | | | | | | | 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>
* postpone: re-open review mode on errorKoni Marti2022-02-061-4/+9
| | | | | | | | | re-opens the review UI when the postpone operation fails. Before, the composer would close, even on error, and we would lose the email draft. Now, the user can decide on how to proceed when postponing fails. References: https://lists.sr.ht/~rjarry/aerc-devel/patches/28824 Signed-off-by: Koni Marti <koni.marti@gmail.com>
* pgp: PGP/MIME encryption for outgoing emailsKoni Marti2022-01-071-0/+44
| | | | | | | | | | | | | | | | | | | | | implements PGP/MIME encryption with go-pgpmail. The Encrypt() function of go-pgpmail requires a list of public keys which are taken from the keystore. The keystore is searched for the email addresses of all recipients (to, cc, and bcc). If you want to be able to read the encrypted email afterwards, add yourself as a recipient in either to, cc, or bcc as well. Public keys can be exported from gpg into aerc as follows: $ gpg --export >> ~/.local/share/aerc/keyring.asc When composing a message, the encryption is enabled with the ":encrypt" command. This sets a bool flag in the Composer struct. A reapted application of this command will toggle the flag. The encrypted message can also be signed by using the ":sign" command before or after ":encrypt". References: https://todo.sr.ht/~rjarry/aerc/6 Signed-off-by: Koni Marti <koni.marti@gmail.com>
* pgp: PGP/MIME signing for outgoing emailsKoni Marti2022-01-071-0/+44
| | | | | | | | | | | | | | | | | implements PGP/MIME signing with go-pgpmail. The Sign() function of go-pgpmail requires a private (signing) key. The signing key which matches the senders email address (from field in email header) is looked up in aerc's copy of the keyring. Private keys can be exported from gpg into aerc as follows: $ gpg --export-secret-keys >> ~/.local/share/aerc/keyring.asc A message is signed with the ":sign" command. The sign command sets a bool flag in the Composer struct. Using the command repeatedly will toggle the flag. References: https://todo.sr.ht/~rjarry/aerc/6 Signed-off-by: Koni Marti <koni.marti@gmail.com>
* go.mod: change base git urlRobin Jarry2021-11-0510-17/+17
| | | | | | | 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>
* send: fix missing error returnReto Brunner2021-02-281-0/+4
|
* send: fix crash if invalid password is givenReto Brunner2021-02-051-1/+2
|
* Get rid of the aerc.PushError(" " + $string) idiomReto Brunner2021-01-302-4/+4
| | | | The individual callers should not be responsible for padding
* send: don't block the UI thread during the sendingReto Brunner2021-01-241-35/+34
|
* Refactor send commandReto Brunner2020-11-211-201/+304
|
* allow the loading of existing headersReto Brunner2020-11-141-2/+4
|
* format: remove parse methods, use the one from go-messageReto Brunner2020-11-141-2/+1
|
* compose: use a proper header instead of a string mapReto Brunner2020-11-143-9/+32
| | | | | | | | | | | | | 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.
* propagate error from sendmaily0ast2020-09-221-2/+9
|
* Add `oauthbearer` support for SMTPR Chowdhury2020-08-131-0/+31
| | | | | | | | | This piggybacks on the existing IMAP support, and uses the same configuration format (my local testing example has the IMAP and SMTP lines almost copy-pasted from one another). It's a little clumsy in that a new token is negotiated for every `Send()` command, but it's a start...
* Implement style configuration.Kalyan Sriram2020-08-062-8/+2
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Revert "Implement style configuration."Reto Brunner2020-07-302-2/+8
| | | | This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
* Implement style configuration.Kalyan Sriram2020-07-302-8/+2
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Use PushStatus instead of SetStatus where it makes senseHeiko Carrasco2020-07-091-3/+1
|
* Revert "Add Style configuration"Drew DeVault2020-05-284-10/+16
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Revert "Remove duration from the status methods"Drew DeVault2020-05-284-14/+16
| | | | This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
* Remove duration from the status methodsReto Brunner2020-05-274-16/+14
| | | | We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
* Add Style configurationReto Brunner2020-05-274-16/+10
| | | | | | | | | | 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
* Set AnsweredFlag on successful replySrivathsan Murali2020-05-251-0/+2
|
* gofmtDrew DeVault2020-05-191-1/+1
|
* Show 'Message sent' only for ten seconds instead of permanentlyelumbella2020-05-111-4/+4
|
* Implement :header commandRay Ganardi2020-05-011-0/+74
| | | | | | Usage: *header* [-f] <field> [value] Add a new email header. If the header already exists, -f must be specified to replace the given value.