Browse Source

Use #defines for constant strings

GCC hates declaring static consts in headers and not using them, for
some stupid reason.
master
Causal Agent 1 week ago
parent
commit
d8cd384622
Signed by: C. McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
3 changed files with 11 additions and 11 deletions
  1. 3
    3
      bounce.h
  2. 6
    6
      client.c
  3. 2
    2
      state.c

+ 3
- 3
bounce.h View File

@@ -27,13 +27,13 @@
#define CERTBOT_PATH "/usr/local/etc/letsencrypt"
#endif

#define SOURCE_URL "https://code.causal.agency/june/pounce"
#define ORIGIN "irc.invalid"

#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))

typedef unsigned char byte;

static const char *SourceURL = "https://code.causal.agency/june/pounce";
static const char *Origin = "irc.invalid";

bool verbose;

enum { ParamCap = 15 };

+ 6
- 6
client.c View File

@@ -93,7 +93,7 @@ static void passRequired(struct Client *client) {
client,
":%s 464 * :Password incorrect\r\n"
"ERROR :Password incorrect\r\n",
Origin
ORIGIN
);
client->error = true;
}
@@ -150,25 +150,25 @@ static void handleCap(struct Client *client, struct Message *msg) {

} else if (!strcmp(msg->params[0], "LS")) {
if (client->need) client->need |= NeedCapEnd;
clientFormat(client, ":%s CAP * LS :server-time\r\n", Origin);
clientFormat(client, ":%s CAP * LS :server-time\r\n", ORIGIN);

} else if (!strcmp(msg->params[0], "REQ") && msg->params[1]) {
if (client->need) client->need |= NeedCapEnd;
if (!strcmp(msg->params[1], "server-time")) {
client->serverTime = true;
clientFormat(client, ":%s CAP * ACK :server-time\r\n", Origin);
clientFormat(client, ":%s CAP * ACK :server-time\r\n", ORIGIN);
} else {
clientFormat(client, ":%s CAP * NAK :%s\r\n", Origin, msg->params[1]);
clientFormat(client, ":%s CAP * NAK :%s\r\n", ORIGIN, msg->params[1]);
}

} else if (!strcmp(msg->params[0], "LIST")) {
clientFormat(
client, ":%s CAP * LIST :%s\r\n",
Origin, (client->serverTime ? "server-time" : "")
ORIGIN, (client->serverTime ? "server-time" : "")
);

} else {
clientFormat(client, ":%s 410 * :Invalid CAP subcommand\r\n", Origin);
clientFormat(client, ":%s 410 * :Invalid CAP subcommand\r\n", ORIGIN);
}
}


+ 2
- 2
state.c View File

@@ -324,7 +324,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, SourceURL
ORIGIN, self.nick, SOURCE_URL
);

clientFormat(
@@ -373,7 +373,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
ORIGIN, self.nick, chan->name, chan->topic
);
}
if (stateJoinNames) serverFormat("NAMES %s\r\n", chan->name);

Loading…
Cancel
Save