summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-02-19 18:02:46 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-02-19 18:02:46 +0000
commit4dfcdc1734194e68faaf64ebe910da23e6b80b28 (patch)
tree525fb53ccb068dfd67d251fe16ee72bb5b41291c /src/modules
parent4db47bcf73356f4d3b55f1da48a003be9ce4f9de (diff)
Fix crash on /SHUN with exactly 2 parameters
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11131 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_shun.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index c007228e3..09d9872ad 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -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());
}
}
}