MCPcopy Create free account
hub / github.com/cppla/ServerStatus / UnbanByIndex

Method UnbanByIndex

server/src/netban.cpp:399–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399int CNetBan::UnbanByIndex(int Index)
400{
401 int Result;
402 char aBuf[256];
403 CBanAddr *pBan = m_BanAddrPool.Get(Index);
404 if(pBan)
405 {
406 NetToString(&pBan->m_Data, aBuf, sizeof(aBuf));
407 Result = m_BanAddrPool.Remove(pBan);
408 }
409 else
410 {
411 CBanRange *pBan = m_BanRangePool.Get(Index-m_BanAddrPool.Num());
412 if(pBan)
413 {
414 NetToString(&pBan->m_Data, aBuf, sizeof(aBuf));
415 Result = m_BanRangePool.Remove(pBan);
416 }
417 else
418 {
419 dbg_msg("net_ban", "unban failed (invalid index)");
420 return -1;
421 }
422 }
423
424 char aMsg[256];
425 str_format(aMsg, sizeof(aMsg), "unbanned index %i (%s)", Index, aBuf);
426 dbg_msg("net_ban", aMsg);
427 return Result;
428}
429
430void CNetBan::UnbanAll()
431{

Callers

nothing calls this directly

Calls 5

dbg_msgFunction · 0.85
str_formatFunction · 0.85
GetMethod · 0.80
RemoveMethod · 0.80
NumMethod · 0.80

Tested by

no test coverage detected