diff options
author | Adam <Adam@anope.org> | 2014-06-23 09:45:15 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-06-23 09:45:15 -0400 |
commit | fd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (patch) | |
tree | 1d68e86065e0b012aee41533d4f9b289ee0707ac /src/channels.cpp | |
parent | 148b26f687ce85dc01e852a2358b03d493757ada (diff) | |
parent | 9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff) |
Merge branch '2.0' into 2.1
Conflicts:
cmake/Anope.cmake
cmake/FindGettext.cmake
include/access.h
include/messages.h
include/modes.h
include/modules.h
include/users.h
modules/CMakeLists.txt
modules/commands/bs_bot.cpp
modules/commands/cs_access.cpp
modules/commands/cs_ban.cpp
modules/commands/cs_clone.cpp
modules/commands/cs_flags.cpp
modules/commands/cs_info.cpp
modules/commands/cs_list.cpp
modules/commands/cs_log.cpp
modules/commands/cs_mode.cpp
modules/commands/cs_status.cpp
modules/commands/cs_suspend.cpp
modules/commands/cs_updown.cpp
modules/commands/cs_xop.cpp
modules/commands/ms_check.cpp
modules/commands/ns_access.cpp
modules/commands/ns_cert.cpp
modules/commands/ns_group.cpp
modules/commands/ns_register.cpp
modules/commands/ns_set.cpp
modules/commands/ns_suspend.cpp
modules/commands/os_session.cpp
modules/commands/os_svs.cpp
modules/extra/m_ldap_authentication.cpp
modules/extra/m_regex_pcre.cpp
modules/extra/m_sql_authentication.cpp
modules/extra/stats/m_chanstats.cpp
modules/protocol/bahamut.cpp
modules/protocol/hybrid.cpp
modules/protocol/inspircd12.cpp
modules/protocol/inspircd20.cpp
modules/protocol/unreal.cpp
modules/pseudoclients/chanserv.cpp
modules/pseudoclients/chanserv/channel.cpp
modules/pseudoclients/nickserv/nickserv.cpp
modules/webcpanel/pages/chanserv/access.cpp
src/access.cpp
src/bots.cpp
src/channels.cpp
src/language.cpp
src/modes.cpp
src/modulemanager.cpp
src/process.cpp
src/users.cpp
src/version.sh
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index aff45fcd6..2d01ad703 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -243,11 +243,14 @@ std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> Channel::Get return std::make_pair(it, it_end); } -void Channel::SetModeInternal(const MessageSource &setter, ChannelMode *cm, const Anope::string ¶m, bool enforce_mlock) +void Channel::SetModeInternal(const MessageSource &setter, ChannelMode *ocm, const Anope::string &oparam, bool enforce_mlock) { - if (!cm) + if (!ocm) return; + Anope::string param = oparam; + ChannelMode *cm = ocm->Unwrap(param); + EventReturn MOD_RESULT; /* Setting v/h/o/a/q etc */ @@ -310,11 +313,14 @@ void Channel::SetModeInternal(const MessageSource &setter, ChannelMode *cm, cons this->CheckModes(); } -void Channel::RemoveModeInternal(const MessageSource &setter, ChannelMode *cm, const Anope::string ¶m, bool enforce_mlock) +void Channel::RemoveModeInternal(const MessageSource &setter, ChannelMode *ocm, const Anope::string &oparam, bool enforce_mlock) { - if (!cm) + if (!ocm) return; + Anope::string param = oparam; + ChannelMode *cm = ocm->Unwrap(param); + EventReturn MOD_RESULT; /* Setting v/h/o/a/q etc */ @@ -388,6 +394,7 @@ void Channel::RemoveModeInternal(const MessageSource &setter, ChannelMode *cm, c void Channel::SetMode(User *bi, ChannelMode *cm, const Anope::string ¶m, bool enforce_mlock) { + Anope::string wparam = param; if (!cm) return; /* Don't set modes already set */ @@ -396,11 +403,11 @@ void Channel::SetMode(User *bi, ChannelMode *cm, const Anope::string ¶m, boo else if (cm->type == MODE_PARAM) { ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm); - if (!cmp->IsValid(param)) + if (!cmp->IsValid(wparam)) return; Anope::string cparam; - if (GetParam(cm->name, cparam) && cparam.equals_cs(param)) + if (GetParam(cm->name, cparam) && cparam.equals_cs(wparam)) return; } else if (cm->type == MODE_STATUS) @@ -412,7 +419,11 @@ void Channel::SetMode(User *bi, ChannelMode *cm, const Anope::string ¶m, boo else if (cm->type == MODE_LIST) { ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm); - if (this->HasMode(cm->name, param) || !cml->IsValid(param)) + + if (!cml->IsValid(wparam)) + return; + + if (this->HasMode(cm->name, wparam)) return; } @@ -427,8 +438,10 @@ void Channel::SetMode(User *bi, ChannelMode *cm, const Anope::string ¶m, boo this->chanserv_modecount++; } - ModeManager::StackerAdd(bi, this, cm, true, param); - SetModeInternal(bi, cm, param, enforce_mlock); + ChannelMode *wcm = cm->Wrap(wparam); + + ModeManager::StackerAdd(bi, this, wcm, true, wparam); + SetModeInternal(bi, wcm, wparam, enforce_mlock); } void Channel::SetMode(User *bi, const Anope::string &mname, const Anope::string ¶m, bool enforce_mlock) @@ -477,8 +490,11 @@ void Channel::RemoveMode(User *bi, ChannelMode *cm, const Anope::string ¶m, this->chanserv_modecount++; } - ModeManager::StackerAdd(bi, this, cm, false, realparam); - RemoveModeInternal(bi, cm, realparam, enforce_mlock); + Anope::string wparam = realparam; + ChannelMode *wcm = cm->Wrap(wparam); + + ModeManager::StackerAdd(bi, this, wcm, false, wparam); + RemoveModeInternal(bi, wcm, wparam, enforce_mlock); } void Channel::RemoveMode(User *bi, const Anope::string &mname, const Anope::string ¶m, bool enforce_mlock) @@ -843,21 +859,21 @@ void Channel::SetCorrectModes(User *user, bool give_modes) } } -bool Channel::Unban(User *u, bool full) +bool Channel::Unban(User *u, const Anope::string &mode, bool full) { - if (!this->HasMode("BAN")) + if (!this->HasMode(mode)) return false; bool ret = false; - std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = this->GetModeList("BAN"); + std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = this->GetModeList(mode); for (; bans.first != bans.second;) { - Entry ban("BAN", bans.first->second); + Entry ban(mode, bans.first->second); ++bans.first; if (ban.Matches(u, full)) { - this->RemoveMode(NULL, "BAN", ban.GetMask()); + this->RemoveMode(NULL, mode, ban.GetMask()); ret = true; } } |