From 6c2100a2e4b6a4d77af615bcd300aa5e5a077358 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 15 Feb 2025 14:24:43 +0000 Subject: Fix expanding paths on portable installations. Closes #2148. --- src/configreader.cpp | 10 +++++++++- src/inspircd.cpp | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/configreader.cpp b/src/configreader.cpp index 804406ec4..d49878baa 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -71,14 +71,22 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const if (std::filesystem::path(fragment).is_absolute()) return fragment; - // The fragment is relative to a home directory, expand that. if (!fragment.compare(0, 2, "~/", 2)) { + // The fragment is relative to a home directory, expand that. const char* homedir = getenv("HOME"); if (homedir && *homedir) return std::string(homedir) + '/' + fragment.substr(2); } + if (std::filesystem::path(base).is_relative()) + { + // The base is relative to the working directory, expand that. + const auto cwd = std::filesystem::current_path(); + if (!cwd.empty()) + return INSP_FORMAT("{}/{}/{}", cwd.string(), base, fragment); + } + return base + '/' + fragment; } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5b1f332c9..b9018ea7d 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -255,7 +255,7 @@ namespace // Parses the command line options. void ParseOptions() { - std::string config; + std::string config = ServerInstance->Config->Paths.PrependConfig("inspircd.conf"); bool do_debug = false; bool do_help = false; bool do_nofork = false; -- cgit v1.3.1-10-gc9f91 From c446fa0cea6e9d05ff476d658caf2dfbecd32cf2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 16 Feb 2025 11:28:40 +0000 Subject: Use INSP_FORMAT in ExpandPath. --- src/configreader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/configreader.cpp b/src/configreader.cpp index d49878baa..fc01b533d 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -74,9 +74,9 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const if (!fragment.compare(0, 2, "~/", 2)) { // The fragment is relative to a home directory, expand that. - const char* homedir = getenv("HOME"); + const auto* homedir = getenv("HOME"); if (homedir && *homedir) - return std::string(homedir) + '/' + fragment.substr(2); + return INSP_FORMAT("{}/{}", homedir, fragment.substr(2)); } if (std::filesystem::path(base).is_relative()) @@ -87,7 +87,7 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const return INSP_FORMAT("{}/{}/{}", cwd.string(), base, fragment); } - return base + '/' + fragment; + return INSP_FORMAT("{}/{}", base, fragment); } ServerConfig::ServerConfig() -- cgit v1.3.1-10-gc9f91 From 55a7690b50720a555acba2da9d5db8526fb65507 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 24 Feb 2025 00:28:54 +0000 Subject: Add more information to the seenicks message. --- src/modules/m_seenicks.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp index e16ccdd27..4407fcab7 100644 --- a/src/modules/m_seenicks.cpp +++ b/src/modules/m_seenicks.cpp @@ -39,7 +39,8 @@ public: void OnUserPostNick(User* user, const std::string& oldnick) override { - ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N', "User {} changed their nickname to {}", oldnick, user->nick); + ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N', "User {}!{} ({}) changed their nickname to {}", + oldnick, user->GetRealUserHost(), user->GetAddress(), user->nick); } }; -- cgit v1.3.1-10-gc9f91