Commit Graph

12 Commits

Author SHA1 Message Date
Moritz Poldrack 37c1db2ab2 socket: use existing socket if it is connected
When using ephemeral aerc sessions – for example while writing patches
for it – the mailto: functionality breaks if the socket is removed.

Try to send a ping (an empty message) to the socket and remove it, if
the send fails or no noop reply is received.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-09-14 00:03:01 +02:00
Moritz Poldrack 5ca6022d00 lint: ensure errors are at least logged (errcheck)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:57 +02:00
Robin Jarry cd19995557 logging: use level-based logger functions
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>
2022-07-23 22:52:15 +02:00
Koni Marti c24a576876 aerc: use aerc as an mbox viewer
Use Aerc as an mbox viewer. Open an mbox file from the command line in a
new tab with the mbox backend. Provide a convenient and quick way to
display emails from an mbox.

Usage: aerc mbox://<path>

where the path can either be a directory or an mbox file. If it is a
directory, every file with an .mbox suffix will be loaded as a folder.

The account config will be copied from the selected account. This allows
the answer emails in the mbox account.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-07-14 23:14:50 +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
Moritz Poldrack bd65ce1010 add removal of existing sockets
The kept socket after crashes or unclean exits can lead to a unexpected
behaviour. This commit just removes dangling sockets if they exist.
Since the "does not exist" error is the best case scenario error
handling was deemed unnecessary.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-03 21:10:56 +01:00
Daniel Martí 72f55b857b lib: fix an out of bounds panic in the server
If the message doesn't contain ':', we don't properly discard the
message, so we end up slicing it like msg[:-1].

This can be reproduced if one runs 'aerc foo', as the server receives
'foo' as the message.

'aerc foo' still doesn't do anything very user friendly, but at least it
doesn't panic horribly.

While at it, do the 'got message' log at the very beginning, so that the
user can see what message the server got before reporting the command as
invalid.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2020-02-13 10:26:12 -05:00
Heiko Carrasco 70c16fc346 Print success to socket if no error was thrown
When Reto Brunners patch is applied (which works really well for me), the user gets to see the message
returned by AercServer. Since this is nil if no errors were thrown it
prints "result: <nil>" to the cmd. This patch fixes that by just
returning success instead of the error message when err != nil.
2019-09-29 12:36:34 -04:00
Drew DeVault 3d578d376b Fix test failures 2019-07-29 15:44:28 -04:00
Drew DeVault 66a9052f0f Forward mailto links to server via ./aerc <mailto> 2019-07-19 14:34:13 -04:00
Drew DeVault 7a489cb001 Add Unix socket for communicating with aerc 2019-07-19 14:15:48 -04:00