diff options
author | June McEnroe <june@causal.agency> | 2019-10-28 00:55:47 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-10-28 00:56:09 -0400 |
commit | 8ccc5a2207cebf034051d45961aa7059a7ce656a (patch) | |
tree | a1f24b54965da79e170927a2db9fb7e3f4441cca | |
parent | Move entire login flow to state and reorganize it (diff) | |
download | pounce-8ccc5a2207cebf034051d45961aa7059a7ce656a.tar.gz pounce-8ccc5a2207cebf034051d45961aa7059a7ce656a.zip |
Disallow PRIVMSG/NOTICE before registration
-rw-r--r-- | client.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client.c b/client.c index 3ed8a81..cd9d008 100644 --- a/client.c +++ b/client.c @@ -172,7 +172,11 @@ static void handleQuit(struct Client *client, struct Message *msg) { } static void handlePrivmsg(struct Client *client, struct Message *msg) { - if (!msg->params[0] || !msg->params[1]) return; + if (client->need || !msg->params[0] || !msg->params[1]) { + client->error = true; + return; + } + char line[1024]; snprintf( line, sizeof(line), ":%s %s %s :%s", @@ -181,6 +185,7 @@ static void handlePrivmsg(struct Client *client, struct Message *msg) { size_t diff = ringDiff(client->consumer); ringProduce(line); if (!diff) ringConsume(NULL, client->consumer); + serverFormat("%s %s :%s\r\n", msg->cmd, msg->params[0], msg->params[1]); } |