diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-28 17:27:40 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-28 17:27:40 +0100 |
commit | e17fcc226b04ea62c6ab4444bc1175a93f5fce57 (patch) | |
tree | 7c772c3e941be1d9aee6e154960f537d80dcb703 | |
parent | 419537e7453928af2fde6648e87085a27e443486 (diff) |
Return true from Channel::PartUser() if the user was on the channel
-rw-r--r-- | include/channels.h | 3 | ||||
-rw-r--r-- | src/channels.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/channels.h b/include/channels.h index be84ac800..0cf477f22 100644 --- a/include/channels.h +++ b/include/channels.h @@ -205,8 +205,9 @@ class CoreExport Channel : public Extensible * If the reason field is NULL, no reason will be sent. * @param user The user who is parting (must be on this channel) * @param reason The part reason + * @return True if the user was on the channel and left, false if they weren't and nothing happened */ - void PartUser(User *user, std::string &reason); + bool PartUser(User* user, std::string& reason); /** Join a local user to a channel, with or without permission checks. May be a channel that doesn't exist yet. * @param user The user to join to the channel. diff --git a/src/channels.cpp b/src/channels.cpp index da5f4fd75..99da00708 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -405,12 +405,12 @@ ModResult Channel::GetExtBanStatus(User *user, char type) * Remove a channel from a users record, remove the reference to the Membership object * from the channel and destroy it. */ -void Channel::PartUser(User *user, std::string &reason) +bool Channel::PartUser(User* user, std::string& reason) { MemberMap::iterator membiter = userlist.find(user); if (membiter == userlist.end()) - return; + return false; Membership* memb = membiter->second; CUList except_list; @@ -422,6 +422,8 @@ void Channel::PartUser(User *user, std::string &reason) user->chans.erase(memb); // Remove the Membership from this channel's userlist and destroy it this->DelUser(membiter); + + return true; } void Channel::KickUser(User* src, const MemberMap::iterator& victimiter, const std::string& reason) |