]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_user/core_user.cpp
Change all occurrences of plain sort() to std::sort()
[user/henk/code/inspircd.git] / src / coremods / core_user / core_user.cpp
index c862c0eb1a3b711f3355c86cb52b7c746de3c253..103880a6ecb3a5422070862abbb8535d1fdab5f0 100644 (file)
@@ -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);