From 86a34c39e41c3d179214f267b7a1ec0259a1c609 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 29 Mar 2022 18:00:29 -0400 Subject: Replace ORIGIN #define with clientOrigin variable --- client.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'client.c') 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 +/* Copyright (C) 2019 June McEnroe * * 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 ); } } -- cgit 1.4.1