summaryrefslogtreecommitdiff
path: root/bouncer/ircserver.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2014-01-28 00:08:33 +0100
committerTreeki <treeki@gmail.com>2014-01-28 00:08:33 +0100
commitb95ed984f8bd2fe413d53d4b8677fe3d04bc1ad9 (patch)
tree5da2f4d891215fb709f7165644fd4a0c92f1aefd /bouncer/ircserver.cpp
parent277c08cbc35f4cb2b72f1b00ab3e5f8efd2f8fb2 (diff)
downloadbounce4-b95ed984f8bd2fe413d53d4b8677fe3d04bc1ad9.tar.gz
bounce4-b95ed984f8bd2fe413d53d4b8677fe3d04bc1ad9.zip
implement server configuration loading/saving
Diffstat (limited to '')
-rw-r--r--bouncer/ircserver.cpp28
1 files changed, 28 insertions, 0 deletions
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<std::string, std::string> &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<std::string, std::string> &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;
+}