#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "helperfuncs.h"
#include "inspircd.h"
// Global Vars
static ConfigReader *helpop;
-
-
bool do_helpop(const char**, int, userrec*);
void sendtohelpop(userrec*, int, const char**);
/* $ModDesc: /helpop Command, Works like Unreal helpop */
+/** Handles user mode +h
+ */
class Helpop : public ModeHandler
{
public:
}
};
+/** Handles /HELPOP
+ */
class cmd_helpop : public command_t
{
public:
syntax = "[?|!]<any-text>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
char a[MAXBUF];
std::string output = " ";
if (!helpop)
- return;
+ return CMD_FAILURE;
if (pcnt < 1)
{
do_helpop(NULL,pcnt,user);
- return;
+ return CMD_SUCCESS;
}
if (*parameters[0] == '!')
sendtohelpop(user, pcnt, parameters);
}
}
+
+ return CMD_SUCCESS;
}
}
};
+/** Thrown by m_helpop
+ */
class HelpopException : public ModuleException
{
private:
virtual void ReadConfig()
{
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
h_file = conf->ReadValue("helpop", "file", 0);
if (h_file == "")
throw(e);
}
- helpop = new ConfigReader(h_file);
+ helpop = new ConfigReader(ServerInstance, h_file);
if ((helpop->ReadValue("nohelp", "line1", 0) == "") ||
(helpop->ReadValue("nohelpo", "line1", 0) == "") ||
(helpop->ReadValue("start", "line1", 0) == ""))
virtual ~ModuleHelpop()
{
+ ServerInstance->Modes->DelMode(ho);
DELETE(conf);
DELETE(helpop);
DELETE(ho);
virtual Version GetVersion()
{
- return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
+ return Version(1,0,0,1,VF_COMMON|VF_VENDOR);
}
};