]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_silence.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / modules / m_silence.cpp
index 81e4bc3d8d9714c55c5cea7748db2949bd82acde..d1885269d04975ea035c302688338e4f5f8718fa 100644 (file)
@@ -110,6 +110,7 @@ class CommandSilence : public Command
        CommandSilence(Module* Creator, unsigned int &max) : Command(Creator, "SILENCE", 0),
                maxsilence(max), ext("silence_list", Creator)
        {
+               allow_empty_last_param = false;
                syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}";
                TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
        }
@@ -298,28 +299,31 @@ class ModuleSilence : public Module
 
        ModuleSilence()
                : maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this)
+       {
+       }
+
+       void init()
        {
                OnRehash(NULL);
-               ServerInstance->AddCommand(&cmdsilence);
-               ServerInstance->AddCommand(&cmdsvssilence);
-               ServerInstance->Extensions.Register(&cmdsilence.ext);
+               ServerInstance->Modules->AddService(cmdsilence);
+               ServerInstance->Modules->AddService(cmdsvssilence);
+               ServerInstance->Modules->AddService(cmdsilence.ext);
 
                Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
-               ServerInstance->Modules->Attach(eventlist, this, 5);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        void OnRehash(User* user)
        {
-               ConfigReader Conf;
-               maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true);
+               maxsilence = ServerInstance->Config->ConfValue("showwhois")->getInt("maxentries", 32);
                if (!maxsilence)
                        maxsilence = 32;
        }
 
-       void On005Numeric(std::string &output)
+       void On005Numeric(std::map<std::string, std::string>& tokens)
        {
-               // we don't really have a limit...
-               output = output + " ESILENCE SILENCE=" + ConvToStr(maxsilence);
+               tokens["ESILENCE"];
+               tokens["SILENCE"] = ConvToStr(maxsilence);
        }
 
        void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text)
@@ -389,10 +393,6 @@ class ModuleSilence : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       ~ModuleSilence()
-       {
-       }
-
        Version GetVersion()
        {
                return Version("Provides support for the /SILENCE command", VF_OPTCOMMON | VF_VENDOR);