* +------------------------------------+
*
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
class CommandRandquote : public Command
{
public:
- CommandRandquote (InspIRCd* Instance) : Command(Instance,"RANDQUOTE", 0, 0)
+ CommandRandquote(Module* Creator) : Command(Creator,"RANDQUOTE", 0)
{
- this->source = "m_randquote.so";
}
CmdResult Handle (const std::vector<std::string>& parameters, User *user)
return CMD_FAILURE;
}
- return CMD_LOCALONLY;
+ return CMD_SUCCESS;
}
};
class ModuleRandQuote : public Module
{
private:
- CommandRandquote* mycommand;
+ CommandRandquote cmd;
ConfigReader *conf;
public:
- ModuleRandQuote(InspIRCd* Me)
- : Module(Me)
+ ModuleRandQuote()
+ : cmd(this)
{
- conf = new ConfigReader(ServerInstance);
+ conf = new ConfigReader;
// Sort the Randomizer thingie..
srand(ServerInstance->Time());
prefix = conf->ReadValue("randquote","prefix",0);
suffix = conf->ReadValue("randquote","suffix",0);
- mycommand = NULL;
-
if (q_file.empty())
{
throw ModuleException("m_randquote: Quotefile not specified - Please check your config.");
}
- quotes = new FileReader(ServerInstance, q_file);
+ quotes = new FileReader(q_file);
if(!quotes->Exists())
{
throw ModuleException("m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
else
{
/* Hidden Command -- Mode clients assume /quote sends raw data to an IRCd >:D */
- mycommand = new CommandRandquote(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
Implementation eventlist[] = { I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual Version GetVersion()
{
- return Version("$Id$",VF_VENDOR,API_VERSION);
+ return Version("Provides random Quotes on Connect.",VF_VENDOR,API_VERSION);
}
virtual void OnUserConnect(User* user)
{
- if (mycommand)
- mycommand->Handle(std::vector<std::string>(), user);
+ cmd.Handle(std::vector<std::string>(), user);
}
};