MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AddChatUser

Function AddChatUser

netcon/mtclient/chat_api.cpp:525–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525int 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
555int RemoveChatUser(char *nickname) {
556 Chat_user *prv_user = nullptr;

Callers 1

ParseIRCMessageFunction · 0.85

Calls 1

AddChatCommandToQueueFunction · 0.85

Tested by

no test coverage detected