Commit 43b5b696 authored by louiz’'s avatar louiz’

Add some scopes around various XmlSubNode

parent 9f7782bb
...@@ -122,23 +122,24 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman ...@@ -122,23 +122,24 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
XmlSubNode instructions(x, "instructions"); XmlSubNode instructions(x, "instructions");
instructions.set_inner("Edit the form, to configure your global settings for the component."); instructions.set_inner("Edit the form, to configure your global settings for the component.");
{
XmlSubNode max_histo_length(x, "field"); XmlSubNode max_histo_length(x, "field");
max_histo_length["var"] = "max_history_length"; max_histo_length["var"] = "max_history_length";
max_histo_length["type"] = "text-single"; max_histo_length["type"] = "text-single";
max_histo_length["label"] = "Max history length"; max_histo_length["label"] = "Max history length";
max_histo_length["desc"] = "The maximum number of lines in the history that the server sends when joining a channel"; max_histo_length["desc"] = "The maximum number of lines in the history that the server sends when joining a channel";
{ {
XmlSubNode value(max_histo_length, "value"); XmlSubNode value(max_histo_length, "value");
value.set_inner(std::to_string(options.col<Database::MaxHistoryLength>())); value.set_inner(std::to_string(options.col<Database::MaxHistoryLength>()));
} }
}
{
XmlSubNode record_history(x, "field"); XmlSubNode record_history(x, "field");
record_history["var"] = "record_history"; record_history["var"] = "record_history";
record_history["type"] = "boolean"; record_history["type"] = "boolean";
record_history["label"] = "Record history"; record_history["label"] = "Record history";
record_history["desc"] = "Whether to save the messages into the database, or not"; record_history["desc"] = "Whether to save the messages into the database, or not";
{ {
XmlSubNode value(record_history, "value"); XmlSubNode value(record_history, "value");
value.set_name("value"); value.set_name("value");
...@@ -147,13 +148,14 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman ...@@ -147,13 +148,14 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
else else
value.set_inner("false"); value.set_inner("false");
} }
}
{
XmlSubNode persistent(x, "field"); XmlSubNode persistent(x, "field");
persistent["var"] = "persistent"; persistent["var"] = "persistent";
persistent["type"] = "boolean"; persistent["type"] = "boolean";
persistent["label"] = "Make all channels persistent"; persistent["label"] = "Make all channels persistent";
persistent["desc"] = "If true, all channels will be persistent"; persistent["desc"] = "If true, all channels will be persistent";
{ {
XmlSubNode value(persistent, "value"); XmlSubNode value(persistent, "value");
value.set_name("value"); value.set_name("value");
...@@ -162,6 +164,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman ...@@ -162,6 +164,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
else else
value.set_inner("false"); value.set_inner("false");
} }
}
} }
void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node) void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
...@@ -224,6 +227,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -224,6 +227,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode instructions(x, "instructions"); XmlSubNode instructions(x, "instructions");
instructions.set_inner("Edit the form, to configure the settings of the IRC server "s + server_domain); instructions.set_inner("Edit the form, to configure the settings of the IRC server "s + server_domain);
{
XmlSubNode ports(x, "field"); XmlSubNode ports(x, "field");
ports["var"] = "ports"; ports["var"] = "ports";
ports["type"] = "text-multi"; ports["type"] = "text-multi";
...@@ -234,8 +238,10 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -234,8 +238,10 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode ports_value(ports, "value"); XmlSubNode ports_value(ports, "value");
ports_value.set_inner(val); ports_value.set_inner(val);
} }
}
#ifdef BOTAN_FOUND #ifdef BOTAN_FOUND
{
XmlSubNode tls_ports(x, "field"); XmlSubNode tls_ports(x, "field");
tls_ports["var"] = "tls_ports"; tls_ports["var"] = "tls_ports";
tls_ports["type"] = "text-multi"; tls_ports["type"] = "text-multi";
...@@ -246,7 +252,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -246,7 +252,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode tls_ports_value(tls_ports, "value"); XmlSubNode tls_ports_value(tls_ports, "value");
tls_ports_value.set_inner(val); tls_ports_value.set_inner(val);
} }
}
{
XmlSubNode verify_cert(x, "field"); XmlSubNode verify_cert(x, "field");
verify_cert["var"] = "verify_cert"; verify_cert["var"] = "verify_cert";
verify_cert["type"] = "boolean"; verify_cert["type"] = "boolean";
...@@ -257,7 +265,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -257,7 +265,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
verify_cert_value.set_inner("true"); verify_cert_value.set_inner("true");
else else
verify_cert_value.set_inner("false"); verify_cert_value.set_inner("false");
}
{
XmlSubNode fingerprint(x, "field"); XmlSubNode fingerprint(x, "field");
fingerprint["var"] = "fingerprint"; fingerprint["var"] = "fingerprint";
fingerprint["type"] = "text-single"; fingerprint["type"] = "text-single";
...@@ -267,8 +277,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -267,8 +277,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode fingerprint_value(fingerprint, "value"); XmlSubNode fingerprint_value(fingerprint, "value");
fingerprint_value.set_inner(options.col<Database::TrustedFingerprint>()); fingerprint_value.set_inner(options.col<Database::TrustedFingerprint>());
} }
}
#endif #endif
{
XmlSubNode pass(x, "field"); XmlSubNode pass(x, "field");
pass["var"] = "pass"; pass["var"] = "pass";
pass["type"] = "text-private"; pass["type"] = "text-private";
...@@ -279,7 +290,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -279,7 +290,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode pass_value(pass, "value"); XmlSubNode pass_value(pass, "value");
pass_value.set_inner(options.col<Database::Pass>()); pass_value.set_inner(options.col<Database::Pass>());
} }
}
{
XmlSubNode after_cnt_cmd(x, "field"); XmlSubNode after_cnt_cmd(x, "field");
after_cnt_cmd["var"] = "after_connect_command"; after_cnt_cmd["var"] = "after_connect_command";
after_cnt_cmd["type"] = "text-single"; after_cnt_cmd["type"] = "text-single";
...@@ -290,8 +303,10 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -290,8 +303,10 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode after_cnt_cmd_value(after_cnt_cmd, "value"); XmlSubNode after_cnt_cmd_value(after_cnt_cmd, "value");
after_cnt_cmd_value.set_inner(options.col<Database::AfterConnectionCommand>()); after_cnt_cmd_value.set_inner(options.col<Database::AfterConnectionCommand>());
} }
}
if (Config::get("realname_customization", "true") == "true") if (Config::get("realname_customization", "true") == "true")
{
{ {
XmlSubNode username(x, "field"); XmlSubNode username(x, "field");
username["var"] = "username"; username["var"] = "username";
...@@ -302,7 +317,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -302,7 +317,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode username_value(username, "value"); XmlSubNode username_value(username, "value");
username_value.set_inner(options.col<Database::Username>()); username_value.set_inner(options.col<Database::Username>());
} }
}
{
XmlSubNode realname(x, "field"); XmlSubNode realname(x, "field");
realname["var"] = "realname"; realname["var"] = "realname";
realname["type"] = "text-single"; realname["type"] = "text-single";
...@@ -313,7 +330,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -313,7 +330,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
realname_value.set_inner(options.col<Database::Realname>()); realname_value.set_inner(options.col<Database::Realname>());
} }
} }
}
{
XmlSubNode encoding_out(x, "field"); XmlSubNode encoding_out(x, "field");
encoding_out["var"] = "encoding_out"; encoding_out["var"] = "encoding_out";
encoding_out["type"] = "text-single"; encoding_out["type"] = "text-single";
...@@ -324,7 +343,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -324,7 +343,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode encoding_out_value(encoding_out, "value"); XmlSubNode encoding_out_value(encoding_out, "value");
encoding_out_value.set_inner(options.col<Database::EncodingOut>()); encoding_out_value.set_inner(options.col<Database::EncodingOut>());
} }
}
{
XmlSubNode encoding_in(x, "field"); XmlSubNode encoding_in(x, "field");
encoding_in["var"] = "encoding_in"; encoding_in["var"] = "encoding_in";
encoding_in["type"] = "text-single"; encoding_in["type"] = "text-single";
...@@ -335,6 +356,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com ...@@ -335,6 +356,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode encoding_in_value(encoding_in, "value"); XmlSubNode encoding_in_value(encoding_in, "value");
encoding_in_value.set_inner(options.col<Database::EncodingIn>()); encoding_in_value.set_inner(options.col<Database::EncodingIn>());
} }
}
} }
void ConfigureIrcServerStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node) void ConfigureIrcServerStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node)
...@@ -444,7 +466,6 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -444,7 +466,6 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
auto options = Database::get_irc_channel_options_with_server_default(requester.local + "@" + requester.domain, auto options = Database::get_irc_channel_options_with_server_default(requester.local + "@" + requester.domain,
iid.get_server(), iid.get_local()); iid.get_server(), iid.get_local());
XmlSubNode x(node, "jabber:x:data:x"); XmlSubNode x(node, "jabber:x:data:x");
x["type"] = "form"; x["type"] = "form";
XmlSubNode title(x, "title"); XmlSubNode title(x, "title");
...@@ -452,12 +473,12 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -452,12 +473,12 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
XmlSubNode instructions(x, "instructions"); XmlSubNode instructions(x, "instructions");
instructions.set_inner("Edit the form, to configure the settings of the IRC channel "s + iid.get_local()); instructions.set_inner("Edit the form, to configure the settings of the IRC channel "s + iid.get_local());
{
XmlSubNode record_history(x, "field"); XmlSubNode record_history(x, "field");
record_history["var"] = "record_history"; record_history["var"] = "record_history";
record_history["type"] = "list-single"; record_history["type"] = "list-single";
record_history["label"] = "Record history for this channel"; record_history["label"] = "Record history for this channel";
record_history["desc"] = "If unset, the value is the one configured globally"; record_history["desc"] = "If unset, the value is the one configured globally";
{ {
// Value selected by default // Value selected by default
XmlSubNode value(record_history, "value"); XmlSubNode value(record_history, "value");
...@@ -471,7 +492,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -471,7 +492,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
XmlSubNode value(option, "value"); XmlSubNode value(option, "value");
value.set_inner(val); value.set_inner(val);
} }
}
{
XmlSubNode encoding_out(x, "field"); XmlSubNode encoding_out(x, "field");
encoding_out["var"] = "encoding_out"; encoding_out["var"] = "encoding_out";
encoding_out["type"] = "text-single"; encoding_out["type"] = "text-single";
...@@ -482,7 +505,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -482,7 +505,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
XmlSubNode encoding_out_value(encoding_out, "value"); XmlSubNode encoding_out_value(encoding_out, "value");
encoding_out_value.set_inner(options.col<Database::EncodingOut>()); encoding_out_value.set_inner(options.col<Database::EncodingOut>());
} }
}
{
XmlSubNode encoding_in(x, "field"); XmlSubNode encoding_in(x, "field");
encoding_in["var"] = "encoding_in"; encoding_in["var"] = "encoding_in";
encoding_in["type"] = "text-single"; encoding_in["type"] = "text-single";
...@@ -493,7 +518,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -493,7 +518,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
XmlSubNode encoding_in_value(encoding_in, "value"); XmlSubNode encoding_in_value(encoding_in, "value");
encoding_in_value.set_inner(options.col<Database::EncodingIn>()); encoding_in_value.set_inner(options.col<Database::EncodingIn>());
} }
}
{
XmlSubNode persistent(x, "field"); XmlSubNode persistent(x, "field");
persistent["var"] = "persistent"; persistent["var"] = "persistent";
persistent["type"] = "boolean"; persistent["type"] = "boolean";
...@@ -507,6 +534,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester, ...@@ -507,6 +534,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
else else
value.set_inner("false"); value.set_inner("false");
} }
}
} }
void ConfigureIrcChannelStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node) void ConfigureIrcChannelStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment