X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fauth.cpp;h=9920e0e40a9dbae0766b5aeaba8fb1fdffb1e763;hb=08a10b8a6a77eb729d609979ee822134d5d7a645;hp=5d61243c693e357e279da5d6ee6f06d7160a0960;hpb=ccae5a49ad55a7c70d3977af33f5ce413abe94df;p=dragonfireclient.git diff --git a/src/auth.cpp b/src/auth.cpp index 5d61243c6..9920e0e40 100644 --- a/src/auth.cpp +++ b/src/auth.cpp @@ -25,6 +25,28 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "strfnd.h" #include "debug.h" +std::set privsToSet(u64 privs) +{ + std::set s; + if(privs & PRIV_BUILD) + s.insert("build"); + if(privs & PRIV_TELEPORT) + s.insert("teleport"); + if(privs & PRIV_SETTIME) + s.insert("settime"); + if(privs & PRIV_PRIVS) + s.insert("privs"); + if(privs & PRIV_SHOUT) + s.insert("shout"); + if(privs & PRIV_BAN) + s.insert("ban"); + if(privs & PRIV_GIVE) + s.insert("give"); + if(privs & PRIV_PASSWORD) + s.insert("password"); + return s; +} + // Convert a privileges value into a human-readable string, // with each component separated by a comma. std::string privsToString(u64 privs) @@ -40,6 +62,12 @@ std::string privsToString(u64 privs) os<<"privs,"; if(privs & PRIV_SHOUT) os<<"shout,"; + if(privs & PRIV_BAN) + os<<"ban,"; + if(privs & PRIV_GIVE) + os<<"give,"; + if(privs & PRIV_PASSWORD) + os<<"password,"; if(os.tellp()) { // Drop the trailing comma. (Why on earth can't @@ -70,6 +98,12 @@ u64 stringToPrivs(std::string str) privs |= PRIV_PRIVS; else if(s == "shout") privs |= PRIV_SHOUT; + else if(s == "ban") + privs |= PRIV_BAN; + else if(s == "give") + privs |= PRIV_GIVE; + else if(s == "password") + privs |= PRIV_PASSWORD; else return PRIV_INVALID; }