summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 11:07:21 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 11:07:21 +0000
commitceebdc94375b820a24927336665c54943304656c (patch)
treeff522c884906edf5336f6c26302cce6c7b3684ea
parente997de794f6671ebda5a58b4452657182a742073 (diff)
Add a parameter to set what config tag to parse (defaults to what was previously hardcoded); Some other cleanups using initialisation lists, and using a ConfigParser stack-allocated rather than keeping a persistent heap-allocated one; Remove hardcoded filename prefixes in log messages
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4200 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/u_listmode.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h
index 322061991..f7d74a2c7 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -47,23 +47,19 @@ typedef std::vector<ListLimit> limitlist;
class ListModeBase : public ModeHandler
{
protected:
+ Server* Srv;
+
std::string infokey;
std::string listnumeric;
std::string endoflistnumeric;
std::string endofliststring;
+ std::string configtag;
limitlist chanlimits;
-
- Server* Srv;
- ConfigReader* Conf;
+
public:
- ListModeBase(Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum) : ModeHandler(modechar, 1, 1, true, MODETYPE_CHANNEL, false)
+ ListModeBase(Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, const std::string &ctag = "banlist")
+ : ModeHandler(modechar, 1, 1, true, MODETYPE_CHANNEL, false), Srv(serv), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), configtag(ctag)
{
- Srv = serv;
- Conf = new ConfigReader;
- mode = modechar;
- listnumeric = lnum;
- endoflistnumeric = eolnum;
- endofliststring = eolstr;
this->DoRehash();
infokey = "exceptionbase_mode_" + std::string(1, mode) + "_list";
}
@@ -83,26 +79,25 @@ class ListModeBase : public ModeHandler
virtual void DoRehash()
{
- delete Conf;
- Conf = new ConfigReader;
+ ConfigReader Conf;
chanlimits.clear();
- for(int i = 0; i < Conf->Enumerate("banlist"); i++)
+ for(int i = 0; i < Conf.Enumerate(configtag); i++)
{
// For each <banlist> tag
ListLimit limit;
- limit.mask = Conf->ReadValue("banlist", "chan", i);
- limit.limit = Conf->ReadInteger("banlist", "limit", i, true);
+ limit.mask = Conf.ReadValue(configtag, "chan", i);
+ limit.limit = Conf.ReadInteger(configtag, "limit", i, true);
if(limit.mask.size() && limit.limit > 0)
{
chanlimits.push_back(limit);
- log(DEBUG, "m_exceptionbase.so: Read channel listmode limit of %u for mask '%s'", limit.limit, limit.mask.c_str());
+ log(DEBUG, "Read channel listmode limit of %u for mask '%s'", limit.limit, limit.mask.c_str());
}
else
{
- log(DEBUG, "m_exceptionbase.so: Invalid tag");
+ log(DEBUG, "Invalid tag");
}
}
if(chanlimits.size() == 0)