mirror of
https://github.com/anope/anope.git
synced 2026-07-03 11:13:13 +02:00
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
This commit is contained in:
@@ -39,8 +39,6 @@ struct EntryMsg : Serializable
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
static unsigned MaxEntries = 0;
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >, ExtensibleItem
|
||||
{
|
||||
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
@@ -140,7 +138,7 @@ class CommandEntryMessage : public Command
|
||||
ci->Extend("cs_entrymsg", messages);
|
||||
}
|
||||
|
||||
if (MaxEntries && (*messages)->size() >= MaxEntries)
|
||||
if ((*messages)->size() >= Config->GetModule(this->owner)->Get<unsigned>("maxentries"))
|
||||
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
@@ -276,7 +274,7 @@ class CSEntryMessage : public Module
|
||||
CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), entrymsg_type("EntryMsg", EntryMsg::Unserialize), commandentrymsg(this)
|
||||
{
|
||||
|
||||
Implementation i[] = { I_OnReload, I_OnJoinChannel };
|
||||
Implementation i[] = { I_OnJoinChannel };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
}
|
||||
|
||||
@@ -291,11 +289,6 @@ class CSEntryMessage : public Module
|
||||
u->SendMessage(c->ci->WhoSends(), "[%s] %s", c->ci->name.c_str(), (*messages)->at(i)->message.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override
|
||||
{
|
||||
MaxEntries = reader.ReadInteger("cs_entrymsg", "maxentries", "5", 0, true);
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(CSEntryMessage)
|
||||
|
||||
Reference in New Issue
Block a user