diff options
author | Peter Powell <petpow@saberuk.com> | 2018-04-21 12:04:43 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-04-22 13:02:19 +0100 |
commit | 35b70631f0532a5828b04a8e0c02092a285f331a (patch) | |
tree | 9e54fba45e659f23fb3b94341debfc0b23bc63af /src | |
parent | 46e71e2f509eb38166fafcc69931117f0f9b7798 (diff) | |
parent | dd3b11b3aa4eb6cb0b6aff4b245a9b075759737d (diff) |
Merge tag 'v2.0.26' into master.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_geoip.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_banredirect.cpp | 15 | ||||
-rw-r--r-- | src/modules/m_shun.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_swhois.cpp | 25 | ||||
-rw-r--r-- | src/modules/m_xline_db.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 1 | ||||
-rw-r--r-- | src/xline.cpp | 4 |
8 files changed, 51 insertions, 6 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 9359cac37..ab10d6ae1 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -82,6 +82,7 @@ ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::s void Module::OnMode(User*, User*, Channel*, const Modes::ChangeList&, ModeParser::ModeProcessFlag, const std::string&) { DetachEvent(I_OnMode); } void Module::OnOper(User*, const std::string&) { DetachEvent(I_OnOper); } void Module::OnPostOper(User*, const std::string&, const std::string &) { DetachEvent(I_OnPostOper); } +void Module::OnPostDeoper(User*) { DetachEvent(I_OnPostDeoper); } void Module::OnInfo(User*) { DetachEvent(I_OnInfo); } ModResult Module::OnUserPreInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserPreInvite); return MOD_RES_PASSTHRU; } ModResult Module::OnUserPreMessage(User*, const MessageTarget&, MessageDetails&) { DetachEvent(I_OnUserPreMessage); return MOD_RES_PASSTHRU; } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index 7083be6ac..0d7c2eb70 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -146,6 +146,13 @@ class ModuleGeoIP : public Module, public Stats::EventListener, public Whois::Ev return MOD_RES_DENY; } + void OnSetUserIP(LocalUser* user) CXX11_OVERRIDE + { + // If user has sent NICK/USER, re-set the ExtItem as this is likely CGI:IRC changing the IP + if (user->registered == REG_NICKUSER) + SetExt(user); + } + void OnWhois(Whois::Context& whois) CXX11_OVERRIDE { // If the extban is disabled we don't expose users location. diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 4a4188757..5ec75f13c 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -182,6 +182,21 @@ class BanRedirect : public ModeWatcher redirects = new BanRedirectList; extItem.set(channel, redirects); } + else + { + for (BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); ++redir) + { + // Mimic the functionality used when removing the mode + if (irc::equals(redir->targetchan, mask[CHAN]) && irc::equals(redir->banmask, param)) + { + // Make sure the +b handler will still set the right ban + param.append(mask[CHAN]); + // Silently ignore the duplicate and don't set metadata + // This still allows channel ops to set/unset a redirect ban to clear "ghost" redirects + return true; + } + } + } /* Here 'param' doesn't have the channel on it yet */ redirects->push_back(BanRedirectEntry(mask[CHAN], param)); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 92c0b0bd0..3e378a74c 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -230,7 +230,7 @@ class ModuleShun : public Module, public Stats::EventListener else if ((command == "PART") && (parameters.size() > 1)) { /* same for PART */ - parameters[1].clear(); + parameters.pop_back(); } /* if we're here, allow the command. */ diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index c7c14e30c..d42649909 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -37,9 +37,11 @@ enum class CommandSwhois : public Command { public: + LocalIntExt operblock; StringExtItem swhois; CommandSwhois(Module* Creator) : Command(Creator, "SWHOIS", 2, 2) + , operblock("swhois_operblock", ExtensionItem::EXT_USER, Creator) , swhois("swhois", ExtensionItem::EXT_USER, Creator) { flags_needed = 'o'; syntax = "<nick> :<swhois>"; @@ -70,6 +72,7 @@ class CommandSwhois : public Command ServerInstance->SNO->WriteGlobalSno('a', "%s used SWHOIS to set %s's extra whois to '%s'", user->nick.c_str(), dest->nick.c_str(), parameters[1].c_str()); } + operblock.set(user, 0); if (parameters[1].empty()) swhois.unset(dest); else @@ -127,10 +130,32 @@ class ModuleSWhois : public Module, public Whois::LineEventListener if (!swhois.length()) return; + cmd.operblock.set(user, 1); cmd.swhois.set(user, swhois); ServerInstance->PI->SendMetaData(user, "swhois", swhois); } + void OnPostDeoper(User* user) CXX11_OVERRIDE + { + std::string* swhois = cmd.swhois.get(user); + if (!swhois) + return; + + if (!cmd.operblock.get(user)) + return; + + cmd.operblock.set(user, 0); + cmd.swhois.unset(user); + ServerInstance->PI->SendMetaData(user, "swhois", ""); + } + + void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string&) CXX11_OVERRIDE + { + User* dest = static_cast<User*>(target); + if (dest && (extname == "swhois")) + cmd.operblock.set(dest, 0); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the SWHOIS command which allows setting of arbitrary WHOIS lines", VF_OPTCOMMON | VF_VENDOR); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index d220027fe..fb0c81d2f 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -114,7 +114,7 @@ class ModuleXLineDB : public Module { XLine* line = i->second; stream << "LINE " << line->type << " " << line->Displayable() << " " - << ServerInstance->Config->ServerName << " " << line->set_time << " " + << line->source << " " << line->set_time << " " << line->duration << " :" << line->reason << std::endl; } } diff --git a/src/users.cpp b/src/users.cpp index 5f31ff299..1e2554107 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -458,6 +458,7 @@ void User::UnOper() ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER); this->SetMode(opermh, false); + FOREACH_MOD(OnPostDeoper, (this)); } /* diff --git a/src/xline.cpp b/src/xline.cpp index dfd7e2903..cb4f011c0 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -589,10 +589,6 @@ void GLine::Apply(User* u) bool ELine::Matches(User *u) { - LocalUser* lu = IS_LOCAL(u); - if (lu && lu->exempt) - return false; - if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map)) { if (InspIRCd::MatchCIDR(u->GetRealHost(), this->hostmask, ascii_case_insensitive_map) || |