diff options
author | Shawn Smith <ShawnSmith0828@gmail.com> | 2012-07-07 13:20:18 -0400 |
---|---|---|
committer | Shawn Smith <ShawnSmith0828@gmail.com> | 2012-07-07 14:04:02 -0400 |
commit | 61429d9c680188abd63e629d72fbc09e7e5cfc38 (patch) | |
tree | 6c189c9523f014e723773c8fa6e3fe865f8084e6 /src | |
parent | 1fe23633b78b836f6c906b651255c1bd169f3778 (diff) |
Added ExtBan U to match only Unregistered users
Enhancement requested in Issue #247
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_services_account.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index cd34e955a..57a08ada4 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2012 Shawn Smith <shawn@inspircd.org> * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org> * Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net> * Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com> @@ -137,6 +138,7 @@ class ModuleServicesAccount : public Module void On005Numeric(std::string &t) { ServerInstance->AddExtBanChar('R'); + ServerInstance->AddExtBanChar('U'); } /* <- :twisted.oscnet.org 330 w00t2 w00t2 w00t :is logged in as */ @@ -210,12 +212,30 @@ class ModuleServicesAccount : public Module ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) { - if (mask[0] == 'R' && mask[1] == ':') + if (mask[1] == ':') { - std::string *account = accountname.get(user); - if (account && InspIRCd::Match(*account, mask.substr(2))) - return MOD_RES_DENY; + if (mask[0] == 'R') + { + std::string *account = accountname.get(user); + if (account && InspIRCd::Match(*account, mask.substr(2))) + return MOD_RES_DENY; + } + else if (mask[0] == 'U') + { + std::string *account = accountname.get(user); + /* If the user is registered we don't care. */ + if (account) + return MOD_RES_PASSTHRU; + + /* If we made it this far we know the user isn't registered + so just deny if it matches */ + if (chan->GetExtBanStatus(user, 'U') == MOD_RES_DENY) + return MOD_RES_DENY; + } } + + /* If we made it this far then the ban wasn't an ExtBan + or the user we were checking for didn't match either ExtBan */ return MOD_RES_PASSTHRU; } |