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

Function GetChatUserList

netcon/mtclient/chat_api.cpp:383–408  ·  view source on GitHub ↗

This function returns a list of users in the current channel, in one string, separated by spaces, terminated by a null (Spaces aren't allowed as part of a nickname)

Source from the content-addressed store, hash-verified

381// string, separated by spaces, terminated by a null
382// (Spaces aren't allowed as part of a nickname)
383char *GetChatUserList() {
384 int iuser_list_length = 0;
385 ;
386 if (User_list) {
387 DLLmem_free(User_list);
388 User_list = nullptr;
389 }
390 if (!Socket_connected)
391 return nullptr;
392
393 Curruser = Firstuser;
394 while (Curruser) {
395 iuser_list_length += strlen(Curruser->nick_name) + 1;
396 Curruser = Curruser->next;
397 }
398 Curruser = Firstuser;
399 User_list = (char *)DLLmem_malloc(iuser_list_length + 1);
400 User_list[0] = '\0';
401 while (Curruser) {
402 strcat(User_list, Curruser->nick_name);
403 strcat(User_list, " ");
404 Curruser = Curruser->next;
405 }
406
407 return User_list;
408}
409
410// Call this to set/join a channel. Since we can't be sure that we will be
411// able to join that channel, check it for completion

Callers 1

MainMultiplayerMenuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected