summaryrefslogtreecommitdiff
path: root/src/modules/m_sapart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_sapart.cpp')
-rw-r--r--src/modules/m_sapart.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index f7620ec00..df44e4671 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -38,22 +38,18 @@ class cmd_sapart : public command_t
void Handle (const char** parameters, int pcnt, userrec *user)
{
- userrec* dest = Srv->FindNick(std::string(parameters[0]));
- if (dest)
+ userrec* dest = Srv->FindNick(parameters[0]);
+ chanrec* channel = Srv->FindChannel(parameters[1]);
+ if (dest && channel)
{
if (Srv->IsUlined(dest->server))
{
WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
- if (!IsValidChannelName(parameters[1]))
- {
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
-
- Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);
- Srv->PartUserFromChannel(dest,std::string(parameters[1]),std::string(dest->nick));
+ Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
+ if (!channel->PartUser(dest, dest->nick))
+ delete channel;
}
}
};