diff options
| author | 2025-02-26 18:55:28 +0000 | |
|---|---|---|
| committer | 2025-02-26 18:57:38 +0000 | |
| commit | 2a087e3cabeac09ed4b00a6de883bd0df468de32 (patch) | |
| tree | b1228b787035538f8268c7e9524f778dea74d3aa | |
| parent | Merge branch 'insp4' into master. (diff) | |
| parent | Add more information to the seenicks message. (diff) | |
Merge branch 'insp4' into master.
| -rw-r--r-- | include/inspircd.h | 2 | ||||
| -rw-r--r-- | modules/seenicks.cpp | 3 | ||||
| -rw-r--r-- | src/configreader.cpp | 16 | ||||
| -rw-r--r-- | src/inspircd.cpp | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 1342b180f..d5ac6c3b1 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -237,7 +237,7 @@ public: XLineManager* XLines = nullptr; /** The current server configuration file from --config or configure. */ - std::string ConfigFileName = INSPIRCD_CONFIG_PATH "/inspircd.conf"; + std::string ConfigFileName; /** Fills a buffer with random bytes. */ std::function<void(char*, size_t)> GenRandom = &DefaultGenRandom; diff --git a/modules/seenicks.cpp b/modules/seenicks.cpp index e16ccdd27..4407fcab7 100644 --- a/modules/seenicks.cpp +++ b/modules/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); } }; diff --git a/src/configreader.cpp b/src/configreader.cpp index 5bc94b8a9..07c93d09c 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -73,15 +73,23 @@ 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)) { - const char* homedir = getenv("HOME"); + // The fragment is relative to a home directory, expand that. + const auto* homedir = getenv("HOME"); if (homedir && *homedir) - return std::string(homedir) + '/' + fragment.substr(2); + return FMT::format("{}/{}", homedir, fragment.substr(2)); } - return base + '/' + fragment; + 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 FMT::format("{}/{}/{}", cwd.string(), base, fragment); + } + + return FMT::format("{}/{}", base, fragment); } ServerConfig::ServerConfig() diff --git a/src/inspircd.cpp b/src/inspircd.cpp index f87ea439c..e52f47dff 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; |
