From b9afd7f8f8bbb799ec3e2f6c18edca1593c2c61b Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 5 Apr 2020 11:42:45 -0400 Subject: Log bans and unbans --- litterbox.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/litterbox.c b/litterbox.c index aa6ca1a..4a65166 100644 --- a/litterbox.c +++ b/litterbox.c @@ -585,6 +585,38 @@ static void handleTopic(struct Message *msg) { insertEvent(msg, Topic, msg->params[0], NULL, msg->params[1]); } +static void handleMode(struct Message *msg) { + require(msg, true, 2); + if (!strchr(chanTypes, msg->params[0][0])) return; + insertContext(msg->params[0], false); + insertName(msg); + + bool set = true; + size_t param = 2; + for (char *ch = msg->params[1]; *ch; ++ch) { + if (*ch == '+') { + set = true; + } else if (*ch == '-') { + set = false; + } else if (*ch == 'b') { + if (param >= ParamCap || !msg->params[param]) { + errx(EX_PROTOCOL, "MODE missing ban target"); + } + insertEvent( + msg, (set ? Ban : Unban), msg->params[0], + msg->params[param++], NULL + ); + } else if ( + strchr(prefixModes, *ch) || + strchr(listModes, *ch) || + strchr(paramModes, *ch) || + (set && strchr(setParamModes, *ch)) + ) { + param++; + } + } +} + static void handlePing(struct Message *msg) { require(msg, false, 1); format("PONG :%s\r\n", msg->params[0]); @@ -617,6 +649,7 @@ static const struct Handler { { "ERROR", false, handleError }, { "JOIN", true, handleJoin }, { "KICK", true, handleKick }, + { "MODE", true, handleMode }, { "NICK", true, handleNick }, { "NOTICE", true, handlePrivmsg }, { "PART", true, handlePart }, -- cgit 1.4.1 3601a682fbf9'/>
path: root/tests (unfollow)
Commit message (Expand)Author
2019-06-05global: make 'char *path' const where possibleChristian Hesse
2019-05-20ui-shared: restrict to 15 levelsJason A. Donenfeld
2019-02-23ui-diff,ui-tag: don't use htmlf with non-formatted stringsChris Mayo
2019-02-23ui-ssdiff: resolve HTML5 validation errorsChris Mayo
2019-01-03filters: migrate from luacrypto to luaosslJason A. Donenfeld
2019-01-02ui-shared: fix broken sizeof in title setting and rewriteJason A. Donenfeld
2018-12-09git: update to v2.20.0Christian Hesse
2018-11-25ui-blame: set repo for sbJason A. Donenfeld
2018-11-25auth-filter: pass url with query string attachedJason A. Donenfeld
2018-11-21git: use xz compressed archive for downloadChristian Hesse
2018-10-12git: update to v2.19.1Christian Hesse
2018-09-11ui-ssdiff: ban strcat()Christian Hesse
2018-09-11ui-ssdiff: ban strncpy()Christian Hesse
2018-09-11ui-shared: ban strcat()Christian Hesse
2018-09-11ui-patch: ban sprintf()Christian Hesse
2018-09-11ui-log: ban strncpy()Christian Hesse
2018-09-11ui-log: ban strcpy()Christian Hesse
2018-09-11parsing: ban sprintf()Christian Hesse
2018-09-11parsing: ban strncpy()Christian Hesse
2018-08-28filters: generate anchor links from markdownChristian Hesse
2018-08-03Bump version.Jason A. Donenfeld
2018-08-03clone: fix directory traversalJason A. Donenfeld
2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev