diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-27 07:25:22 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-27 07:25:22 +0000 |
commit | 08f11b64233b42dc8e3b8fbd9e91c8bbeb3cd8eb (patch) | |
tree | d6ea07c7b4313c8cf980f7805a4beab163bd0c6c /src | |
parent | f5c3ae7d2ad21b7d5e2585f0d3458c6d758a9989 (diff) |
Tidy up how PART without reason is done
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5346 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
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); |