aboutsummaryrefslogtreecommitdiffstats
path: root/lib/socket.go
Commit message (Collapse)AuthorAgeFilesLines
* socket: extract functionality into ipc packageMoritz Poldrack2023-03-071-146/+0
| | | | | | | | | | | | The current model of files dumped into lib does not follow the general advice not to have "util" classes. Naming the package "lib" does not change that it is a random assortments of functions that have some utility. Extracts socket functionality into it's own package. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: rename package to logRobin Jarry2022-12-021-15/+15
| | | | | | | | | | 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-6/+10
| | | | | | | | | | | | | | | | | | 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>
* socket: use existing socket if it is connectedMoritz Poldrack2022-09-141-2/+4
| | | | | | | | | | | 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>
* lint: ensure errors are at least logged (errcheck)Moritz Poldrack2022-08-041-14/+33
| | | | | Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-231-11/+7
| | | | | | | | | | | | 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>
* aerc: use aerc as an mbox viewerKoni Marti2022-07-141-0/+11
| | | | | | | | | | | | | | | | | 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>
* logging: added a log on panicMoritz Poldrack2022-03-231-1/+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>
* add removal of existing socketsMoritz Poldrack2022-03-031-0/+3
| | | | | | | | | | 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>
* lib: fix an out of bounds panic in the serverDaniel Martí2020-02-131-1/+2
| | | | | | | | | | | | | | | | | 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>
* Print success to socket if no error was thrownHeiko Carrasco2019-09-291-1/+5
| | | | | | | 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.
* Fix test failuresDrew DeVault2019-07-291-1/+1
|
* Forward mailto links to server via ./aerc <mailto>Drew DeVault2019-07-191-0/+17
|
* Add Unix socket for communicating with aercDrew DeVault2019-07-191-0/+82