implementation of registration (not finished)

This commit is contained in:
2025-11-07 17:41:33 +02:00
parent 08d46cffcb
commit 4569bf1f47
3 changed files with 25 additions and 12 deletions
+5 -4
View File
@@ -13,14 +13,15 @@ int process_user_name(char *uname, session *sess) {
return 1;
}
if (!strncmp(uname, "register", sizeof "register")) {
if (!strncmp(uname, "register", sizeof "register"-1)) {
sess->state = OP_REGISTER;
session_send_string(sess, "Your username > ");
return 2;
}
if (!strncmp(uname, "anon", sizeof "anon")) {
sess->state = OP_LOGIN_ANON;
if (!strncmp(uname, "anonymous", sizeof "anonymous")) {
sess->uname = malloc(sizeof "anonymous");
strcpy(sess->uname, "anonymous");
sess->state = OP_WAIT;
session_send_string(sess, "Welcome, Anonymous!");
return 3;
}