]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showwhois.cpp
Add names for all modes (part 1 of named channel mode list)
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
index 7464a0d21b02f68b411133d255fd8f5b4a39ddba..24c502ee48e44ff89cba23f327ac28f763b7aa43 100644 (file)
 class SeeWhois : public ModeHandler
 {
  public:
-       SeeWhois(InspIRCd* Instance, bool IsOpersOnly) : ModeHandler(Instance, 'W', 0, 0, false, MODETYPE_USER, IsOpersOnly) { }
+       SeeWhois(Module* Creator, bool IsOpersOnly) : ModeHandler(Creator, "showwhois", 'W', PARAM_NONE, MODETYPE_USER)
+       {
+               oper = IsOpersOnly;
+       }
 
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                if (adding)
                {
@@ -48,9 +51,8 @@ class SeeWhois : public ModeHandler
 class WhoisNoticeCmd : public Command
 {
  public:
-       WhoisNoticeCmd(InspIRCd* Instance) : Command(Instance,"WHOISNOTICE", 0, 1)
+       WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 1)
        {
-               this->source = "m_showwhois.cpp";
        }
 
        void HandleFast(User* dest, User* src)
@@ -79,13 +81,13 @@ class ModuleShowwhois : public Module
 
  public:
 
-       ModuleShowwhois(InspIRCd* Me) : Module(Me), cmd(Me)
+       ModuleShowwhois() : cmd(this)
        {
-               ConfigReader conf(ServerInstance);
+               ConfigReader conf;
                bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0);
                ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0);
 
-               sw = new SeeWhois(ServerInstance, OpersOnly);
+               sw = new SeeWhois(this, OpersOnly);
                if (!ServerInstance->Modes->AddMode(sw))
                        throw ModuleException("Could not add new modes!");
                ServerInstance->AddCommand(&cmd);
@@ -95,13 +97,12 @@ class ModuleShowwhois : public Module
 
        ~ModuleShowwhois()
        {
-               ServerInstance->Modes->DelMode(sw);
                delete sw;
        }
 
        virtual Version GetVersion()
        {
-               return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
+               return Version("Allows opers to set +W to see when a user uses WHOIS on them",VF_COMMON|VF_VENDOR,API_VERSION);
        }
 
        virtual void OnWhois(User* source, User* dest)