Add a missing max_history_length field in the IRC server option form

This commit is contained in:
louiz’
2019-11-06 17:23:43 +01:00
parent 34b4caeccf
commit e4a4addaf8
2 changed files with 22 additions and 1 deletions
+18
View File
@@ -387,6 +387,15 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
value.set_inner(std::to_string(options.col<Database::ThrottleLimit>()));
}
{
XmlSubNode max_history_length(x, "field");
max_history_length["var"] = "max_history_length";
max_history_length["type"] = "text-single";
max_history_length["label"] = "Throttle limit";
XmlSubNode value(max_history_length, "value");
value.set_inner(std::to_string(options.col<Database::MaxHistoryLength>()));
}
{
XmlSubNode encoding_out(x, "field");
encoding_out["var"] = "encoding_out";
@@ -514,6 +523,15 @@ void ConfigureIrcServerStep2(XmppComponent& xmpp_component, AdhocSession& sessio
}
}
else if (field->get_tag("var") == "max_history_length" && value)
{
try {
options.col<Database::MaxHistoryLength>() = std::stol(value->get_inner());
} catch (const std::logic_error&) {
options.col<Database::MaxHistoryLength>() = 20;
}
}
else if (field->get_tag("var") == "encoding_out" && value)
options.col<Database::EncodingOut>() = value->get_inner();