| 523 | } |
| 524 | |
| 525 | int AddChatUser(const char *nickname) { |
| 526 | Curruser = Firstuser; |
| 527 | while (Curruser) { |
| 528 | if (stricmp(nickname, Curruser->nick_name) == 0) |
| 529 | return 0; |
| 530 | Curruser = Curruser->next; |
| 531 | } |
| 532 | |
| 533 | Curruser = Firstuser; |
| 534 | if (Firstuser == nullptr) { |
| 535 | Firstuser = (Chat_user *)DLLmem_malloc(sizeof(Chat_user)); |
| 536 | // ASSERT(Firstuser); |
| 537 | strcpy(Firstuser->nick_name, nickname); |
| 538 | Firstuser->next = nullptr; |
| 539 | AddChatCommandToQueue(CC_USER_JOINING, nickname, strlen(nickname) + 1); |
| 540 | return 1; |
| 541 | } else { |
| 542 | while (Curruser->next) { |
| 543 | Curruser = Curruser->next; |
| 544 | } |
| 545 | Curruser->next = (Chat_user *)DLLmem_malloc(sizeof(Chat_user)); |
| 546 | Curruser = Curruser->next; |
| 547 | // ASSERT(Curruser); |
| 548 | strcpy(Curruser->nick_name, nickname); |
| 549 | Curruser->next = nullptr; |
| 550 | AddChatCommandToQueue(CC_USER_JOINING, nickname, strlen(nickname) + 1); |
| 551 | return 1; |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | int RemoveChatUser(char *nickname) { |
| 556 | Chat_user *prv_user = nullptr; |
no test coverage detected