MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / WoM_CheckMotd

Function WoM_CheckMotd

src/Protocol.c:263–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261static cc_bool wom_sendId, wom_sentId;
262
263static void WoM_CheckMotd(void) {
264 cc_string url; char urlBuffer[STRING_SIZE];
265 cc_string motd, host;
266 int index;
267
268 motd = Server.MOTD;
269 if (!motd.length) return;
270 index = String_IndexOfConst(&motd, "cfg=");
271 if (Game_PureClassic || index == -1) return;
272
273 host = String_UNSAFE_SubstringAt(&motd, index + 4);
274 String_InitArray(url, urlBuffer);
275 String_Format1(&url, "http://%s", &host);
276 /* TODO: Replace $U with username */
277 /*url = url.Replace("$U", game.Username); */
278
279 /* Ensure that if the user quickly changes to a different world, env settings from old world aren't
280 applied in the new world if the async 'get env request' didn't complete before the old world was unloaded */
281 wom_identifier = Http_AsyncGetData(&url, HTTP_FLAG_PRIORITY);
282 wom_sendId = true;
283}
284
285static void WoM_CheckSendWomID(void) {
286 static const cc_string msg = String_FromConst("/womid WoMClient-2.0.7");

Callers 1

Classic_StartLoadingFunction · 0.85

Calls 4

String_IndexOfConstFunction · 0.85
String_Format1Function · 0.85
Http_AsyncGetDataFunction · 0.70

Tested by

no test coverage detected