summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-12-20 03:04:21 +0000
committerSadie Powell <sadie@witchery.services>2020-12-20 03:05:29 +0000
commit6cfabb0064cab52bbbab59974e53dc0fa1954da7 (patch)
treeaa755e92103730ba6428332b4094578cde91cc67 /include
parent029ff235e184acc8194e76ef535e437cb6c9f614 (diff)
Hide the server name/desc better when <options:hideserver> is set.
Diffstat (limited to 'include')
-rw-r--r--include/clientprotocolmsg.h12
-rw-r--r--include/configreader.h6
-rw-r--r--include/modules/cap.h2
-rw-r--r--include/modules/ircv3_replies.h12
-rw-r--r--include/numericbuilder.h4
5 files changed, 21 insertions, 15 deletions
diff --git a/include/clientprotocolmsg.h b/include/clientprotocolmsg.h
index 07f32b686..53122cff9 100644
--- a/include/clientprotocolmsg.h
+++ b/include/clientprotocolmsg.h
@@ -68,7 +68,7 @@ class ClientProtocol::Messages::Numeric : public ClientProtocol::Message
* @param user User to send the numeric to. May be unregistered, must remain valid as long as this object is alive.
*/
Numeric(const ::Numeric::Numeric& num, User* user)
- : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer()->GetName() : ServerInstance->Config->ServerName))
+ : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetName())
{
if (user->registered & REG_NICK)
PushParamRef(user->nick);
@@ -82,7 +82,7 @@ class ClientProtocol::Messages::Numeric : public ClientProtocol::Message
* @param target Target string, must stay valid as long as this object is alive.
*/
Numeric(const ::Numeric::Numeric& num, const std::string& target)
- : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer()->GetName() : ServerInstance->Config->ServerName))
+ : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetName())
{
PushParamRef(target);
InitFromNumeric(num);
@@ -92,7 +92,7 @@ class ClientProtocol::Messages::Numeric : public ClientProtocol::Message
* @param num Numeric number.
*/
Numeric(unsigned int num)
- : ClientProtocol::Message(NULL, ServerInstance->Config->ServerName)
+ : ClientProtocol::Message(NULL, ServerInstance->Config->GetServerName())
{
InitCommand(num);
PushParam("*");
@@ -643,7 +643,7 @@ struct ClientProtocol::Messages::Ping : public ClientProtocol::Message
Ping()
: ClientProtocol::Message("PING")
{
- PushParamRef(ServerInstance->Config->ServerName);
+ PushParamRef(ServerInstance->Config->GetServerName());
}
/** Constructor.
@@ -666,9 +666,9 @@ struct ClientProtocol::Messages::Pong : public ClientProtocol::Message
* @param server Pinged server. Must remain valid as long as this object is alive if non-empty.
*/
Pong(const std::string& cookie, const std::string& server = "")
- : ClientProtocol::Message("PONG", ServerInstance->Config->ServerName)
+ : ClientProtocol::Message("PONG", ServerInstance->Config->GetServerName())
{
- PushParamRef(ServerInstance->Config->ServerName);
+ PushParamRef(ServerInstance->Config->GetServerName());
if (!server.empty())
PushParamRef(server);
PushParamRef(cookie);
diff --git a/include/configreader.h b/include/configreader.h
index 7274dfad8..3a5ea9c60 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -451,6 +451,12 @@ class CoreExport ServerConfig
*/
const std::string& GetSID() const { return sid; }
+ /** Retrieves the server name which should be shown to users. */
+ const std::string& GetServerName() const { return HideServer.empty() ? ServerName : HideServer; }
+
+ /** Retrieves the server description which should be shown to users. */
+ const std::string& GetServerDesc() const { return HideServer.empty() ? ServerDesc : HideServer; }
+
/** Read the entire configuration into memory
* and initialize this class. All other methods
* should be used only by the core.
diff --git a/include/modules/cap.h b/include/modules/cap.h
index e14bcc422..9dacdc200 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -320,7 +320,7 @@ namespace Cap
{
public:
MessageBase(const std::string& subcmd)
- : ClientProtocol::Message("CAP", ServerInstance->Config->ServerName)
+ : ClientProtocol::Message("CAP", ServerInstance->Config->GetServerName())
{
PushParamPlaceholder();
PushParam(subcmd);
diff --git a/include/modules/ircv3_replies.h b/include/modules/ircv3_replies.h
index 4666f002a..f3c5c451a 100644
--- a/include/modules/ircv3_replies.h
+++ b/include/modules/ircv3_replies.h
@@ -90,7 +90,7 @@ class IRCv3::Replies::Reply
*/
void Send(LocalUser* user, Command* command, const std::string& code, const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
msg.PushParamRef(command->name);
msg.PushParam(code);
msg.PushParam(description);
@@ -100,7 +100,7 @@ class IRCv3::Replies::Reply
template<typename T1>
void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
msg.PushParamRef(command->name);
msg.PushParam(code);
msg.PushParam(ConvToStr(p1));
@@ -112,7 +112,7 @@ class IRCv3::Replies::Reply
void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
msg.PushParamRef(command->name);
msg.PushParam(code);
msg.PushParam(ConvToStr(p1));
@@ -125,7 +125,7 @@ class IRCv3::Replies::Reply
void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
const T3& p3, const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
msg.PushParamRef(command->name);
msg.PushParam(code);
msg.PushParam(ConvToStr(p1));
@@ -139,7 +139,7 @@ class IRCv3::Replies::Reply
void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
const T3& p3, const T4& p4, const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
msg.PushParamRef(command->name);
msg.PushParam(code);
msg.PushParam(ConvToStr(p1));
@@ -154,7 +154,7 @@ class IRCv3::Replies::Reply
void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
const T3& p3, const T4& p4, const T5& p5, const std::string& description)
{
- ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+ ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
if (command)
msg.PushParamRef(command->name);
else
diff --git a/include/numericbuilder.h b/include/numericbuilder.h
index 9feceb7cb..a077c666d 100644
--- a/include/numericbuilder.h
+++ b/include/numericbuilder.h
@@ -86,7 +86,7 @@ class Numeric::GenericBuilder
GenericBuilder(Sink s, unsigned int num, bool addparam = true, size_t additionalsize = 0)
: sink(s)
, numeric(num)
- , max(ServerInstance->Config->Limits.MaxLine - ServerInstance->Config->ServerName.size() - additionalsize - 10)
+ , max(ServerInstance->Config->Limits.MaxLine - ServerInstance->Config->GetServerName().size() - additionalsize - 10)
{
if (addparam)
numeric.push(std::string());
@@ -156,7 +156,7 @@ class Numeric::GenericParamBuilder
: sink(s)
, numeric(num)
, currlen(0)
- , max(ServerInstance->Config->Limits.MaxLine - ServerInstance->Config->ServerName.size() - additionalsize - 10)
+ , max(ServerInstance->Config->Limits.MaxLine - ServerInstance->Config->GetServerName().size() - additionalsize - 10)
{
}