From 08f11b64233b42dc8e3b8fbd9e91c8bbeb3cd8eb Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 27 Sep 2006 07:25:22 +0000 Subject: Tidy up how PART without reason is done git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5346 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 12291f54f..6f5d45df4 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -459,8 +459,8 @@ bool chanrec::IsBanned(userrec* user) } /* chanrec::PartUser - * remove a channel from a users record, and remove the record from the hash - * if the channel has become empty + * remove a channel from a users record, and return the number of users left. + * Therefore, if this function returns 0 the caller should delete the chanrec. */ long chanrec::PartUser(userrec *user, const char* reason) { @@ -472,16 +472,8 @@ long chanrec::PartUser(userrec *user, const char* reason) /* zap it from the channel list of the user */ if (user->chans[i]->channel == this) { - if (reason) - { - FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason)); - this->WriteChannel(user, "PART %s :%s", this->name, reason); - } - else - { - FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, "")); - this->WriteChannel(user, "PART :%s", this->name); - } + FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : "")); + this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : ""); user->chans[i]->uc_modes = 0; user->chans[i]->channel = NULL; user->ModChannelCount(-1); -- cgit v1.2.3