From 81fda049c16575a0e5d10a20c334ab4fe01d7a6d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 17 Sep 2006 14:11:22 +0000 Subject: First of many m_alias tidyups, this will eventually become a rewrite of the majority of this module git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5267 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_alias.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/modules/m_alias.cpp') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 6a4eaf795..26ab8eae7 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -42,26 +42,24 @@ class Alias : public classbase class ModuleAlias : public Module { private: - ConfigReader *MyConf; std::vector Aliases; virtual void ReadAliases() { + ConfigReader MyConf(ServerInstance); + Aliases.clear(); - for (int i = 0; i < MyConf->Enumerate("alias"); i++) + for (int i = 0; i < MyConf.Enumerate("alias"); i++) { Alias a; std::string txt; - txt = MyConf->ReadValue("alias", "text", i); + txt = MyConf.ReadValue("alias", "text", i); a.text = txt.c_str(); - a.replace_with = MyConf->ReadValue("alias", "replace", i); - a.requires = MyConf->ReadValue("alias", "requires", i); - - a.uline = ((MyConf->ReadValue("alias", "uline", i) == "yes") || - (MyConf->ReadValue("alias", "uline", i) == "1") || - (MyConf->ReadValue("alias", "uline", i) == "true")); - + a.replace_with = MyConf.ReadValue("alias", "replace", i); + a.requires = MyConf.ReadValue("alias", "requires", i); + a.uline = MyConf.ReadFlag("alias", "uline", i); + Aliases.push_back(a); } @@ -72,8 +70,6 @@ class ModuleAlias : public Module ModuleAlias(InspIRCd* Me) : Module::Module(Me) { - - MyConf = new ConfigReader(ServerInstance); ReadAliases(); } @@ -84,7 +80,6 @@ class ModuleAlias : public Module virtual ~ModuleAlias() { - DELETE(MyConf); } virtual Version GetVersion() @@ -150,9 +145,6 @@ class ModuleAlias : public Module virtual void OnRehash(const std::string ¶meter) { - DELETE(MyConf); - MyConf = new ConfigReader(ServerInstance); - ReadAliases(); } }; -- cgit v1.2.3