MCPcopy Create free account
hub / github.com/assaultcube/AC / gengbanlist

Function gengbanlist

source/src/master.cpp:280–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280void gengbanlist()
281{
282 messagebuf *l = new messagebuf(gbanlists);
283 const char *header = "cleargbans\n";
284 l->buf.put(header, strlen(header));
285 string cmd = "addgban ";
286 int cmdlen = strlen(cmd);
287 loopv(gbans)
288 {
289 baninfo &b = gbans[i];
290 l->buf.put(cmd, printban(b, &cmd[cmdlen]) - cmd);
291 l->buf.add('\n');
292 }
293 if(gbanlists.length() && gbanlists.last()->equals(*l))
294 {
295 delete l;
296 return;
297 }
298 while(gbanlists.length() && gbanlists.last()->refs<=0)
299 delete gbanlists.pop();
300 loopv(gbanlists)
301 {
302 messagebuf *m = gbanlists[i];
303 if(m->refs > 0 && !m->endswith(*l)) m->concat(*l);
304 }
305 gbanlists.add(l);
306 loopv(mclients)
307 {
308 mclient &c = *mclients[i];
309 if(c.servport >= 0 && !c.message)
310 {
311 c.message = l;
312 c.message->refs++;
313 }
314 }
315}
316
317void addgameserver(mclient &c)
318{

Callers 1

mainFunction · 0.85

Calls 4

equalsMethod · 0.80
putMethod · 0.45
lengthMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected