diff options
Diffstat (limited to 'src/coremods/core_user/core_user.cpp')
-rw-r--r-- | src/coremods/core_user/core_user.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp index c862c0eb1..103880a6e 100644 --- a/src/coremods/core_user/core_user.cpp +++ b/src/coremods/core_user/core_user.cpp @@ -136,6 +136,27 @@ class CommandPong : public Command } }; +void MessageWrapper::Wrap(const std::string& message, std::string& out) +{ + // If there is a fixed message, it is stored in prefix. Otherwise prefix contains + // only the prefix, so append the message and the suffix + out.assign(prefix); + if (!fixed) + out.append(message).append(suffix); +} + +void MessageWrapper::ReadConfig(const char* prefixname, const char* suffixname, const char* fixedname) +{ + ConfigTag* tag = ServerInstance->Config->ConfValue("options"); + prefix = tag->getString(fixedname); + fixed = (!prefix.empty()); + if (!fixed) + { + prefix = tag->getString(prefixname); + suffix = tag->getString(suffixname); + } +} + class CoreModUser : public Module { CommandAway cmdaway; @@ -155,6 +176,12 @@ class CoreModUser : public Module { } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + cmdpart.msgwrap.ReadConfig("prefixpart", "suffixpart", "fixedpart"); + cmdquit.msgwrap.ReadConfig("prefixquit", "suffixquit", "fixedquit"); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the AWAY, MODE, NICK, PART, PASS, PING, PONG, QUIT and USER commands", VF_VENDOR|VF_CORE); |