| 397 | } |
| 398 | |
| 399 | int 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 | |
| 430 | void CNetBan::UnbanAll() |
| 431 | { |
nothing calls this directly
no test coverage detected