X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_banredirect.cpp;h=d3490acc062aab9eeb569ff4d4ebf9c4fd791916;hb=43b5073d6f80a8dcb7044ecd127fd5893da033ab;hp=b0be8d665d5d4d56cdfa6df581965cedc1578c70;hpb=ade1500382366b0cf24147370aea0a3e5bbe50bf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index b0be8d665..d3490acc0 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -50,7 +50,7 @@ class BanRedirect : public ModeWatcher BanRedirect(Module* parent) : ModeWatcher(parent, "ban", MODETYPE_CHANNEL) , ban(parent, "ban") - , extItem("banredirect", parent) + , extItem("banredirect", ExtensionItem::EXT_CHANNEL, parent) { } @@ -74,6 +74,9 @@ class BanRedirect : public ModeWatcher if (param.length() >= 2 && param[1] == ':') return true; + if (param.find('#') == std::string::npos) + return true; + ListModeBase* banlm = static_cast(*ban); unsigned int maxbans = banlm->GetLimit(channel); ListModeBase::ModeList* list = banlm->GetList(channel); @@ -123,6 +126,14 @@ class BanRedirect : public ModeWatcher mask[NICK].swap(mask[IDENT]); } + if (!mask[NICK].empty() && mask[IDENT].empty() && mask[HOST].empty()) + { + if (mask[NICK].find('.') != std::string::npos || mask[NICK].find(':') != std::string::npos) + { + mask[NICK].swap(mask[HOST]); + } + } + for(int i = 0; i < 3; i++) { if(mask[i].empty()) @@ -238,26 +249,16 @@ class ModuleBanRedirect : public Module if(redirects) { - irc::modestacker modestack(false); + ModeHandler* ban = ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL); + Modes::ChangeList changelist; for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++) - { - modestack.Push('b', i->targetchan.insert(0, i->banmask)); - } + changelist.push_remove(ban, i->targetchan.insert(0, i->banmask)); for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++) - { - modestack.PushPlus(); - modestack.Push('b', i->banmask); - } + changelist.push_add(ban, i->banmask); - std::vector stackresult; - stackresult.push_back(chan->name); - while (modestack.GetStackedLine(stackresult)) - { - ServerInstance->Modes->Process(stackresult, ServerInstance->FakeClient, ModeParser::MODE_LOCALONLY); - stackresult.erase(stackresult.begin() + 1, stackresult.end()); - } + ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist, ModeParser::MODE_LOCALONLY); } } } @@ -316,7 +317,7 @@ class ModuleBanRedirect : public Module else { user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Cannot join channel (You are banned)", chan->name.c_str()); - user->WriteNumeric(470, "%s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", chan->name.c_str(), redir->targetchan.c_str()); + user->WriteNumeric(470, "%s %s :You are banned from this channel, so you are automatically transferred to the redirected channel.", chan->name.c_str(), redir->targetchan.c_str()); nofollow = true; Channel::JoinUser(user, redir->targetchan); nofollow = false;