]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_shun.cpp
Fix for bug #791, if an error is set treat this as 'could not get certificate'
[user/henk/code/inspircd.git] / src / modules / m_shun.cpp
index c007228e3e015f79c86b048d3d1d4af53b3523b6..62f4cfd05b2eb225ee56dd9b828d701c2ae4e699 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *          the file COPYING for details.
@@ -114,12 +114,23 @@ class CommandShun : public Command
                else if (parameters.size() >= 2)
                {
                        // Adding - XXX todo make this respect <insane> tag perhaps..
-                       long duration = ServerInstance->Duration(parameters[1]);
+                       long duration;
+                       std::string expr;
+                       if (parameters.size() > 2)
+                       {
+                               duration = ServerInstance->Duration(parameters[1]);
+                               expr = parameters[2];
+                       }
+                       else
+                       {
+                               duration = 0;
+                               expr = parameters[1];
+                       }
                        Shun *r = NULL;
 
                        try
                        {
-                               r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str());
+                               r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), parameters[0].c_str());
                        }
                        catch (...)
                        {
@@ -132,12 +143,14 @@ class CommandShun : public Command
                                {
                                        if (!duration)
                                        {
-                                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
+                                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s: %s",
+                                                       user->nick.c_str(), parameters[0].c_str(), expr.c_str());
                                        }
                                        else
                                        {
                                                time_t c_requires_crap = duration + ServerInstance->Time();
-                                               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->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(), expr.c_str());
                                        }
 
                                        ServerInstance->XLines->ApplyLines();
@@ -145,7 +158,7 @@ class CommandShun : public Command
                                else
                                {
                                        delete r;
-                                       user->WriteServ("NOTICE %s :*** Shun for %s already exists", user->nick.c_str(), parameters[0].c_str());
+                                       user->WriteServ("NOTICE %s :*** Shun for %s already exists", user->nick.c_str(), expr.c_str());
                                }
                        }
                }
@@ -268,7 +281,8 @@ class ModuleShun : public Module
                        parameters.clear();
                }
 
-               return 1;
+               /* if we're here, allow the command. */
+               return 0;
        }
 
        virtual Version GetVersion()