]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/banning.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / banning.qc
index da495f7962f89210697c4dead7802da99df03d78..f1f2f9fde3c4bac09b9936dbf95ba50391388e96 100644 (file)
 
 void BanCommand_ban(float request, float argc, string command)
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argc >= 2)
-                       {
+                       if (argc >= 2) {
                                string ip = argv(1);
                                float reason_arg, bantime;
                                string reason;
@@ -56,8 +54,7 @@ void BanCommand_ban(float request, float argc, string command)
 
 void BanCommand_banlist(float request)
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
                        Ban_View();
@@ -77,19 +74,16 @@ void BanCommand_banlist(float request)
 
 void BanCommand_kickban(float request, float argc, string command)
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argc >= 2)
-                       {
+                       if (argc >= 2) {
                                entity client = GetIndexedEntity(argc, 1);
                                float accepted = VerifyKickableEntity(client);
                                float reason_arg, bantime, masksize;
                                string reason;
 
-                               if (accepted > 0)
-                               {
+                               if (accepted > 0) {
                                        reason_arg = next_token;
 
                                        GET_BAN_ARG(bantime, autocvar_g_ban_default_bantime);
@@ -99,9 +93,7 @@ void BanCommand_kickban(float request, float argc, string command)
                                        Ban_KickBanClient(client, bantime, masksize, reason);
 
                                        return;
-                               }
-                               else
-                               {
+                               } else {
                                        LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
@@ -122,24 +114,19 @@ void BanCommand_kickban(float request, float argc, string command)
        }
 }
 
-void BanCommand_mute(float request, float argc, string command)  // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey
+void BanCommand_mute(float request, float argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argc >= 2)
-                       {
+                       if (argc >= 2) {
                                entity client = GetFilteredEntity(argv(1));
                                float accepted = VerifyClientEntity(client, true, false);
 
-                               if (accepted > 0)
-                               {
+                               if (accepted > 0) {
                                        CS(client).muted = true;
                                        return;
-                               }
-                               else
-                               {
+                               } else {
                                        LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
@@ -159,33 +146,27 @@ void BanCommand_mute(float request, float argc, string command)  // TODO: Add a
 
 void BanCommand_unban(float request, float argc)
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argv(1))
-                       {
+                       if (argv(1)) {
                                float tmp_number = -1;
                                string tmp_string;
 
-                               if (substring(argv(1), 0, 1) == "#")
-                               {
+                               if (substring(argv(1), 0, 1) == "#") {
                                        tmp_string = substring(argv(1), 1, -1);
 
-                                       if (tmp_string != "") // is it all one token? like #1
+                                       if (tmp_string != "") // is it all one token? like #1
                                                tmp_number = stof(tmp_string);
-                                       else if (argc > 2)    // no, it's two tokens? # 1
+                                       } else if (argc > 2) { // no, it's two tokens? # 1
                                                tmp_number = stof(argv(2));
-                                       else tmp_number = -1;
-                               }
-                               else  // maybe it's ONLY a number?
-                               {
+                                       } else { tmp_number = -1; }
+                               } else { // maybe it's ONLY a number?
                                        tmp_number = stof(argv(1));
 
-                                       if ((tmp_number == 0) && (argv(1) != "0")) tmp_number = -1; }
+                                       if ((tmp_number == 0) && (argv(1) != "0")) { tmp_number = -1; } }
 
-                               if (tmp_number >= 0)
-                               {
+                               if (tmp_number >= 0) {
                                        Ban_Delete(tmp_number);
                                        return;
                                }
@@ -205,22 +186,17 @@ void BanCommand_unban(float request, float argc)
 
 void BanCommand_unmute(float request, float argc)
 {
-       switch (request)
-       {
+       switch (request) {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argc >= 2)
-                       {
+                       if (argc >= 2) {
                                entity client = GetFilteredEntity(argv(1));
                                float accepted = VerifyClientEntity(client, true, false);
 
-                               if (accepted > 0)
-                               {
+                               if (accepted > 0) {
                                        CS(client).muted = false;
                                        return;
-                               }
-                               else
-                               {
+                               } else {
                                        LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".");
                                }
                        }
@@ -278,8 +254,8 @@ void BanCommand_(float request)
 
 void BanCommand_macro_help()
 {
-       #define BAN_COMMAND(name, function, description) \
-               { if (strtolower(description) != "") { LOG_INFO("  ^2", name, "^7: ", description); } }
+#define BAN_COMMAND(name, function, description) \
+       { if (strtolower(description) != "") { LOG_INFO("  ^2", name, "^7: ", description); } }
 
        BAN_COMMANDS(0, 0, "");
 #undef BAN_COMMAND
@@ -287,8 +263,8 @@ void BanCommand_macro_help()
 
 float BanCommand_macro_command(float argc, string command)
 {
-       #define BAN_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(0))) { function; return true; } }
+#define BAN_COMMAND(name, function, description) \
+       { if (name == strtolower(argv(0))) { function; return true; } }
 
        BAN_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
 #undef BAN_COMMAND
@@ -298,8 +274,8 @@ float BanCommand_macro_command(float argc, string command)
 
 float BanCommand_macro_usage(float argc)
 {
-       #define BAN_COMMAND(name, function, description) \
-               { if (name == strtolower(argv(1))) { function; return true; } }
+#define BAN_COMMAND(name, function, description) \
+       { if (name == strtolower(argv(1))) { function; return true; } }
 
        BAN_COMMANDS(CMD_REQUEST_USAGE, argc, "");
 #undef BAN_COMMAND
@@ -309,8 +285,8 @@ float BanCommand_macro_usage(float argc)
 
 void BanCommand_macro_write_aliases(float fh)
 {
-       #define BAN_COMMAND(name, function, description) \
-               { if (strtolower(description) != "") { CMD_Write_Alias("qc_cmd_sv", name, description); } }
+#define BAN_COMMAND(name, function, description) \
+       { if (strtolower(description) != "") { CMD_Write_Alias("qc_cmd_sv", name, description); } }
 
        BAN_COMMANDS(0, 0, "");
 #undef BAN_COMMAND
@@ -325,8 +301,8 @@ float BanCommand(string command)
        // argv:   0    - 1      - 2     - 3
        // cmd     vote - master - login - password
 
-       if (BanCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
-               return true;                             // handled by one of the above GenericCommand_* functions
-
+       if (BanCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
+               return true; // handled by one of the above GenericCommand_* functions
+       }
        return false;
 }