Commit graph

49 commits

Author SHA1 Message Date
Moritz Poldrack
978d35d356 lint: homogenize operations and minor fixes (gocritic)
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>
2022-08-04 21:58:01 +02:00
Moritz Poldrack
aaf0a0c656 lint: apply new formatting rules
Run `make fmt`.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-01 10:44:52 +02:00
Stas Rudakou
ca90343850 outgoing-cred-cmd: delay execution until an email needs to be sent
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>
2022-07-31 19:53:13 +02:00
Robin Jarry
171fefd209 tabs: make fields private
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>
2022-07-23 22:00:25 +02:00
Robin Jarry
c841f36513 tabs: rename SelectedTab to SelectedTabContent
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>
2022-07-23 22:00:21 +02:00
Koni Marti
76b39311dc send: enter no-quit mode until message is sent
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>
2022-07-14 23:15:13 +02:00
Moritz Poldrack
ae83373fa6 logging: added a log on panic
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>
2022-03-23 20:56:09 +01:00
Moritz Poldrack
4bc43d2741 all: fix minor issues found by staticcheck
Signed-off-by: Moritz Poldrack <git@moritz.sh>
2022-03-12 21:00:23 +01:00
Robin Jarry
0d645bcebd go.mod: change base git url
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>
2021-11-05 10:21:45 +01:00
Reto Brunner
8cd2485170 send: fix missing error return 2021-02-28 02:05:12 +01:00
Reto Brunner
2d2010fd42 send: fix crash if invalid password is given 2021-02-05 21:20:17 +01:00
Reto Brunner
9385827cae send: don't block the UI thread during the sending 2021-01-24 18:00:23 +01:00
Reto Brunner
67923707ff Refactor send command 2020-11-21 15:40:50 +01:00
Reto Brunner
24f1c575ae format: remove parse methods, use the one from go-message 2020-11-14 15:40:13 +01:00
Reto Brunner
20ec2c8eeb compose: use a proper header instead of a string map
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.
2020-11-14 15:40:13 +01:00
y0ast
42ce6b41ff propagate error from sendmail 2020-09-22 08:12:38 +02:00
R Chowdhury
f4dc7e1f74 Add oauthbearer support for SMTP
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...
2020-08-13 07:44:43 +02:00
Heiko Carrasco
749dbb93a4 Use PushStatus instead of SetStatus where it makes sense 2020-07-09 08:37:01 +02:00
Drew DeVault
caad1b2c06 Revert "Add Style configuration"
This reverts commit 0f78f06610.
2020-05-28 10:32:42 -04:00
Drew DeVault
76a91813d8 Revert "Remove duration from the status methods"
This reverts commit f06d683688.
2020-05-28 10:32:32 -04:00
Reto Brunner
f06d683688 Remove duration from the status methods
We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
2020-05-27 08:11:40 +02:00
Reto Brunner
0f78f06610 Add Style configuration
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
2020-05-27 07:57:10 +02:00
Srivathsan Murali
b1eb7ad18d Set AnsweredFlag on successful reply 2020-05-25 11:29:53 -04:00
Drew DeVault
3ba836003a gofmt 2020-05-19 12:11:43 -04:00
elumbella
d8533e897a Show 'Message sent' only for ten seconds instead of permanently 2020-05-11 09:46:57 -04:00
Drew DeVault
6f8ad91824 gofmt fixes 2020-04-24 12:59:40 -04:00
Ben Fiedler
7c89143c70 Use aerc.PushError where appropriate
Forgot an unused import, to save you the hassle here is v2.
2020-04-23 21:02:45 +02:00
Simon Ser
89f1684ea4 Update dependencies
This brings in some bug fixes.
2020-03-03 16:48:35 -05:00
Galen Abell
6ff3c7a1ba Mark sent messages as "seen" in maildir
- Add maildir flags to complement a messages imap flags
- Set the "seen" flag on sent messages when using the maildir backend
- Cleanup AppendMessage interface to use models.Flag for both IMAP and
  maildir
2020-03-03 20:08:37 +01:00
Luke Drummond
331b915139 Add support for AUTH LOGIN submission
`go-sasl` upstream added support [1] for the obsolete [2] AUTH LOGIN
method which enables aerc to send email via servers which remain common
in the wild.

Fixes ~sircmpwn/aerc2#263

[1] https://github.com/emersion/go-sasl/commit/61afe53d
[2] https://datatracker.ietf.org/doc/draft-murchison-sasl-login/
2019-11-01 11:02:01 -04:00
Wagner Riffel
6838c23478 all: purge redundant underscores
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
Reto Brunner
c81b3eb1cb Sendmail: allow for arbitrary parameters
Allows the outgoing command to contain arguments and flags
2019-07-29 14:51:12 -04:00
Drew DeVault
d931bbeff1 Add missing fallthrough 2019-07-27 12:36:30 -04:00
Drew DeVault
48758136c0 Implement sendmail support 2019-07-27 11:19:49 -04:00
Gregory Mullen
2a0961701c Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
2019-06-29 14:24:19 -04:00
Drew DeVault
ceeb30abeb Fix Cc & Bcc handling in replies 2019-06-21 14:33:09 -04:00
Yash Srivastav
35f57321f8 Mark sent emails as read 2019-06-08 12:44:01 -04:00
Drew DeVault
cef784bf52 Fix special characters in address.PersonalName 2019-05-25 11:56:56 -04:00
Drew DeVault
cc90cd2161 Pass ServerName to tls.Config for SMTP 2019-05-20 17:25:12 -04:00
Drew DeVault
a9aebe11d7 asdf 2019-05-20 14:01:59 -04:00
Drew DeVault
ca2cd00fe7 Fix scdoc & gofmt issues 2019-05-18 15:34:16 -04:00
Drew DeVault
98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -04:00
Drew DeVault
2ffbe7a6cd Remove debug logging 2019-05-17 11:28:32 -04:00
Drew DeVault
eec2bacede Refactor STARTTLS to prevent downgrade attacks 2019-05-17 11:22:30 -04:00
Drew DeVault
e436780b47 s/Sent/Message sent/ 2019-05-16 23:57:38 -04:00
Drew DeVault
2b3e123cb8 Let caller pass in custom headers to compose 2019-05-16 10:49:50 -04:00
Drew DeVault
b0bf09b98f Copy sent emails to the Sent folder
Or rather, to a user-specified folder
2019-05-15 19:41:21 -04:00
Drew DeVault
254e6fe73f Remove tab before going async
To prevent repeated attempts to send
2019-05-14 14:29:50 -04:00
Drew DeVault
f77d7c2c3d Add distinct keybindings for each compose view 2019-05-14 14:27:28 -04:00
Renamed from commands/compose/send-message.go (Browse further)