diff options
author | Adam <Adam@anope.org> | 2017-02-07 17:20:07 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-02-07 17:20:07 -0500 |
commit | 09dca29c8898916772c2a2a6b86b625c812007ed (patch) | |
tree | 1b28f4751feec3ea2b46fa0afb061da7926f3a47 /modules/chanserv/flags.cpp | |
parent | 8b694bc392c36551e428b84454efb81cdbc8bcd3 (diff) |
Normalize databases by not allowing generic Object references
Remove redis database support
Diffstat (limited to 'modules/chanserv/flags.cpp')
-rw-r--r-- | modules/chanserv/flags.cpp | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp index 6ec65d104..f535aa136 100644 --- a/modules/chanserv/flags.cpp +++ b/modules/chanserv/flags.cpp @@ -108,55 +108,28 @@ class CommandCSFlags : public Command ChanServ::AccessGroup u_access = source.AccessFor(ci); ChanServ::ChanAccess *highest = u_access.Highest(); - NickServ::Nick *na = nullptr; - ChanServ::Channel *targ_ci = nullptr; - - if (IRCD->IsChannelValid(mask)) + NickServ::Nick *na = NickServ::FindNick(mask); + if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access")) { - if (Config->GetModule("chanserv/main")->Get<bool>("disallow_channel_access")) - { - source.Reply(_("Channels may not be on access lists.")); - return; - } - - targ_ci = ChanServ::Find(mask); - if (targ_ci == NULL) - { - source.Reply(_("Channel \002{0}\002 isn't registered."), mask); - return; - } - else if (ci == targ_ci) - { - source.Reply(_("You can't add a channel to its own access list.")); - return; - } - - mask = targ_ci->GetName(); + source.Reply(_("Masks and unregistered users may not be on access lists.")); + return; } - else + + if (mask.find_first_of("!*@") == Anope::string::npos && !na) { - na = NickServ::FindNick(mask); - if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access")) + User *targ = User::Find(mask, true); + if (targ != NULL) + mask = "*!*@" + targ->GetDisplayedHost(); + else { - source.Reply(_("Masks and unregistered users may not be on access lists.")); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } - else if (mask.find_first_of("!*@") == Anope::string::npos && !na) - { - User *targ = User::Find(mask, true); - if (targ != NULL) - mask = "*!*@" + targ->GetDisplayedHost(); - else - { - source.Reply(_("\002{0}\002 isn't registered."), mask); - return; - } - } - - if (na) - mask = na->GetNick(); } + if (na) + mask = na->GetNick(); + ChanServ::ChanAccess *current = NULL; unsigned current_idx; std::set<char> current_flags; @@ -275,9 +248,7 @@ class CommandCSFlags : public Command FlagsChanAccess *access = Serialize::New<FlagsChanAccess *>(); if (na) - access->SetObj(na->GetAccount()); - else if (targ_ci) - access->SetObj(targ_ci); + access->SetAccount(na->GetAccount()); access->SetChannel(ci); access->SetMask(mask); access->SetCreator(source.GetNick()); |