MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / addBan

Method addBan

Engine/source/app/banList.cpp:70–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68//------------------------------------------------------------------------------
69
70void 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

Callers 1

banList.cppFile · 0.80

Calls 6

dStrcpyFunction · 0.85
dStrnicmpFunction · 0.85
dStrchrFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected