diff options
-rw-r--r-- | include/clientprotocolmsg.h | 12 | ||||
-rw-r--r-- | include/configreader.h | 6 | ||||
-rw-r--r-- | include/modules/cap.h | 2 | ||||
-rw-r--r-- | include/modules/ircv3_replies.h | 12 | ||||
-rw-r--r-- | include/numericbuilder.h | 4 | ||||
-rw-r--r-- | src/configreader.cpp | 4 | ||||
-rw-r--r-- | src/coremods/core_info/cmd_admin.cpp | 2 | ||||
-rw-r--r-- | src/coremods/core_info/cmd_motd.cpp | 2 | ||||
-rw-r--r-- | src/coremods/core_info/cmd_time.cpp | 3 | ||||
-rw-r--r-- | src/coremods/core_info/core_info.cpp | 2 | ||||
-rw-r--r-- | src/coremods/core_stub.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ircv3_batch.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_permchannels.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sslinfo.cpp | 2 | ||||
-rw-r--r-- | src/server.cpp | 2 | ||||
-rw-r--r-- | src/usermanager.cpp | 2 |
17 files changed, 34 insertions, 29 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) { } diff --git a/src/configreader.cpp b/src/configreader.cpp index b258d93fc..f96836507 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -335,7 +335,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) } } -static std::string GetServerName() +static std::string GetServerHost() { #ifndef _WIN32 char hostname[256]; @@ -359,7 +359,7 @@ void ServerConfig::Fill() ConfigTag* server = ConfValue("server"); if (sid.empty()) { - ServerName = server->getString("name", GetServerName(), InspIRCd::IsHost); + ServerName = server->getString("name", GetServerHost(), InspIRCd::IsHost); sid = server->getString("id"); if (!sid.empty() && !InspIRCd::IsSID(sid)) diff --git a/src/coremods/core_info/cmd_admin.cpp b/src/coremods/core_info/cmd_admin.cpp index e4764d5c9..07be23e68 100644 --- a/src/coremods/core_info/cmd_admin.cpp +++ b/src/coremods/core_info/cmd_admin.cpp @@ -39,7 +39,7 @@ CmdResult CommandAdmin::Handle(User* user, const Params& parameters) { if (parameters.size() > 0 && !irc::equals(parameters[0], ServerInstance->Config->ServerName)) return CMD_SUCCESS; - user->WriteRemoteNumeric(RPL_ADMINME, ServerInstance->Config->ServerName, "Administrative info"); + user->WriteRemoteNumeric(RPL_ADMINME, ServerInstance->Config->GetServerName(), "Administrative info"); if (!AdminName.empty()) user->WriteRemoteNumeric(RPL_ADMINLOC1, InspIRCd::Format("Name: %s", AdminName.c_str())); user->WriteRemoteNumeric(RPL_ADMINLOC2, InspIRCd::Format("Nickname: %s", AdminNick.c_str())); diff --git a/src/coremods/core_info/cmd_motd.cpp b/src/coremods/core_info/cmd_motd.cpp index 69caf7de1..c9a542f14 100644 --- a/src/coremods/core_info/cmd_motd.cpp +++ b/src/coremods/core_info/cmd_motd.cpp @@ -57,7 +57,7 @@ CmdResult CommandMotd::Handle(User* user, const Params& parameters) return CMD_SUCCESS; } - user->WriteRemoteNumeric(RPL_MOTDSTART, InspIRCd::Format("%s message of the day", ServerInstance->Config->ServerName.c_str())); + user->WriteRemoteNumeric(RPL_MOTDSTART, InspIRCd::Format("%s message of the day", ServerInstance->Config->GetServerName().c_str())); for (file_cache::iterator i = motd->second.begin(); i != motd->second.end(); i++) user->WriteRemoteNumeric(RPL_MOTD, InspIRCd::Format(" %s", i->c_str())); diff --git a/src/coremods/core_info/cmd_time.cpp b/src/coremods/core_info/cmd_time.cpp index 3eab43b2a..a880d7a0e 100644 --- a/src/coremods/core_info/cmd_time.cpp +++ b/src/coremods/core_info/cmd_time.cpp @@ -37,7 +37,6 @@ CmdResult CommandTime::Handle(User* user, const Params& parameters) if (parameters.size() > 0 && !irc::equals(parameters[0], ServerInstance->Config->ServerName)) return CMD_SUCCESS; - user->WriteRemoteNumeric(RPL_TIME, ServerInstance->Config->ServerName, InspIRCd::TimeString(ServerInstance->Time())); - + user->WriteRemoteNumeric(RPL_TIME, ServerInstance->Config->GetServerName(), InspIRCd::TimeString(ServerInstance->Time())); return CMD_SUCCESS; } diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index f138494c8..24eaaae03 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -134,7 +134,7 @@ class CoreModInfo : public Module void OnUserConnect(LocalUser* user) CXX11_OVERRIDE { user->WriteNumeric(RPL_WELCOME, InspIRCd::Format("Welcome to the %s IRC Network %s", ServerInstance->Config->Network.c_str(), user->GetFullRealHost().c_str())); - user->WriteNumeric(RPL_YOURHOST, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->ServerName.c_str(), INSPIRCD_BRANCH)); + user->WriteNumeric(RPL_YOURHOST, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->GetServerName().c_str(), INSPIRCD_BRANCH)); user->WriteNumeric(RPL_CREATED, InspIRCd::TimeString(ServerInstance->startup_time, "This server was created %H:%M:%S %b %d %Y")); user->WriteNumeric(numeric004); diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp index 1e9c83024..0b7cfaa32 100644 --- a/src/coremods/core_stub.cpp +++ b/src/coremods/core_stub.cpp @@ -77,7 +77,7 @@ class CommandLinks : public Command */ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE { - user->WriteNumeric(RPL_LINKS, ServerInstance->Config->ServerName, ServerInstance->Config->ServerName, InspIRCd::Format("0 %s", ServerInstance->Config->ServerDesc.c_str())); + user->WriteNumeric(RPL_LINKS, ServerInstance->Config->GetServerName(), ServerInstance->Config->GetServerName(), InspIRCd::Format("0 %s", ServerInstance->Config->GetServerDesc().c_str())); user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list."); return CMD_SUCCESS; } diff --git a/src/modules/m_ircv3_batch.cpp b/src/modules/m_ircv3_batch.cpp index bbb78557d..197ee3ebe 100644 --- a/src/modules/m_ircv3_batch.cpp +++ b/src/modules/m_ircv3_batch.cpp @@ -26,7 +26,7 @@ class BatchMessage : public ClientProtocol::Message { public: BatchMessage(const IRCv3::Batch::Batch& batch, bool start) - : ClientProtocol::Message("BATCH", ServerInstance->Config->ServerName) + : ClientProtocol::Message("BATCH", ServerInstance->Config->GetServerName()) { char c = (start ? '+' : '-'); PushParam(std::string(1, c) + batch.GetRefTagStr()); diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 4bc9c2fad..a408ff142 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -228,7 +228,7 @@ public: topicset = ServerInstance->Time(); std::string topicsetby = tag->getString("topicsetby"); if (topicsetby.empty()) - topicsetby = ServerInstance->Config->ServerName; + topicsetby = ServerInstance->Config->GetServerName(); c->SetTopic(ServerInstance->FakeClient, topic, topicset, &topicsetby); } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 1fd17c28a..01387c753 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -144,7 +144,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) return; user->WriteNumeric(RPL_LINKS, Current->GetName(), - (((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->ServerName : Parent), + (((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->GetServerName() : Parent), InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str())); } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 0054e3ed7..bbbc9ba64 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -294,7 +294,7 @@ class ModuleSSLInfo std::string text = "*** You are connected to "; if (!ssliohook->GetServerName(text)) - text.append(ServerInstance->Config->ServerName); + text.append(ServerInstance->Config->GetServerName()); text.append(" using TLS (SSL) cipher '"); ssliohook->GetCiphersuite(text); text.push_back('\''); diff --git a/src/server.cpp b/src/server.cpp index 217d1501d..dbc51e37c 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -72,7 +72,7 @@ std::string InspIRCd::GetVersionString(bool getFullVersion) { if (getFullVersion) return INSPIRCD_VERSION ". " + Config->ServerName + " :[" + Config->sid + "] " + Config->CustomVersion; - return INSPIRCD_BRANCH ". " + Config->ServerName + " :" + Config->CustomVersion; + return INSPIRCD_BRANCH ". " + Config->GetServerName() + " :" + Config->CustomVersion; } std::string UIDGenerator::GenerateSID(const std::string& servername, const std::string& serverdesc) diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 812f43113..bb325f9ee 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -369,7 +369,7 @@ void UserManager::ServerNoticeAll(const char* text, ...) { std::string message; VAFORMAT(message, text, text); - ClientProtocol::Messages::Privmsg msg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, ServerInstance->Config->ServerName, message, MSG_NOTICE); + ClientProtocol::Messages::Privmsg msg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, ServerInstance->Config->GetServerName(), message, MSG_NOTICE); ClientProtocol::Event msgevent(ServerInstance->GetRFCEvents().privmsg, msg); for (LocalList::const_iterator i = local_users.begin(); i != local_users.end(); ++i) |