From b95ed984f8bd2fe413d53d4b8677fe3d04bc1ad9 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 28 Jan 2014 00:08:33 +0100 Subject: implement server configuration loading/saving --- bouncer/ircserver.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'bouncer/ircserver.cpp') diff --git a/bouncer/ircserver.cpp b/bouncer/ircserver.cpp index 8279484..c058f5c 100644 --- a/bouncer/ircserver.cpp +++ b/bouncer/ircserver.cpp @@ -635,3 +635,31 @@ char IRCServer::getEffectivePrefixChar(uint32_t modes) const { return 0; } + + + +void IRCServer::loadFromConfig(std::map &data) { + config.hostname = data["hostname"]; + config.username = data["username"]; + config.realname = data["realname"]; + config.nickname = data["nickname"]; + config.altNick = data["altnick"]; + config.password = data["password"]; + config.useTls = (data["tls"] == "y"); + config.port = atoi(data["port"].c_str()); +} + +void IRCServer::saveToConfig(std::map &data) { + data["type"] = "IRCServer"; + data["hostname"] = config.hostname; + data["username"] = config.username; + data["realname"] = config.realname; + data["nickname"] = config.nickname; + data["altnick"] = config.altNick; + data["password"] = config.password; + data["tls"] = config.useTls ? "y" : "n"; + + char portstr[50]; + snprintf(portstr, sizeof(portstr), "%d", config.port); + data["port"] = portstr; +} -- cgit v1.2.3