24 gi.cprintf(NULL, PRINT_HIGH,
"Svcmd_Test_f()\n");
63 #define MAX_IPFILTERS 1024
80 for (i = 0 ; i < 4 ; i++) {
85 for (i = 0 ; i < 4 ; i++) {
86 if (*s < '0' || *s >
'9') {
87 gi.cprintf(NULL, PRINT_HIGH,
"Bad filter address: %s\n", s);
92 while (*s >=
'0' && *s <=
'9') {
105 f->
mask = *(
unsigned *)
m;
125 while (*p && i < 4) {
127 while (*p >=
'0' && *p <=
'9') {
128 m[i] =
m[i] * 10 + (*p -
'0');
131 if (!*p || *p ==
':')
156 gi.cprintf(NULL, PRINT_HIGH,
"Usage: addip <ip-mask>\n");
165 gi.cprintf(NULL, PRINT_HIGH,
"IP filter list is full\n");
186 gi.cprintf(NULL, PRINT_HIGH,
"Usage: sv removeip <ip-mask>\n");
199 gi.cprintf(NULL, PRINT_HIGH,
"Removed.\n");
202 gi.cprintf(NULL, PRINT_HIGH,
"Didn't find %s.\n",
gi.argv(2));
215 gi.cprintf(NULL, PRINT_HIGH,
"Filter list:\n");
218 gi.cprintf(NULL, PRINT_HIGH,
"%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
230 char name[MAX_OSPATH];
236 game =
gi.cvar(
"game",
"", 0);
241 len =
Q_snprintf(name,
sizeof(name),
"%s/listip.cfg",
game->string);
243 if (len >=
sizeof(name)) {
244 gi.cprintf(NULL, PRINT_HIGH,
"File name too long\n");
248 gi.cprintf(NULL, PRINT_HIGH,
"Writing %s.\n", name);
250 f = fopen(name,
"wb");
252 gi.cprintf(NULL, PRINT_HIGH,
"Couldn't open %s\n", name);
256 fprintf(f,
"set filterban %d\n", (
int)
filterban->value);
260 fprintf(f,
"sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
280 if (Q_stricmp(cmd,
"test") == 0)
282 else if (Q_stricmp(cmd,
"addip") == 0)
284 else if (Q_stricmp(cmd,
"removeip") == 0)
286 else if (Q_stricmp(cmd,
"listip") == 0)
288 else if (Q_stricmp(cmd,
"writeip") == 0)
291 gi.cprintf(NULL, PRINT_HIGH,
"Unknown server command \"%s\"\n", cmd);