From e17fcc226b04ea62c6ab4444bc1175a93f5fce57 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 28 Dec 2015 17:27:40 +0100 Subject: Return true from Channel::PartUser() if the user was on the channel --- include/channels.h | 3 ++- 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) -- cgit v1.2.3