]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/ban.cpp
Make Lint Happy
[dragonfireclient.git] / src / ban.cpp
index 3decc9666117274c4a7e21d490b4ce567edca655..a6623574f47a294f5f12c87cbb5622d20c892ed3 100644 (file)
@@ -28,14 +28,12 @@ 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;
        }
 }
 
@@ -47,10 +45,11 @@ 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");
        }
 
@@ -60,7 +59,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;
                }
        }
@@ -77,7 +76,8 @@ 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,10 +133,8 @@ void BanManager::remove(const std::string &ip_or_name)
        }
 }
 
-
 bool BanManager::isModified()
 {
        MutexAutoLock lock(m_mutex);
        return m_modified;
 }
-