]> git.lizzy.rs Git - minetest.git/blobdiff - src/auth.cpp
Disable word wrap in vertical texts in main menu
[minetest.git] / src / auth.cpp
index 684391654ab62909484d43d4e12928c389877b0b..fce521e13bec26d4d330a2d75233d0e65c5343e2 100644 (file)
@@ -23,13 +23,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 //#include "main.h" // for g_settings
 #include <sstream>
 #include "strfnd.h"
-#include "debug.h"
+#include "log.h"
 
 std::set<std::string> privsToSet(u64 privs)
 {
        std::set<std::string> s;
-       if(privs & PRIV_BUILD)
-               s.insert("build");
+       if(privs & PRIV_INTERACT)
+               s.insert("interact");
        if(privs & PRIV_TELEPORT)
                s.insert("teleport");
        if(privs & PRIV_SETTIME)
@@ -42,6 +42,8 @@ std::set<std::string> privsToSet(u64 privs)
                s.insert("ban");
        if(privs & PRIV_GIVE)
                s.insert("give");
+       if(privs & PRIV_PASSWORD)
+               s.insert("password");
        return s;
 }
 
@@ -50,8 +52,8 @@ std::set<std::string> privsToSet(u64 privs)
 std::string privsToString(u64 privs)
 {
        std::ostringstream os(std::ios_base::binary);
-       if(privs & PRIV_BUILD)
-               os<<"build,";
+       if(privs & PRIV_INTERACT)
+               os<<"interact,";
        if(privs & PRIV_TELEPORT)
                os<<"teleport,";
        if(privs & PRIV_SETTIME)
@@ -64,6 +66,8 @@ std::string privsToString(u64 privs)
                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
@@ -85,7 +89,9 @@ u64 stringToPrivs(std::string str)
        {
                std::string s = trim(f.next(","));
                if(s == "build")
-                       privs |= PRIV_BUILD;
+                       privs |= PRIV_INTERACT;
+               else if(s == "interact")
+                       privs |= PRIV_INTERACT;
                else if(s == "teleport")
                        privs |= PRIV_TELEPORT;
                else if(s == "settime")
@@ -98,6 +104,8 @@ u64 stringToPrivs(std::string str)
                        privs |= PRIV_BAN;
                else if(s == "give")
                        privs |= PRIV_GIVE;
+               else if(s == "password")
+                       privs |= PRIV_PASSWORD;
                else
                        return PRIV_INVALID;
        }
@@ -115,7 +123,7 @@ AuthManager::AuthManager(const std::string &authfilepath):
        }
        catch(SerializationError &e)
        {
-               dstream<<"WARNING: AuthManager: creating "
+               infostream<<"WARNING: AuthManager: creating "
                                <<m_authfilepath<<std::endl;
        }
 }
@@ -129,11 +137,11 @@ void AuthManager::load()
 {
        JMutexAutoLock lock(m_mutex);
        
-       dstream<<"AuthManager: loading from "<<m_authfilepath<<std::endl;
+       infostream<<"AuthManager: loading from "<<m_authfilepath<<std::endl;
        std::ifstream is(m_authfilepath.c_str(), std::ios::binary);
        if(is.good() == false)
        {
-               dstream<<"AuthManager: failed loading from "<<m_authfilepath<<std::endl;
+               infostream<<"AuthManager: failed loading from "<<m_authfilepath<<std::endl;
                throw SerializationError("AuthManager::load(): Couldn't open file");
        }
 
@@ -175,11 +183,11 @@ void AuthManager::save()
 {
        JMutexAutoLock lock(m_mutex);
        
-       dstream<<"AuthManager: saving to "<<m_authfilepath<<std::endl;
+       infostream<<"AuthManager: saving to "<<m_authfilepath<<std::endl;
        std::ofstream os(m_authfilepath.c_str(), std::ios::binary);
        if(os.good() == false)
        {
-               dstream<<"AuthManager: failed saving to "<<m_authfilepath<<std::endl;
+               infostream<<"AuthManager: failed saving to "<<m_authfilepath<<std::endl;
                throw SerializationError("AuthManager::save(): Couldn't open file");
        }