summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-23 19:53:26 -0400
committerJune McEnroe <june@causal.agency>2019-10-23 19:53:26 -0400
commitb28f675d5b506edf750eecbdb6e677aac4a27bbf (patch)
treed73364c0ad0fb3c06d7d71549f1333a968b1bb10 /client.c
parentSynchronize state after client registration (diff)
downloadpounce-b28f675d5b506edf750eecbdb6e677aac4a27bbf.tar.gz
pounce-b28f675d5b506edf750eecbdb6e677aac4a27bbf.zip
Rename Command to Message
Diffstat (limited to '')
-rw-r--r--client.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/client.c b/client.c
index 442ed2d..185a277 100644
--- a/client.c
+++ b/client.c
@@ -98,25 +98,25 @@ static void passRequired(struct Client *client) {
 	client->close = true;
 }
 
-typedef void Handler(struct Client *client, struct Command cmd);
+typedef void Handler(struct Client *client, struct Message msg);
 
-static void handleNick(struct Client *client, struct Command cmd) {
-	(void)cmd;
+static void handleNick(struct Client *client, struct Message msg) {
+	(void)msg;
 	client->need &= ~NeedNick;
 	if (!client->need) stateSync(client);
 	if (client->need == NeedPass) passRequired(client);
 }
 
-static void handleUser(struct Client *client, struct Command cmd) {
-	(void)cmd;
+static void handleUser(struct Client *client, struct Message msg) {
+	(void)msg;
 	// TODO: Identify client by username.
 	client->need &= ~NeedUser;
 	if (!client->need) stateSync(client);
 	if (client->need == NeedPass) passRequired(client);
 }
 
-static void handlePass(struct Client *client, struct Command cmd) {
-	if (!cmd.params[0] || strcmp(clientPass, cmd.params[0])) {
+static void handlePass(struct Client *client, struct Message msg) {
+	if (!msg.params[0] || strcmp(clientPass, msg.params[0])) {
 		passRequired(client);
 	} else {
 		client->need &= ~NeedPass;
@@ -124,7 +124,7 @@ static void handlePass(struct Client *client, struct Command cmd) {
 	}
 }
 
-static void handleCap(struct Client *client, struct Command cmd) {
+static void handleCap(struct Client *client, struct Message msg) {
 	// TODO...
 }
 
@@ -139,16 +139,16 @@ static const struct {
 };
 
 static void clientParse(struct Client *client, char *line) {
-	struct Command cmd = parse(line);
-	if (!cmd.name) {
+	struct Message msg = parse(line);
+	if (!msg.cmd) {
 		// FIXME: Identify client in message.
 		warnx("no command");
 		client->close = true;
 		return;
 	}
 	for (size_t i = 0; i < ARRAY_LEN(Handlers); ++i) {
-		if (strcmp(cmd.name, Handlers[i].cmd)) continue;
-		Handlers[i].fn(client, cmd);
+		if (strcmp(msg.cmd, Handlers[i].cmd)) continue;
+		Handlers[i].fn(client, msg);
 		break;
 	}
 }