summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/biboumi.1.md6
-rw-r--r--src/irc/irc_client.cpp14
-rw-r--r--src/xmpp/biboumi_adhoc_commands.cpp48
3 files changed, 41 insertions, 27 deletions
diff --git a/doc/biboumi.1.md b/doc/biboumi.1.md
index 836b99d..d28c3a3 100644
--- a/doc/biboumi.1.md
+++ b/doc/biboumi.1.md
@@ -77,6 +77,12 @@ The configuration file uses a simple format of the form
users join their own IRC server using an XMPP client, while forbidding
access to any other IRC server.
+`realname_customization`
+
+ If this option is set to “false” (default is “true”), the users will not be
+ able to use the ad-hoc commands that lets them configure their realname and
+ username.
+
`log_file`
A filename into which logs are written. If none is provided, the logs are
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 4692eef..d6c7021 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -6,6 +6,7 @@
#include <irc/irc_user.hpp>
#include <logger/logger.hpp>
+#include <config/config.hpp>
#include <utils/tolower.hpp>
#include <utils/split.hpp>
@@ -120,11 +121,14 @@ void IrcClient::on_connected()
this->send_nick_command(this->username);
#ifdef USE_DATABASE
- if (!options.username.value().empty())
- this->username = options.username.value();
- if (!options.realname.value().empty())
- this->realname = options.realname.value();
- this->send_user_command(username, realname);
+ if (Config::get("realname_customization", "true") == "true")
+ {
+ if (!options.username.value().empty())
+ this->username = options.username.value();
+ if (!options.realname.value().empty())
+ this->realname = options.realname.value();
+ this->send_user_command(username, realname);
+ }
#endif
this->send_user_command(this->username, this->realname);
diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp
index 19e6a71..0a23715 100644
--- a/src/xmpp/biboumi_adhoc_commands.cpp
+++ b/src/xmpp/biboumi_adhoc_commands.cpp
@@ -1,6 +1,7 @@
#include <xmpp/biboumi_adhoc_commands.hpp>
#include <xmpp/biboumi_component.hpp>
#include <bridge/bridge.hpp>
+#include <config/config.hpp>
#include <utils/string.hpp>
#include <utils/split.hpp>
#include <xmpp/jid.hpp>
@@ -191,31 +192,34 @@ void ConfigureIrcServerStep1(XmppComponent*, AdhocSession& session, XmlNode& com
after_cnt_cmd.add_child(required);
x.add_child(std::move(after_cnt_cmd));
- XmlNode username("field");
- username["var"] = "username";
- username["type"] = "text-single";
- username["label"] = "Username";
- if (!options.username.value().empty())
+ if (Config::get("realname_customization", "true") == "true")
{
- XmlNode username_value("value");
- username_value.set_inner(options.username.value());
- username.add_child(std::move(username_value));
- }
- username.add_child(required);
- x.add_child(std::move(username));
+ XmlNode username("field");
+ username["var"] = "username";
+ username["type"] = "text-single";
+ username["label"] = "Username";
+ if (!options.username.value().empty())
+ {
+ XmlNode username_value("value");
+ username_value.set_inner(options.username.value());
+ username.add_child(std::move(username_value));
+ }
+ username.add_child(required);
+ x.add_child(std::move(username));
- XmlNode realname("field");
- realname["var"] = "realname";
- realname["type"] = "text-single";
- realname["label"] = "Realname";
- if (!options.realname.value().empty())
- {
- XmlNode realname_value("value");
- realname_value.set_inner(options.realname.value());
- realname.add_child(std::move(realname_value));
+ XmlNode realname("field");
+ realname["var"] = "realname";
+ realname["type"] = "text-single";
+ realname["label"] = "Realname";
+ if (!options.realname.value().empty())
+ {
+ XmlNode realname_value("value");
+ realname_value.set_inner(options.realname.value());
+ realname.add_child(std::move(realname_value));
+ }
+ realname.add_child(required);
+ x.add_child(std::move(realname));
}
- realname.add_child(required);
- x.add_child(std::move(realname));
command_node.add_child(std::move(x));
}