summaryrefslogtreecommitdiff
path: root/src/modules/m_shun.cpp
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-06 00:07:30 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-06 00:07:30 +0000
commitacf783b83cf474d0ebe6f1aed8083e93033f2150 (patch)
treebb8b4dc764cc3c7507c0ffbaafb60f9389b2d0fa /src/modules/m_shun.cpp
parentfcafba14c5408360ec725ed1649ede75b7ae52c1 (diff)
Add support for nick targets like other xlines. Patch by Ankit.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11288 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_shun.cpp')
-rw-r--r--src/modules/m_shun.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 6fdc4c772..ab7e30c58 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -92,22 +92,28 @@ class CommandShun : public Command
/* syntax: SHUN nick!user@host time :reason goes here */
/* 'time' is a human-readable timestring, like 2d3h2s. */
+ std::string target = parameters[0];
+
if (parameters.size() == 1)
{
- if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", user))
+ if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", user))
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s Removed shun on %s.",user->nick.c_str(),parameters[0].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x',"%s Removed shun on %s.",user->nick.c_str(),target.c_str());
}
else
{
// XXX todo implement stats
- user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats S.",user->nick.c_str(),parameters[0].c_str());
+ user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats S.",user->nick.c_str(),target.c_str());
}
return CMD_SUCCESS;
}
else if (parameters.size() >= 2)
{
+ User* find = ServerInstance->FindNick(target.c_str());
+ if (find)
+ target = std::string("*!*@") + find->GetIPString();
+
// Adding - XXX todo make this respect <insane> tag perhaps..
long duration;
std::string expr;
@@ -125,7 +131,7 @@ class CommandShun : public Command
try
{
- r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), parameters[0].c_str());
+ r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str());
}
catch (...)
{
@@ -139,13 +145,13 @@ 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(), expr.c_str());
+ user->nick.c_str(), target.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(), expr.c_str());
+ user->nick.c_str(), target.c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), expr.c_str());
}
ServerInstance->XLines->ApplyLines();