* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
/* $ModDesc: Povides support for the /DCCALLOW command */
-static ConfigReader *Conf;
-
-class BannedFileList : public classbase
+class BannedFileList
{
public:
std::string filemask;
std::string action;
};
-class DCCAllow : public classbase
+class DCCAllow
{
public:
std::string nickname;
}
std::string nick = parameters[0].substr(1);
- User *target = ServerInstance->FindNick(nick);
+ User *target = ServerInstance->FindNickOnly(nick);
if (target)
{
}
std::string mask = std::string(target->nick)+"!"+std::string(target->ident)+"@"+std::string(target->dhost);
- std::string default_length = Conf->ReadValue("dccallow", "length", 0);
+ ConfigReader Conf;
+ std::string default_length = Conf.ReadValue("dccallow", "length", 0);
long length;
if (parameters.size() < 2)
ModuleDCCAllow()
: cmd(this)
{
- Conf = new ConfigReader;
ext = new SimpleExtItem<dccallowlist>("dccallow", this);
- Extensible::Register(ext);
+ ServerInstance->Extensions.Register(ext);
ServerInstance->AddCommand(&cmd);
ReadFileConf();
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPreNick, I_OnRehash };
virtual void OnRehash(User* user)
{
- delete Conf;
- Conf = new ConfigReader;
ReadFileConf();
}
irc::string type = tokens[1].c_str();
- bool blockchat = Conf->ReadFlag("dccallow", "blockchat", 0);
+ ConfigReader Conf;
+ bool blockchat = Conf.ReadFlag("dccallow", "blockchat", 0);
if (type == "SEND")
{
- std::string defaultaction = Conf->ReadValue("dccallow", "action", 0);
+ std::string defaultaction = Conf.ReadValue("dccallow", "action", 0);
std::string filename = tokens[2];
bool found = false;
void ReadFileConf()
{
+ ConfigReader Conf;
bfl.clear();
- for (int i = 0; i < Conf->Enumerate("banfile"); i++)
+ for (int i = 0; i < Conf.Enumerate("banfile"); i++)
{
BannedFileList bf;
- std::string fileglob = Conf->ReadValue("banfile", "pattern", i);
- std::string action = Conf->ReadValue("banfile", "action", i);
+ std::string fileglob = Conf.ReadValue("banfile", "pattern", i);
+ std::string action = Conf.ReadValue("banfile", "action", i);
bf.filemask = fileglob;
bf.action = action;
bfl.push_back(bf);
virtual ~ModuleDCCAllow()
{
- delete Conf;
delete ext;
- Conf = NULL;
}
virtual Version GetVersion()
{
- return Version("Povides support for the /DCCALLOW command", VF_COMMON | VF_VENDOR, API_VERSION);
+ return Version("Povides support for the /DCCALLOW command", VF_COMMON | VF_VENDOR);
}
};