]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_silence.cpp
Added <oper:swhois> to m_swhois, which will override <type:swhois> if specified
[user/henk/code/inspircd.git] / src / modules / m_silence.cpp
index c331de38aeb03d163a6035dfafe22043844a1f46..6d51c718c758004c53c91f3b5c561961562560c9 100644 (file)
@@ -37,13 +37,13 @@ typedef std::vector<std::string> silencelist;
 class cmd_silence : public command_t
 {
  public:
- cmd_silence (InspIRCd* Instance) : command_t(Instance,"SILENCE", 0, 0)
      cmd_silence (InspIRCd* Instance) : command_t(Instance,"SILENCE", 0, 0)
        {
                this->source = "m_silence.so";
                syntax = "{[+|-]<mask>}";
        }
 
-       void Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
        {
                if (!pcnt)
                {
@@ -60,6 +60,8 @@ class cmd_silence : public command_t
                                }
                        }
                        user->WriteServ("272 %s :End of Silence List",user->nick);
+
+                       return CMD_SUCCESS;
                }
                else if (pcnt > 0)
                {
@@ -86,18 +88,18 @@ class cmd_silence : public command_t
                                        if (sl->size())
                                        {
                                                for (silencelist::iterator i = sl->begin(); i != sl->end(); i++)
-                                       {
+                                               {
                                                        // search through for the item
                                                        irc::string listitem = i->c_str();
                                                        if (listitem == mask)
-                                               {
-                                                       sl->erase(i);
+                                                       {
+                                                               sl->erase(i);
                                                                user->WriteServ("950 %s %s :Removed %s from silence list",user->nick, user->nick, mask.c_str());
                                                                break;
-                                                       }
-                                               }
+                                                       }
+                                               }
                                        }
-                                       if (!sl->size())
+                                       else
                                        {
                                                // tidy up -- if a user's list is empty, theres no use having it
                                                // hanging around in the user record.
@@ -115,7 +117,7 @@ class cmd_silence : public command_t
                                if (!sl)
                                {
                                        sl = new silencelist;
-                                       user->Extend(std::string("silence_list"), sl);
+                                       user->Extend("silence_list", sl);
                                }
                                for (silencelist::iterator n = sl->begin(); n != sl->end();  n++)
                                {
@@ -123,15 +125,15 @@ class cmd_silence : public command_t
                                        if (listitem == mask)
                                        {
                                                user->WriteServ("952 %s %s :%s is already on your silence list",user->nick, user->nick, mask.c_str());
-                                               return;
+                                               return CMD_SUCCESS;
                                        }
                                }
                                sl->push_back(mask);
                                user->WriteServ("951 %s %s :Added %s to silence list",user->nick, user->nick, mask.c_str());
-                               return;
+                               return CMD_SUCCESS;
                        }
                }
-               return;
+               return CMD_SUCCESS;
        }
 };
 
@@ -209,7 +211,7 @@ class ModuleSilence : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,1,VF_VENDOR);
+               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
 };