diff options
Diffstat (limited to 'src/modules')
-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 |
5 files changed, 49 insertions, 2 deletions
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; } } |