Jump to content

[patch][6248] Cli Ban


Guest charlie2025
 Share

Recommended Posts

What bug does the patch fix? What features does the patch add?

Make more better parametr sequence in CLI command BAN - becose reason isn't last parametr, when you type a reason, which has more then one word and there are spaces, system take words as arguments of ban command. In chat interface, Reason is last parametr.

For which SubVersion revision was the patch created?

6245

Who has been writing this patch? Please include either forum user names or email addresses.

Charlie2025

Index: src/mangosd/CliRunnable.cpp
===================================================================
--- src/mangosd/CliRunnable.cpp        (revision 6245)
+++ src/mangosd/CliRunnable.cpp        (working copy)
@@ -469,12 +469,12 @@
        ///- Get the command parameter
        char* type = strtok((char*)command, " ");
        char* nameOrIP = strtok(NULL, " ");
-        char* reason = strtok(NULL," ");
        char* duration = strtok(NULL," ");
+        char* reason = strtok(NULL,"");

        if(!type||!nameOrIP||!reason)                                                     // ?!? input of single char "0"-"9" wouldn't detect when with: || !atoi(duration)
        {
-                zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \\r\\n");
+                zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter ($duration[s|m|h|d]) $reason \\r\\n");
                return;
        }

@@ -493,7 +493,7 @@
                        zprintf("%s %s not found\\r\\n", type, nameOrIP);
                        break;
                case BAN_SYNTAX_ERROR:
-                        zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \\r\\n");
+                        zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter ($duration[s|m|h|d]) $reason \\r\\n");
                        break;
        }
}

Link to comment
Share on other sites

+1 for SVN, this will make the ban CLI command the same format as a .ban ingame command, so you wont get mixed up and set "1d" as the reason... And yes having to type "User123-Hacking-Speed-Op213" is not fun and hard to read afterwards

Link to comment
Share on other sites

A small one in src/mangosd/CliRunnable.cpp:

Line 497 zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter ($duration[s|m|h|d]) $reason \\r\\n");

should then be

Line 497 zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $duration[s|m|h|d] $reason \\r\\n");

as duration is not an optional argument anymore.

(Already corrected in few lines above: 481 zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $duration[s|m|h|d] $reason \\r\\n");

Cheers

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use