* ---------------------------------------------------
*/
+#include "inspircd.h"
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "inspircd.h"
#include "wildcard.h"
-#include <vector>
/* $ModDesc: Provides aliases of commands. */
public:
ModuleAlias(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ReadAliases();
pars.resize(127);
bool everything_after = (varname == "-");
std::string word = "";
- ServerInstance->Log(DEBUG,"Get var %d%s", index , everything_after ? " and all after it" : "");
-
for (int j = 0; j < index; j++)
word = ss.GetToken();
}
}
- ServerInstance->Log(DEBUG,"Var is '%s'", word.c_str());
-
return word;
}
continue;
}
- if ((Aliases[i].operonly) && (!*user->oper))
+ if ((Aliases[i].operonly) && (!IS_OPER(user)))
return 0;
if (Aliases[i].requires != "")
if (crlf == std::string::npos)
{
- ServerInstance->Log(DEBUG,"Single line alias: '%s'", Aliases[i].replace_with.c_str());
DoCommand(Aliases[i].replace_with, user, safe);
return 1;
}
else
{
- ServerInstance->Log(DEBUG,"Multi line alias: '%s'", Aliases[i].replace_with.c_str());
irc::sepstream commands(Aliases[i].replace_with, '\n');
std::string command = "*";
while ((command = commands.GetToken()) != "")
{
- ServerInstance->Log(DEBUG,"Execute: '%s'", command.c_str());
DoCommand(command, user, safe);
}
return 1;
const char* parv[127];
int x = 0;
- while ((pars[x] = ss.GetToken()) != "")
+ while (ss.GetToken(pars[x]))
{
parv[x] = pars[x].c_str();
- ServerInstance->Log(DEBUG,"Parameter %d: %s", x, parv[x]);
x++;
}
- ServerInstance->Log(DEBUG,"Call command handler on %s", parv[0]);
-
- if (ServerInstance->Parser->CallHandler(parv[0], &parv[1], x-1, user) == CMD_INVALID)
- {
- ServerInstance->Log(DEBUG,"Unknown command or not enough parameters");
- }
- else
- {
- ServerInstance->Log(DEBUG,"Command handler called successfully.");
- }
+ ServerInstance->Parser->CallHandler(parv[0], &parv[1], x-1, user);
}
virtual void OnRehash(userrec* user, const std::string ¶meter)
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleAliasFactory;
}