From acf783b83cf474d0ebe6f1aed8083e93033f2150 Mon Sep 17 00:00:00 2001 From: peavey Date: Mon, 6 Apr 2009 00:07:30 +0000 Subject: 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 --- src/modules/m_shun.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/modules/m_shun.cpp') 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 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(); -- cgit v1.2.3