summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-24 18:09:13 -0400
committerJune McEnroe <june@causal.agency>2019-10-24 18:09:13 -0400
commitbc30300f5087458a8de57e79430abb61174b8832 (patch)
treeee4a5b9b580373ebe2518df782d7398e1aee298a /client.c
parentUnset non-blocking on clients (diff)
downloadpounce-bc30300f5087458a8de57e79430abb61174b8832.tar.gz
pounce-bc30300f5087458a8de57e79430abb61174b8832.zip
Register readers by client usernames
Diffstat (limited to '')
-rw-r--r--client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/client.c b/client.c
index 5970bf2..eaa8555 100644
--- a/client.c
+++ b/client.c
@@ -38,6 +38,7 @@ enum Need {
 struct Client {
 	bool error;
 	struct tls *tls;
+	size_t reader;
 	enum Need need;
 	bool serverTime;
 	char buf[4096];
@@ -112,8 +113,11 @@ static void handleNick(struct Client *client, struct Message msg) {
 }
 
 static void handleUser(struct Client *client, struct Message msg) {
-	(void)msg;
-	// TODO: Identify client by username.
+	if (!msg.params[0]) {
+		client->error = true;
+		return;
+	}
+	client->reader = ringReader(msg.params[0]);
 	client->need &= ~NeedUser;
 	if (!client->need) stateSync(client);
 	if (client->need == NeedPass) passRequired(client);