]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/ban.cpp
Revert "Make Lint Happy"
[dragonfireclient.git] / src / ban.cpp
index a6623574f47a294f5f12c87cbb5622d20c892ed3..3decc9666117274c4a7e21d490b4ce567edca655 100644 (file)
@@ -28,12 +28,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "log.h"
 #include "filesys.h"
 
-BanManager::BanManager(const std::string &banfilepath) : m_banfilepath(banfilepath)
+BanManager::BanManager(const std::string &banfilepath):
+               m_banfilepath(banfilepath)
 {
        try {
                load();
-       } catch (SerializationError &e) {
-               infostream << "BanManager: creating " << m_banfilepath << std::endl;
+       } catch(SerializationError &e) {
+               infostream << "BanManager: creating "
+                               << m_banfilepath << std::endl;
        }
 }
 
@@ -45,11 +47,10 @@ BanManager::~BanManager()
 void BanManager::load()
 {
        MutexAutoLock lock(m_mutex);
-       infostream << "BanManager: loading from " << m_banfilepath << std::endl;
+       infostream<<"BanManager: loading from "<<m_banfilepath<<std::endl;
        std::ifstream is(m_banfilepath.c_str(), std::ios::binary);
        if (!is.good()) {
-               infostream << "BanManager: failed loading from " << m_banfilepath
-                          << std::endl;
+               infostream<<"BanManager: failed loading from "<<m_banfilepath<<std::endl;
                throw SerializationError("BanManager::load(): Couldn't open file");
        }
 
@@ -59,7 +60,7 @@ void BanManager::load()
                Strfnd f(line);
                std::string ip = trim(f.next("|"));
                std::string name = trim(f.next("|"));
-               if (!ip.empty()) {
+               if(!ip.empty()) {
                        m_ips[ip] = name;
                }
        }
@@ -76,8 +77,7 @@ void BanManager::save()
                ss << ip.first << "|" << ip.second << "\n";
 
        if (!fs::safeWriteToFile(m_banfilepath, ss.str())) {
-               infostream << "BanManager: failed saving to " << m_banfilepath
-                          << std::endl;
+               infostream << "BanManager: failed saving to " << m_banfilepath << std::endl;
                throw SerializationError("BanManager::save(): Couldn't write file");
        }
 
@@ -95,8 +95,8 @@ std::string BanManager::getBanDescription(const std::string &ip_or_name)
        MutexAutoLock lock(m_mutex);
        std::string s;
        for (const auto &ip : m_ips) {
-               if (ip.first == ip_or_name || ip.second == ip_or_name ||
-                               ip_or_name.empty()) {
+               if (ip.first  == ip_or_name || ip.second == ip_or_name
+                               || ip_or_name.empty()) {
                        s += ip.first + "|" + ip.second + ", ";
                }
        }
@@ -133,8 +133,10 @@ void BanManager::remove(const std::string &ip_or_name)
        }
 }
 
+
 bool BanManager::isModified()
 {
        MutexAutoLock lock(m_mutex);
        return m_modified;
 }
+