diff options
Diffstat (limited to 'modules/commands/cs_access.cpp')
-rw-r--r-- | modules/commands/cs_access.cpp | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 239c344ab..88dd751c3 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -158,9 +158,10 @@ class CommandCSAccess : public Command } } - if (ci->GetAccessCount() >= Config->CSAccessMax) + unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1024"); + if (access_max && ci->GetAccessCount() >= access_max) { - source.Reply(_("Sorry, you can only have %d access entries on a channel."), Config->CSAccessMax); + source.Reply(_("Sorry, you can only have %d access entries on a channel."), access_max); return; } @@ -326,7 +327,7 @@ class CommandCSAccess : public Command Anope::string timebuf; if (ci->c) for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit) - if (access->Matches((*cit)->user, (*cit)->user->Account())) + if (access->Matches(cit->second->user, cit->second->user->Account())) timebuf = "Now"; if (timebuf.empty()) { @@ -360,7 +361,7 @@ class CommandCSAccess : public Command Anope::string timebuf; if (ci->c) for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit) - if (access->Matches((*cit)->user, (*cit)->user->Account())) + if (access->Matches(cit->second->user, cit->second->user->Account())) timebuf = "Now"; if (timebuf.empty()) { @@ -552,24 +553,10 @@ class CommandCSAccess : public Command " \n" "The \002ACCESS CLEAR\002 command clears all entries of the\n" "access list.")); - source.Reply(_("\002User access levels\002\n" - " \n" - "By default, the following access levels are defined:\n" - " \n" - " \002Founder\002 Full access to %s functions; automatic\n" - " opping upon entering channel. Note\n" - " that only one person may have founder\n" - " status (it cannot be given using the\n" - " \002ACCESS\002 command).\n" - " \002 10\002 Access to AKICK command; automatic opping.\n" - " \002 5\002 Automatic opping.\n" - " \002 3\002 Automatic voicing.\n" - " \002 0\002 No special privileges; can be opped by other\n" - " ops (unless \002secure-ops\002 is set).\n" - " \n" - "These levels may be changed, or new ones added, using the\n" + source.Reply(" "); + source.Reply(_("\002User access levels\002 can be seen by using the\n" "\002LEVELS\002 command; type \002%s%s HELP LEVELS\002 for\n" - "information."), source.service->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str()); + "information."), source.service->nick.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); return true; } }; @@ -604,7 +591,7 @@ class CommandCSLevels : public Command { Privilege *p = PrivilegeManager::FindPrivilege(what); if (p == NULL) - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str()); + source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); else { ci->SetLevel(p->name, level); @@ -642,7 +629,7 @@ class CommandCSLevels : public Command } } - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str()); + source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); return; } @@ -797,39 +784,30 @@ class CSAccess : public Module CommandCSLevels commandcslevels; public: - CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), + CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), accessprovider(this), commandcsaccess(this), commandcslevels(this) { - this->SetAuthor("Anope"); this->SetPermanent(true); Implementation i[] = { I_OnReload, I_OnCreateChan, I_OnGroupCheckPriv }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - try - { - this->OnReload(); - } - catch (const ConfigException &ex) - { - throw ModuleException(ex.GetReason()); - } } - void OnReload() anope_override + void OnReload(Configuration::Conf *conf) anope_override { defaultLevels.clear(); - ConfigReader config; - for (int i = 0; i < config.Enumerate("privilege"); ++i) + for (int i = 0; i < conf->CountBlock("privilege"); ++i) { - const Anope::string &pname = config.ReadValue("privilege", "name", "", i); + Configuration::Block *priv = conf->GetBlock("privilege", i); + + const Anope::string &pname = priv->Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = config.ReadValue("privilege", "level", "", i); + const Anope::string &value = priv->Get<const Anope::string>("level"); if (value.empty()) continue; else if (value.equals_ci("founder")) @@ -837,7 +815,7 @@ class CSAccess : public Module else if (value.equals_ci("disabled")) defaultLevels[p->name] = ACCESS_INVALID; else - defaultLevels[p->name] = config.ReadInteger("privilege", "level", i, false); + defaultLevels[p->name] = priv->Get<int16_t>("level"); } } |