summary refs log tree commit diff
path: root/litterbox.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-26 14:20:09 -0500
committerJune McEnroe <june@causal.agency>2019-12-26 14:20:09 -0500
commitb3ad8920fcdfa3af72e0e535ae798955e536539b (patch)
treeb8fdfb2ace74f3672cc0c54b10021a377ee9dccd /litterbox.c
parentMake sure context exists in handleReplyTopic (diff)
downloadlitterbox-b3ad8920fcdfa3af72e0e535ae798955e536539b.tar.gz
litterbox-b3ad8920fcdfa3af72e0e535ae798955e536539b.zip
Handle ERROR
Diffstat (limited to 'litterbox.c')
-rw-r--r--litterbox.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/litterbox.c b/litterbox.c
index 2a156b1..3a54bf5 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -436,6 +436,13 @@ static void handlePing(struct Message *msg) {
 	format("PONG :%s\r\n", msg->params[0]);
 }
 
+static void handleError(struct Message *msg) {
+	require(msg, false, 1);
+	tls_close(client);
+	dbClose();
+	errx(EX_UNAVAILABLE, "%s", msg->params[0]);
+}
+
 static const struct {
 	const char *cmd;
 	bool transaction;
@@ -450,6 +457,7 @@ static const struct {
 	{ "375", false, handleReplyMOTDStart },
 	{ "376", true, handleReplyEndOfMOTD },
 	{ "CAP", false, handleCap },
+	{ "ERROR", false, handleError },
 	{ "JOIN", true, handleJoin },
 	{ "KICK", true, handleKick },
 	{ "NICK", true, handleNick },