From e3a4d6113dc8bd21f98882350b1317137df4c96c Mon Sep 17 00:00:00 2001 From: w00t Date: Thu, 10 Jan 2008 11:16:17 +0000 Subject: Add optional SAPART reason. No prefixing done yet. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8689 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_sapart.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 13a9b0c90..dc230cae2 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -23,16 +23,24 @@ class CommandSapart : public Command CommandSapart (InspIRCd* Instance) : Command(Instance,"SAPART", 'o', 2, false, 0) { this->source = "m_sapart.so"; - syntax = " "; - TRANSLATE3(TR_NICK, TR_TEXT, TR_END); + syntax = " [reason]"; + TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } CmdResult Handle (const char** parameters, int pcnt, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); Channel* channel = ServerInstance->FindChan(parameters[1]); + std::string reason; + if (dest && channel) { + ServerInstance->Log(DEBUG, "SAPART: pcnt is %d", pcnt); + if (pcnt == 3) + reason = parameters[2]; + else + reason = dest->nick; + if (ServerInstance->ULine(dest->server)) { user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick); @@ -45,7 +53,7 @@ class CommandSapart : public Command */ if (IS_LOCAL(dest)) { - if (!channel->PartUser(dest, dest->nick)) + if (!channel->PartUser(dest, reason.c_str())) delete channel; Channel* n = ServerInstance->FindChan(parameters[1]); if (!n) -- cgit v1.2.3