summaryrefslogtreecommitdiff
path: root/builtin/game/auth.lua
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-05-25 09:22:20 +0200
committerest31 <MTest31@outlook.com>2016-06-03 19:42:57 +0200
commit1e86c89f3614cf298916149a8f13d44ea671da64 (patch)
tree365aefa77161ea38b6e4112f72d58f678df6fb76 /builtin/game/auth.lua
parent7ea4a03c835d68a6fb58aa55aa6a6315ec80b79f (diff)
downloadminetest-1e86c89f3614cf298916149a8f13d44ea671da64.tar.gz
minetest-1e86c89f3614cf298916149a8f13d44ea671da64.tar.bz2
minetest-1e86c89f3614cf298916149a8f13d44ea671da64.zip
Input related generalisations
* Move key types into own file * Use Generalized input methods in game.cpp
Diffstat (limited to 'builtin/game/auth.lua')
0 files changed, 0 insertions, 0 deletions
='n130' href='#n130'>130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "ban.h"
#include <fstream>
#include "threading/mutex_auto_lock.h"
#include <sstream>
#include <set>
#include "util/strfnd.h"
#include "util/string.h"
#include "log.h"
#include "filesys.h"

BanManager::BanManager(const std::string &banfilepath):
		m_banfilepath(banfilepath),
		m_modified(false)
{
	try{
		load();
	}
	catch(SerializationError &e)
	{
		warningstream<<"BanManager: creating "
				<<m_banfilepath<<std::endl;
	}
}

BanManager::~BanManager()
{
	save();
}

void BanManager::load()
{
	MutexAutoLock lock(m_mutex);
	infostream<<"BanManager: loading from "<<m_banfilepath<<std::endl;
	std::ifstream is(m_banfilepath.c_str(), std::ios::binary);
	if(is.good() == false)
	{
		infostream<<"BanManager: failed loading from "<<m_banfilepath<<std::endl;
		throw SerializationError("BanManager::load(): Couldn't open file");
	}

	while(!is.eof() && is.good())
	{
		std::string line;
		std::getline(is, line, '\n');
		Strfnd f(line);