aboutsummaryrefslogtreecommitdiff
path: root/src/ban.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 16:57:41 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 16:57:41 +0100
commit6ccb5835ff55d85156be91473c598eca9d6cb9a6 (patch)
tree7f1eaf8b94694c8e24e206909ba8f55a1ebfbb3e /src/ban.cpp
parent244713971a976e43e8740b6a9d9d122e37020ef2 (diff)
downloaddragonfireclient-6ccb5835ff55d85156be91473c598eca9d6cb9a6.tar.xz
Revert "Make Lint Happy"
This reverts commit ad148587dcf5244c2d2011dba339786c765c54c4.
Diffstat (limited to 'src/ban.cpp')
-rw-r--r--src/ban.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/ban.cpp b/src/ban.cpp
index a6623574f..3decc9666 100644
--- a/src/ban.cpp
+++ b/src/ban.cpp
@@ -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;
}
+