summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/client.c b/client.c
index e783a65..373a282 100644
--- a/client.c
+++ b/client.c
@@ -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);
}
}