| 68 | //------------------------------------------------------------------------------ |
| 69 | |
| 70 | void BanList::addBan(S32 uniqueId, const char *TA, S32 banTime) |
| 71 | { |
| 72 | S32 curTime = Platform::getTime(); |
| 73 | |
| 74 | if(banTime != 0 && banTime < curTime) |
| 75 | return; |
| 76 | |
| 77 | // make sure this bastard isn't already banned on this server |
| 78 | Vector<BanInfo>::iterator i; |
| 79 | for(i = list.begin();i != list.end();i++) |
| 80 | { |
| 81 | if(uniqueId == i->uniqueId) |
| 82 | { |
| 83 | i->bannedUntil = banTime; |
| 84 | return; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | BanInfo b; |
| 89 | dStrcpy(b.transportAddress, TA, 128); |
| 90 | b.uniqueId = uniqueId; |
| 91 | b.bannedUntil = banTime; |
| 92 | |
| 93 | if(!dStrnicmp(b.transportAddress, "ip:", 3)) |
| 94 | { |
| 95 | char *c = dStrchr(b.transportAddress+3, ':'); |
| 96 | if(c) |
| 97 | { |
| 98 | *(c+1) = '*'; |
| 99 | *(c+2) = 0; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | list.push_back(b); |
| 104 | } |
| 105 | |
| 106 | //------------------------------------------------------------------------------ |
| 107 | |