diff options
Diffstat (limited to '')
-rw-r--r-- | bounce.c | 4 | ||||
-rw-r--r-- | bounce.h | 4 | ||||
-rw-r--r-- | client.c | 30 | ||||
-rw-r--r-- | state.c | 8 |
4 files changed, 27 insertions, 19 deletions
diff --git a/bounce.c b/bounce.c index e9fcd0b..de455d4 100644 --- a/bounce.c +++ b/bounce.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -413,7 +413,7 @@ int main(int argc, char *argv[]) { if (revents & POLLOUT) { clientConsume(client); if (now - client->idle >= IdleTime) { - clientFormat(client, "PING :%s\r\n", ORIGIN); + clientFormat(client, "PING :%s\r\n", clientOrigin); } } if (revents & POLLIN) clientRecv(client); diff --git a/bounce.h b/bounce.h index 8e6ed09..d714f97 100644 --- a/bounce.h +++ b/bounce.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,6 @@ #endif #define SOURCE_URL "https://git.causal.agency/pounce" -#define ORIGIN "irc.invalid" #define BIT(x) x##Bit, x = 1 << x##Bit, x##Bit_ = x##Bit #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) @@ -226,6 +225,7 @@ struct Client { size_t len; }; extern enum Cap clientCaps; +extern char *clientOrigin; extern char *clientPass; extern char *clientAway; struct Client *clientAlloc(int sock, struct tls *tls); diff --git a/client.c b/client.c index 6d6268d..e364a5a 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +43,7 @@ #include "bounce.h" enum Cap clientCaps = CapServerTime | CapConsumer | CapPassive | CapSTS; +char *clientOrigin = "irc.invalid"; char *clientPass; char *clientAway; @@ -131,7 +132,7 @@ static void passRequired(struct Client *client) { client, ":%s 464 * :Password incorrect\r\n" "ERROR :Password incorrect\r\n", - ORIGIN + clientOrigin ); client->error = true; } @@ -210,12 +211,12 @@ static void handleCap(struct Client *client, struct Message *msg) { if (avail & CapCapNotify) client->caps |= CapCapNotify; clientFormat( client, ":%s CAP * LS :%s\r\n", - ORIGIN, capList(avail, values) + clientOrigin, capList(avail, values) ); } else { clientFormat( client, ":%s CAP * LS :%s\r\n", - ORIGIN, capList(avail, NULL) + clientOrigin, capList(avail, NULL) ); } @@ -230,19 +231,26 @@ static void handleCap(struct Client *client, struct Message *msg) { activeDecr(client); } client->caps |= caps; - clientFormat(client, ":%s CAP * ACK :%s\r\n", ORIGIN, msg->params[1]); + clientFormat( + client, ":%s CAP * ACK :%s\r\n", + clientOrigin, msg->params[1] + ); } else { - clientFormat(client, ":%s CAP * NAK :%s\r\n", ORIGIN, msg->params[1]); + clientFormat( + client, ":%s CAP * NAK :%s\r\n", + clientOrigin, msg->params[1]); } } else if (!strcmp(msg->params[0], "LIST")) { clientFormat( client, ":%s CAP * LIST :%s\r\n", - ORIGIN, capList(client->caps, NULL) + clientOrigin, capList(client->caps, NULL) ); } else { - clientFormat(client, ":%s 410 * :Invalid CAP subcommand\r\n", ORIGIN); + clientFormat( + client, ":%s 410 * :Invalid CAP subcommand\r\n", clientOrigin + ); } } @@ -254,16 +262,16 @@ static void handleAuthenticate(struct Client *client, struct Message *msg) { } else if (cert && !strcmp(msg->params[0], "+")) { clientFormat( client, ":%s 900 * %s * :You are now logged in as *\r\n", - ORIGIN, stateEcho() + clientOrigin, stateEcho() ); clientFormat( client, ":%s 903 * :SASL authentication successful\r\n", - ORIGIN + clientOrigin ); } else { clientFormat( client, ":%s 904 * :SASL authentication failed\r\n", - ORIGIN + clientOrigin ); } } diff --git a/state.c b/state.c index cb9419d..c3fc96c 100644 --- a/state.c +++ b/state.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -393,7 +393,7 @@ void stateSync(struct Client *client) { client, ":%s NOTICE %s :" "pounce is GPLv3 fwee softwawe ^w^ code is avaiwable fwom %s\r\n", - ORIGIN, self.nick, SOURCE_URL + clientOrigin, self.nick, SOURCE_URL ); clientFormat( @@ -444,7 +444,7 @@ void stateSync(struct Client *client) { clientFormat( client, ":%s 422 %s :MOTD File is missing\r\n", - ORIGIN, self.nick + clientOrigin, self.nick ); if (chans.len) assert(self.origin); @@ -454,7 +454,7 @@ void stateSync(struct Client *client) { if (chan->topic) { clientFormat( client, ":%s 332 %s %s :%s\r\n", - ORIGIN, self.nick, chan->name, chan->topic + clientOrigin, self.nick, chan->name, chan->topic ); } if (stateNoNames) continue; |