big changes

This commit is contained in:
2023-10-03 17:27:25 -05:00
parent 98c6f995c9
commit 17767b0019
8 changed files with 178 additions and 68 deletions

View File

@@ -49,6 +49,19 @@ public:
}
}
}
if ((conf["responsefile"]).length() > 0) {
std::ifstream rspn(conf["responsefile"]);
std::string rline;
while (std::getline(rspn, rline)) {
if (rline.rfind("#", 0) != 0) {
std::string name = rline.substr(0, rline.find("="));
std::string value = rline.substr(rline.find("=")+1, rline.length());
std::cout << name << ": \"" << value << "\"" << std::endl;
responses[name] = value;
}
}
}
}
PengoConfig operator = (PengoConfig *pc) { return *pc; };
@@ -86,9 +99,18 @@ public:
return worlds;
}
std::string getReply(std::string name) {
return responses[name];
}
std::map<std::string, std::string> getResponses() {
return responses;
}
private:
std::map<std::string, std::string> conf;
std::map<std::string, std::string> worlds;
std::map<std::string, std::string> responses;
std::map<std::string, std::vector<std::string>> messages;
};