Rename SetDesc to set_desc, and only define it if USE_DATABASE
This commit is contained in:
@@ -15,6 +15,13 @@
|
|||||||
#ifdef USE_DATABASE
|
#ifdef USE_DATABASE
|
||||||
#include <database/database.hpp>
|
#include <database/database.hpp>
|
||||||
#include <database/save.hpp>
|
#include <database/save.hpp>
|
||||||
|
|
||||||
|
static void set_desc(XmlSubNode& field, const char* text)
|
||||||
|
{
|
||||||
|
XmlSubNode desc(field, "desc");
|
||||||
|
desc.set_inner(text);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAS_PUT_TIME
|
#ifndef HAS_PUT_TIME
|
||||||
@@ -23,12 +30,6 @@
|
|||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
static void SetDesc(XmlSubNode &field, const char *text)
|
|
||||||
{
|
|
||||||
XmlSubNode desc(field, "desc");
|
|
||||||
desc.set_inner(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode& command_node)
|
void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode& command_node)
|
||||||
{
|
{
|
||||||
auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
|
auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
|
||||||
@@ -135,7 +136,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
|
|||||||
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";
|
||||||
SetDesc(max_histo_length, "The maximum number of lines in the history that the server sends when joining a channel");
|
set_desc(max_histo_length, "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>()));
|
||||||
@@ -147,7 +148,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
|
|||||||
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";
|
||||||
SetDesc(record_history, "Whether to save the messages into the database, or not");
|
set_desc(record_history, "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");
|
||||||
@@ -163,7 +164,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
|
|||||||
persistent["var"] = "persistent";
|
persistent["var"] = "persistent";
|
||||||
persistent["type"] = "boolean";
|
persistent["type"] = "boolean";
|
||||||
persistent["label"] = "Make all channels persistent";
|
persistent["label"] = "Make all channels persistent";
|
||||||
SetDesc(persistent, "If true, all channels will be persistent");
|
set_desc(persistent, "If true, all channels will be persistent");
|
||||||
{
|
{
|
||||||
XmlSubNode value(persistent, "value");
|
XmlSubNode value(persistent, "value");
|
||||||
value.set_name("value");
|
value.set_name("value");
|
||||||
@@ -244,7 +245,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
field["var"] = "address";
|
field["var"] = "address";
|
||||||
field["type"] = "text-single";
|
field["type"] = "text-single";
|
||||||
field["label"] = "Address";
|
field["label"] = "Address";
|
||||||
SetDesc(field, "The address (hostname or IP) to connect to.");
|
set_desc(field, "The address (hostname or IP) to connect to.");
|
||||||
XmlSubNode value(field, "value");
|
XmlSubNode value(field, "value");
|
||||||
if (options.col<Database::Address>().empty())
|
if (options.col<Database::Address>().empty())
|
||||||
value.set_inner(server_domain);
|
value.set_inner(server_domain);
|
||||||
@@ -257,7 +258,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
ports["var"] = "ports";
|
ports["var"] = "ports";
|
||||||
ports["type"] = "text-multi";
|
ports["type"] = "text-multi";
|
||||||
ports["label"] = "Ports";
|
ports["label"] = "Ports";
|
||||||
SetDesc(ports, "List of ports to try, without TLS. Defaults: 6667.");
|
set_desc(ports, "List of ports to try, without TLS. Defaults: 6667.");
|
||||||
for (const auto& val: utils::split(options.col<Database::Ports>(), ';', false))
|
for (const auto& val: utils::split(options.col<Database::Ports>(), ';', false))
|
||||||
{
|
{
|
||||||
XmlSubNode ports_value(ports, "value");
|
XmlSubNode ports_value(ports, "value");
|
||||||
@@ -271,7 +272,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
tls_ports["var"] = "tls_ports";
|
tls_ports["var"] = "tls_ports";
|
||||||
tls_ports["type"] = "text-multi";
|
tls_ports["type"] = "text-multi";
|
||||||
tls_ports["label"] = "TLS ports";
|
tls_ports["label"] = "TLS ports";
|
||||||
SetDesc(tls_ports, "List of ports to try, with TLS. Defaults: 6697, 6670.");
|
set_desc(tls_ports, "List of ports to try, with TLS. Defaults: 6697, 6670.");
|
||||||
for (const auto& val: utils::split(options.col<Database::TlsPorts>(), ';', false))
|
for (const auto& val: utils::split(options.col<Database::TlsPorts>(), ';', false))
|
||||||
{
|
{
|
||||||
XmlSubNode tls_ports_value(tls_ports, "value");
|
XmlSubNode tls_ports_value(tls_ports, "value");
|
||||||
@@ -284,7 +285,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
verify_cert["var"] = "verify_cert";
|
verify_cert["var"] = "verify_cert";
|
||||||
verify_cert["type"] = "boolean";
|
verify_cert["type"] = "boolean";
|
||||||
verify_cert["label"] = "Verify certificate";
|
verify_cert["label"] = "Verify certificate";
|
||||||
SetDesc(verify_cert, "Whether or not to abort the connection if the server’s TLS certificate is invalid");
|
set_desc(verify_cert, "Whether or not to abort the connection if the server’s TLS certificate is invalid");
|
||||||
XmlSubNode verify_cert_value(verify_cert, "value");
|
XmlSubNode verify_cert_value(verify_cert, "value");
|
||||||
if (options.col<Database::VerifyCert>())
|
if (options.col<Database::VerifyCert>())
|
||||||
verify_cert_value.set_inner("true");
|
verify_cert_value.set_inner("true");
|
||||||
@@ -310,7 +311,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
field["var"] = "nick";
|
field["var"] = "nick";
|
||||||
field["type"] = "text-single";
|
field["type"] = "text-single";
|
||||||
field["label"] = "Nickname";
|
field["label"] = "Nickname";
|
||||||
SetDesc(field, "If set, will override the nickname provided in the initial presence sent to join the first server channel");
|
set_desc(field, "If set, will override the nickname provided in the initial presence sent to join the first server channel");
|
||||||
if (!options.col<Database::Nick>().empty())
|
if (!options.col<Database::Nick>().empty())
|
||||||
{
|
{
|
||||||
XmlSubNode value(field, "value");
|
XmlSubNode value(field, "value");
|
||||||
@@ -323,7 +324,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
pass["var"] = "pass";
|
pass["var"] = "pass";
|
||||||
pass["type"] = "text-private";
|
pass["type"] = "text-private";
|
||||||
pass["label"] = "Server password";
|
pass["label"] = "Server password";
|
||||||
SetDesc(pass, "Will be used in a PASS command when connecting");
|
set_desc(pass, "Will be used in a PASS command when connecting");
|
||||||
if (!options.col<Database::Pass>().empty())
|
if (!options.col<Database::Pass>().empty())
|
||||||
{
|
{
|
||||||
XmlSubNode pass_value(pass, "value");
|
XmlSubNode pass_value(pass, "value");
|
||||||
@@ -335,7 +336,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
XmlSubNode after_cnt_cmd(x, "field");
|
XmlSubNode after_cnt_cmd(x, "field");
|
||||||
after_cnt_cmd["var"] = "after_connect_commands";
|
after_cnt_cmd["var"] = "after_connect_commands";
|
||||||
after_cnt_cmd["type"] = "text-multi";
|
after_cnt_cmd["type"] = "text-multi";
|
||||||
SetDesc(after_cnt_cmd, "Custom IRC commands sent after the connection is established with the server.");
|
set_desc(after_cnt_cmd, "Custom IRC commands sent after the connection is established with the server.");
|
||||||
after_cnt_cmd["label"] = "After-connection IRC commands";
|
after_cnt_cmd["label"] = "After-connection IRC commands";
|
||||||
for (const auto& command: commands)
|
for (const auto& command: commands)
|
||||||
{
|
{
|
||||||
@@ -384,7 +385,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
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";
|
||||||
SetDesc(encoding_out, "The encoding used when sending messages to the IRC server.");
|
set_desc(encoding_out, "The encoding used when sending messages to the IRC server.");
|
||||||
encoding_out["label"] = "Out encoding";
|
encoding_out["label"] = "Out encoding";
|
||||||
if (!options.col<Database::EncodingOut>().empty())
|
if (!options.col<Database::EncodingOut>().empty())
|
||||||
{
|
{
|
||||||
@@ -397,7 +398,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
|
|||||||
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";
|
||||||
SetDesc(encoding_in, "The encoding used to decode message received from the IRC server.");
|
set_desc(encoding_in, "The encoding used to decode message received from the IRC server.");
|
||||||
encoding_in["label"] = "In encoding";
|
encoding_in["label"] = "In encoding";
|
||||||
if (!options.col<Database::EncodingIn>().empty())
|
if (!options.col<Database::EncodingIn>().empty())
|
||||||
{
|
{
|
||||||
@@ -554,7 +555,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
|
|||||||
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";
|
||||||
SetDesc(record_history, "If unset, the value is the one configured globally");
|
set_desc(record_history, "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");
|
||||||
@@ -574,7 +575,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
|
|||||||
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";
|
||||||
SetDesc(encoding_out, "The encoding used when sending messages to the IRC server. Defaults to the server's “out encoding” if unset for the channel");
|
set_desc(encoding_out, "The encoding used when sending messages to the IRC server. Defaults to the server's “out encoding” if unset for the channel");
|
||||||
encoding_out["label"] = "Out encoding";
|
encoding_out["label"] = "Out encoding";
|
||||||
if (!options.col<Database::EncodingOut>().empty())
|
if (!options.col<Database::EncodingOut>().empty())
|
||||||
{
|
{
|
||||||
@@ -587,7 +588,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
|
|||||||
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";
|
||||||
SetDesc(encoding_in, "The encoding used to decode message received from the IRC server. Defaults to the server's “in encoding” if unset for the channel");
|
set_desc(encoding_in, "The encoding used to decode message received from the IRC server. Defaults to the server's “in encoding” if unset for the channel");
|
||||||
encoding_in["label"] = "In encoding";
|
encoding_in["label"] = "In encoding";
|
||||||
if (!options.col<Database::EncodingIn>().empty())
|
if (!options.col<Database::EncodingIn>().empty())
|
||||||
{
|
{
|
||||||
@@ -600,7 +601,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
|
|||||||
XmlSubNode persistent(x, "field");
|
XmlSubNode persistent(x, "field");
|
||||||
persistent["var"] = "persistent";
|
persistent["var"] = "persistent";
|
||||||
persistent["type"] = "boolean";
|
persistent["type"] = "boolean";
|
||||||
SetDesc(persistent, "If set to true, when all XMPP clients have left this channel, biboumi will stay idle in it, without sending a PART command.");
|
set_desc(persistent, "If set to true, when all XMPP clients have left this channel, biboumi will stay idle in it, without sending a PART command.");
|
||||||
persistent["label"] = "Persistent";
|
persistent["label"] = "Persistent";
|
||||||
{
|
{
|
||||||
XmlSubNode value(persistent, "value");
|
XmlSubNode value(persistent, "value");
|
||||||
|
|||||||
Reference in New Issue
Block a user