summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-02-21 12:35:20 -0500
committerAdam <Adam@anope.org>2017-02-21 12:35:20 -0500
commita1d7d42d6aa1e9cb7546fdd689854b0a654901a9 (patch)
tree3ddae953c32b9737e6670865ed0ab4ac0b098698 /src/channels.cpp
parent3f7c0829efb1d3af8f7a0e8092c6dadb2ed041e8 (diff)
Unwrap mode changes in RemoveMode before checking if it is set, fixes os_mode not being able to remove extbans etc
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 3ea8da375..184a7deb1 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -464,15 +464,21 @@ void Channel::SetMode(BotInfo *bi, const Anope::string &mname, const Anope::stri
SetMode(bi, ModeManager::FindChannelModeByName(mname), param, enforce_mlock);
}
-void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param, bool enforce_mlock)
+void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &wparam, bool enforce_mlock)
{
if (!cm)
return;
+
/* Don't unset modes that arent set */
if ((cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && !HasMode(cm->name))
return;
+
+ /* Unwrap to be sure we have the internal representation */
+ Anope::string param = wparam;
+ cm = cm->Unwrap(param);
+
/* Don't unset status that aren't set */
- else if (cm->type == MODE_STATUS)
+ if (cm->type == MODE_STATUS)
{
User *u = User::Find(param);
if (!u || !HasUserStatus(u, anope_dynamic_static_cast<ChannelModeStatus *>(cm)))
@@ -485,13 +491,12 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &para
}
/* Get the param to send, if we need it */
- Anope::string realparam = param;
if (cm->type == MODE_PARAM)
{
- realparam.clear();
+ param.clear();
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
if (!cmp->minus_no_arg)
- this->GetParam(cmp->name, realparam);
+ this->GetParam(cmp->name, param);
}
if (Me->IsSynced())
@@ -505,12 +510,12 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &para
this->chanserv_modecount++;
}
- Anope::string wparam = realparam;
- ChannelMode *wcm = cm->Wrap(wparam);
+ /* Wrap to get ircd representation */
+ ChannelMode *wcm = cm->Wrap(param);
- ModeManager::StackerAdd(bi, this, wcm, false, wparam);
+ ModeManager::StackerAdd(bi, this, wcm, false, param);
MessageSource ms(bi);
- RemoveModeInternal(ms, wcm, wparam, enforce_mlock);
+ RemoveModeInternal(ms, wcm, param, enforce_mlock);
}
void Channel::RemoveMode(BotInfo *bi, const Anope::string &mname, const Anope::string &param, bool enforce_mlock)