]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ipban.qc
Merge remote-tracking branch 'origin/divVerent/allow-override-item-model'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ipban.qc
index 66e5a97e5e817670566c84846573debf29d6dbbe..b40a1e3a289ad682f95cfe8a96b35e83d84a9aa3 100644 (file)
@@ -317,17 +317,26 @@ void Ban_LoadBans()
 
 void Ban_View()
 {
-       float i;
+       float i, n;
        string msg;
+       
+       print("^2Listing all existing active bans:\n");
+       
        for(i = 0; i < ban_count; ++i)
        {
                if(time > ban_expire[i])
                        continue;
+                       
+               ++n; // total number of existing bans
+                       
                msg = strcat("#", ftos(i), ": ");
                msg = strcat(msg, ban_ip[i], " is still banned for ");
                msg = strcat(msg, ftos(ban_expire[i] - time), " seconds");
-               print(msg, "\n");
+               
+               print("  ", msg, "\n");
        }
+       
+       print("^2Done listing all active (", ftos(n), ") bans.\n");
 }
 
 float Ban_GetClientIP(entity client)
@@ -574,79 +583,3 @@ void Ban_KickBanClient(entity client, float bantime, float masksize, string reas
        dropclient(client);
         */
 }
-
-float GameCommand_Ban(string command)
-{
-       float argc;
-       float bantime;
-       entity client;
-       float entno;
-       float masksize;
-       string reason;
-       float reasonarg;
-
-       argc = tokenize_console(command);
-       if(argv(0) == "help")
-       {
-               print("  kickban # n m p reason - kickban player n for m seconds, using mask size p (1 to 4)\n");
-               print("  ban ip m reason - ban an IP or range (incomplete IP, like 1.2.3) for m seconds\n");
-               print("  bans - list all existing bans\n");
-               print("  unban n - delete the entry #n from the bans list\n");
-               return TRUE;
-       }
-       if(argv(0) == "kickban")
-       {
-#define INITARG(c) reasonarg = c
-#define GETARG(v,d) if((argc > reasonarg) && ((v = stof(argv(reasonarg))) != 0)) ++reasonarg; else v = d
-#define RESTARG(v) if(argc > reasonarg) v = substring(command, argv_start_index(reasonarg), strlen(command) - argv_start_index(reasonarg)); else v = ""
-               if(argc >= 3)
-               {
-                       entno = stof(argv(2));
-                       if(entno > maxclients || entno < 1)
-                               return TRUE;
-                       client = edict_num(entno);
-
-                       INITARG(3);
-                       GETARG(bantime, autocvar_g_ban_default_bantime);
-                       GETARG(masksize, autocvar_g_ban_default_masksize);
-                       RESTARG(reason);
-
-                       Ban_KickBanClient(client, bantime, masksize, reason);
-                       return TRUE;
-               }
-       }
-       else if(argv(0) == "ban")
-       {
-               if(argc >= 2)
-               {
-                       string ip;
-                       ip = argv(1);
-
-                       INITARG(2);
-                       GETARG(bantime, autocvar_g_ban_default_bantime);
-                       RESTARG(reason);
-
-                       Ban_Insert(ip, bantime, reason, 1);
-                       return TRUE;
-               }
-#undef INITARG
-#undef GETARG
-#undef RESTARG
-       }
-       else if(argv(0) == "bans")
-       {
-               Ban_View();
-               return TRUE;
-       }
-       else if(argv(0) == "unban")
-       {
-               if(argc >= 2)
-               {
-                       float who;
-                       who = stof(argv(1));
-                       Ban_Delete(who);
-                       return TRUE;
-               }
-       }
-       return FALSE;
-}