diff options
| author | 2023-07-06 21:48:51 +0100 | |
|---|---|---|
| committer | 2023-07-06 21:56:28 +0100 | |
| commit | 66f2423a1d5f1ce6ff3ad116181bbde0acaf7e41 (patch) | |
| tree | a3035827eb8cd595a6c4c32ff96e9ccb6c60a4fd /src/channels.cpp | |
| parent | Respect notifyuser in the muteban part handler. (diff) | |
Make PartUser inline and add an overload that takes an iterator.
The return value of PartUser is not used 99% of the time so this
allows the compiler to optimise it out.
Diffstat (limited to 'src/channels.cpp')
| -rw-r--r-- | src/channels.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index f302b691f..c94832327 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -304,17 +304,9 @@ bool Channel::CheckBan(User* user, const std::string& mask) InspIRCd::MatchCIDR(user->GetAddress(), suffix); } -/* Channel::PartUser - * Remove a channel from a users record, remove the reference to the Membership object - * from the channel and destroy it. - */ -bool Channel::PartUser(User* user, const std::string& reason) +void Channel::PartUser(const MemberMap::iterator& membiter, const std::string& reason) { - MemberMap::iterator membiter = userlist.find(user); - - if (membiter == userlist.end()) - return false; - + User* user = membiter->first; Membership* memb = membiter->second; std::string partreason(reason); CUList except_list; @@ -325,10 +317,9 @@ bool Channel::PartUser(User* user, const std::string& reason) // Remove this channel from the user's chanlist 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) |
