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

Function DisconnectFromChatServer

netcon/mtclient/chat_api.cpp:273–301  ·  view source on GitHub ↗

Call it to close the connection. It returns immediately

Source from the content-addressed store, hash-verified

271
272// Call it to close the connection. It returns immediately
273void DisconnectFromChatServer() {
274 if (!Socket_connected)
275 return;
276 SendChatString("/QUIT", 1);
277 shutdown(Chatsock, 2);
278#ifdef WIN32
279 closesocket(Chatsock);
280#else
281 close(Chatsock);
282#endif
283 Socket_connecting = 0;
284 Socket_connected = 0;
285 Input_chat_buffer[0] = '\0';
286 if (User_list) {
287 DLLmem_free(User_list);
288 User_list = nullptr;
289 }
290 if (Chan_list) {
291 DLLmem_free(Chan_list);
292 Chan_list = nullptr;
293 }
294
295 Chat_server_connected = 0;
296 Joining_channel = 0;
297 Joined_channel = 0;
298 RemoveAllChatUsers();
299 FlushChatCommandQueue();
300 FlushChannelList();
301}
302
303// returns NULL if no line is there to print, otherwise returns a string to
304// print (all preformatted of course)

Callers 1

MainMultiplayerMenuFunction · 0.85

Calls 4

SendChatStringFunction · 0.85
RemoveAllChatUsersFunction · 0.85
FlushChatCommandQueueFunction · 0.85
FlushChannelListFunction · 0.85

Tested by

no test coverage detected