diff options
author | June McEnroe <june@causal.agency> | 2022-04-03 17:14:28 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-04-03 17:15:56 -0400 |
commit | 7d2303dca9ce1eba6f3fc7cbe6e418b78c5aa1c1 (patch) | |
tree | 8a274ae9213064849c63410007e754c596c925b4 /client.c | |
parent | Rename client->error to client->remove (diff) | |
download | pounce-7d2303dca9ce1eba6f3fc7cbe6e418b78c5aa1c1.tar.gz pounce-7d2303dca9ce1eba6f3fc7cbe6e418b78c5aa1c1.zip |
Allow quitting pounce from clients
Diffstat (limited to '')
-rw-r--r-- | client.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/client.c b/client.c index a20700d..19296ed 100644 --- a/client.c +++ b/client.c @@ -46,6 +46,7 @@ enum Cap clientCaps = CapServerTime | CapConsumer | CapPassive | CapSTS; char *clientOrigin; char *clientPass; char *clientAway; +char *clientQuit; static size_t active; @@ -279,9 +280,16 @@ static void handleAuthenticate(struct Client *client, struct Message *msg) { } static void handleQuit(struct Client *client, struct Message *msg) { - (void)msg; - clientFormat(client, "ERROR :Detaching\r\n"); - client->remove = true; + const char *mesg = msg->params[0]; + if (mesg && !strncmp(mesg, "pounce", 6) && (!mesg[6] || mesg[6] == ' ')) { + mesg += 6; + mesg += strspn(mesg, " "); + clientQuit = strdup(mesg); + if (!clientQuit) err(EX_OSERR, "strdup"); + } else { + clientFormat(client, "ERROR :Detaching\r\n"); + client->remove = true; + } } static bool hasTag(const char *tags, const char *tag) { |