diff options
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -32,7 +32,9 @@ void broadcast_message(const char *message, int sender_sock) { for (int i = 0; i < 10; i++) { if (clients[i] && clients[i]->socket != sender_sock && strcmp(clients[i]->room, sender->room) == 0) { - send_to_client(clients[i]->socket, message); + char formatted[BUFFER_SIZE + 100]; + snprintf(formatted, sizeof(formatted), "%s: %s", clients[i]->username, message); + send_to_client(clients[i]->socket, formatted); } } |