]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_shun.cpp
Fix silly oversight discovered by tra26 (thanks!) where the core tries to handle...
[user/henk/code/inspircd.git] / src / modules / m_shun.cpp
index 59588ab5e8a17d2894a2f2b26f8c36a6aa984243..c013776ed217029838b9018601908a1eb2d565bc 100644 (file)
@@ -73,9 +73,10 @@ class cmd_shun : public Command
        InspIRCd *Srv;
 
  public:
-       cmd_shun(InspIRCd* Me) : Command(Me, "SHUN", "o", 1), Srv(Me)
+       cmd_shun(InspIRCd* Me) : Command(Me, "SHUN", "o", 1, 3), Srv(Me)
        {
                this->source = "m_shun.so";
+               this->syntax = "<nick!user@hostmask> [<shun-duration>] :<reason>";
        }
 
        CmdResult Handle(const std::vector<std::string>& parameters, User *user)
@@ -118,13 +119,12 @@ class cmd_shun : public Command
                                {
                                        if (!duration)
                                        {
-                                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s.", user->nick.c_str(), parameters[0].c_str());
+                                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
                                        }
                                        else
                                        {
                                                time_t c_requires_crap = duration + ServerInstance->Time();
-                                               ServerInstance->SNO->WriteToSnoMask('x', "%s added timed shun for %s, expires on %s", user->nick.c_str(), parameters[0].c_str(),
-                                               ServerInstance->TimeString(c_requires_crap).c_str());
+                                               ServerInstance->SNO->WriteToSnoMask('x', "%s added timed shun for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
                                        }
 
                                        ServerInstance->XLines->ApplyLines();
@@ -146,6 +146,7 @@ class ModuleShun : public Module
        cmd_shun* mycommand;
        ShunFactory *f;
        std::map<std::string, bool> ShunEnabledCommands;
+       bool NotifyOfShun;
 
  public:
        ModuleShun(InspIRCd* Me) : Module(Me)
@@ -185,6 +186,7 @@ class ModuleShun : public Module
                        cmds = "PING PONG QUIT";
 
                ShunEnabledCommands.clear();
+               NotifyOfShun = true;
 
                std::stringstream dcmds(cmds);
                std::string thiscmd;
@@ -193,6 +195,8 @@ class ModuleShun : public Module
                {
                        ShunEnabledCommands[thiscmd] = true;
                }
+
+               NotifyOfShun = MyConf.ReadFlag("shun", "notifyuser", "yes", 0);
        }
 
        virtual void OnUserConnect(User* user)
@@ -225,7 +229,10 @@ class ModuleShun : public Module
                std::map<std::string, bool>::iterator i = ShunEnabledCommands.find(command);
 
                if (i == ShunEnabledCommands.end())
+               {
+                       user->WriteServ("NOTICE %s :*** Command %s not processed, as you have been blocked from issuing commands (SHUN)", user->nick.c_str(), command.c_str());
                        return 1;
+               }
 
                if (command == "QUIT")
                {