Guess what? Another fix!

This commit is contained in:
Andrew Pamment 2017-03-20 13:35:04 +10:00
parent 14aef25985
commit d4257c2dbc

View File

@ -200,7 +200,7 @@ int main(int argc, char **argv) {
for(k = 0; k < client_count; k++) { for(k = 0; k < client_count; k++) {
if (i != clients[k]->fd && strcmp(clients[k]->nick, "UNKNOWN") != 0) { if (i != clients[k]->fd && strcmp(clients[k]->nick, "UNKNOWN") != 0) {
snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"%s (%s) has joined the chat\" }", clients[j]->nick, clients[j]->bbstag); snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"%s (%s) has joined the chat\" }", clients[j]->nick, clients[j]->bbstag);
if (send(k, buffer, strlen(buffer) + 1, 0) == -1) { if (send(clients[k]->fd, buffer, strlen(buffer) + 1, 0) == -1) {
perror("send"); perror("send");
} }
} }
@ -215,7 +215,7 @@ int main(int argc, char **argv) {
for(k = 0; k < client_count; k++) { for(k = 0; k < client_count; k++) {
if (i != clients[k]->fd && strcmp(clients[k]->nick, "UNKNOWN") != 0) { if (i != clients[k]->fd && strcmp(clients[k]->nick, "UNKNOWN") != 0) {
if (send(k, buf, nbytes, 0) == -1) { if (send(clients[k]->fd, buf, nbytes, 0) == -1) {
perror("send"); perror("send");
} }
} }