diff options
author | June McEnroe <june@causal.agency> | 2021-06-10 15:05:15 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-06-10 15:05:15 -0400 |
commit | 423b67d02582275a08b53fd7a9eceb9bc25fd81b (patch) | |
tree | 8c49ca8b31261131f75ecde489203827df6d0acc | |
parent | Use seprintf for snip, removing strlcpyn (diff) | |
download | pounce-423b67d02582275a08b53fd7a9eceb9bc25fd81b.tar.gz pounce-423b67d02582275a08b53fd7a9eceb9bc25fd81b.zip |
Stop accumulating ISUPPORT tokens once MOTD starts
This avoids duplicating tokens when a client sends VERSION and the server responds with its 005s again.
Diffstat (limited to '')
-rw-r--r-- | state.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/state.c b/state.c index 6b26589..85d921a 100644 --- a/state.c +++ b/state.c @@ -205,6 +205,7 @@ static void handleReplyMyInfo(struct Message *msg) { } static struct { + bool done; char **tokens; size_t cap, len; } support; @@ -222,12 +223,18 @@ static void supportAdd(const char *token) { static void handleReplyISupport(struct Message *msg) { require(msg, false, 1); + if (support.done) return; for (size_t i = 1; i < ParamCap; ++i) { if (!msg->params[i] || strchr(msg->params[i], ' ')) break; supportAdd(msg->params[i]); } } +static void handleReplyMOTDStart(struct Message *msg) { + (void)msg; + support.done = true; +} + struct Channel { char *name; char *topic; @@ -339,6 +346,8 @@ static const struct { { "004", handleReplyMyInfo }, { "005", handleReplyISupport }, { "332", handleReplyTopic }, + { "375", handleReplyMOTDStart }, + { "422", handleReplyMOTDStart }, { "433", handleErrorNicknameInUse }, { "437", handleErrorNicknameInUse }, { "900", handleReplyLoggedIn }, |