Implement /me

This commit is contained in:
Martijn Braam 2020-10-18 00:28:31 +02:00
parent f1ae494273
commit 1c2bf6da12
No known key found for this signature in database
GPG Key ID: C4280ACB000B060F
1 changed files with 4 additions and 1 deletions

5
main.c
View File

@ -884,6 +884,9 @@ handle_input(int fd)
} else if (strncmp(buf, "/shrug", 6) == 0) {
sprintf(buf2, "[%s] ¯\\_(ツ)_/¯", players[pid].name);
broadcast(buf2, fd);
} else if (strncmp(buf, "/me ", 3) == 0) {
sprintf(buf2, " * [%s] %s", players[pid].name, &buf[4]);
broadcast(buf2, fd);
}
} else {
for(int i=0;i<strlen(buf);i++){
@ -891,7 +894,7 @@ handle_input(int fd)
buf[i] = '\0';
}
}
sprintf(buf2, "[%s] %s", players[pid].name, buf);
sprintf(buf2, "[%s]: %s", players[pid].name, buf);
broadcast(buf2, fd);
}
break;