diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 12:52:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 12:52:24 +0000 |
commit | 6f1b8f50dd8a9f73c9e02e64253e7e45642a88d0 (patch) | |
tree | 4cb07b9523faaaa9cfd9c43f4f904203231328f3 /src/modules | |
parent | 7a3907f0518238402a4ea592fe5fb18849a833c5 (diff) |
Change to chanrec::PartUser. As with KickUser and ServerKickUser, returns the number of users left, if it returns 0, delete the chanrec
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4786 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_park.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_remove.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 16 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 9fbae3529..31da8f033 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -163,9 +163,11 @@ class cmd_unpark : public command_t // first part the user from all chans theyre on, so things dont get messy for (std::vector<ucrec*>::iterator i = user->chans.begin(); i != user->chans.end(); i++) { - if (((ucrec*)(*i))->channel != NULL) + chanrec* chan = (*i)->channel; + if (chan != NULL) { - Srv->PartUserFromChannel(user,((ucrec*)(*i))->channel->name,"Unparking"); + if (!chan->PartUser(user, "Unparking")) + delete chan; } } // remove all their old modes diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index ab0f2dbaa..bab5ea11b 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -181,10 +181,12 @@ class RemoveBase /* Build up the part reason string. */ reason << "Removed by " << user->nick << reasonparam; - - Srv->PartUserFromChannel(target, channel->name, reason.str()); + WriteChannelWithServ(Srv->GetServerName().c_str(), channel, "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick); WriteServ(target->fd, "NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str()); + + if (!channel->PartUser(target, reason.str().c_str())) + delete channel; } else { 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; } } }; |