]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/auth.cpp
Remove stuff made obsolete by making players more ActiveObject-like and raise protoco...
[dragonfireclient.git] / src / auth.cpp
index 5d61243c693e357e279da5d6ee6f06d7160a0960..9920e0e40a9dbae0766b5aeaba8fb1fdffb1e763 100644 (file)
@@ -25,6 +25,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "strfnd.h"
 #include "debug.h"
 
+std::set<std::string> privsToSet(u64 privs)
+{
+       std::set<std::string> 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;
        }