1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 09:16:38 +02:00

Allow OnPreHelp to stop processing

This commit is contained in:
Adam
2011-09-19 13:12:52 -04:00
parent 4c2a4929ea
commit 1184eb59c5
10 changed files with 28 additions and 17 deletions
+2 -1
View File
@@ -317,8 +317,9 @@ class CoreExport Module : public Extensible
/** Called when someone uses the generic/help command
* @param source Command source
* @param params Params
* @return EVENT_STOP to stop processing
*/
virtual void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) { }
virtual EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when someone uses the generic/help command
* @param source Command source
+1 -1
View File
@@ -461,7 +461,7 @@ class CommandCSAKick : public Command
this->SetSyntax(_("\037channel\037 ADD {\037nick\037 | \037mask\037} [\037reason\037]"));
this->SetSyntax(_("\037channel\037 DEL {\037nick\037 | \037mask\037 | \037entry-num\037 | \037list\037}"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\002AKICK \037channel\037 VIEW [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 VIEW [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 ENFORCE"));
this->SetSyntax(_("\037channel\037 CLEAR"));
}
+4 -1
View File
@@ -25,7 +25,10 @@ class CommandHelp : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
FOREACH_MOD(I_OnPreHelp, OnPreHelp(source, params));
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnPreHelp, OnPreHelp(source, params));
if (MOD_RESULT == EVENT_STOP)
return;
User *u = source.u;
BotInfo *bi = source.owner;
+3 -2
View File
@@ -169,10 +169,10 @@ class BotServCore : public Module
}
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->BotServ)
return;
return EVENT_CONTINUE;
source.Reply(_("\002%s\002 allows you to have a bot on your own channel.\n"
"It has been created for users that can't host or\n"
"configure a bot, or for use on networks that don't\n"
@@ -182,6 +182,7 @@ class BotServCore : public Module
"\002%s%s %s \037command\037\002.\n "),
Config->BotServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->BotServ.c_str(),
Config->UseStrictPrivMsgString.c_str(), Config->BotServ.c_str(), source.command.c_str());
return EVENT_CONTINUE;
}
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params)
+3 -2
View File
@@ -108,10 +108,10 @@ class ChanServCore : public Module
}
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->ChanServ)
return;
return EVENT_CONTINUE;
source.Reply(_("\002%s\002 allows you to register and control various\n"
"aspects of channels. %s can often prevent\n"
"malicious users from \"taking over\" channels by limiting\n"
@@ -120,6 +120,7 @@ class ChanServCore : public Module
"\002%s%s \037command\037\002. For more information on a\n"
"specific command, type \002%s%s HELP \037command\037\002.\n "),
Config->ChanServ.c_str(), Config->ChanServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->ChanServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->ChanServ.c_str(), Config->ChanServ.c_str(), source.command.c_str());
return EVENT_CONTINUE;
}
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params)
+3 -2
View File
@@ -79,11 +79,12 @@ class GlobalCore : public Module
notice_server(Config->Global, s, "%s", Config->GlobalOnCycleUP.c_str());
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->Global)
return;
return EVENT_CONTINUE;
source.Reply(_("%s commands:\n"), Config->Global.c_str());
return EVENT_CONTINUE;
}
};
+3 -2
View File
@@ -73,11 +73,12 @@ class HostServCore : public Module
this->OnNickIdentify(u);
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->HostServ)
return;
return EVENT_CONTINUE;
source.Reply(_("%s commands:\n"), Config->HostServ.c_str());
return EVENT_CONTINUE;
}
};
+3 -2
View File
@@ -201,16 +201,17 @@ class MemoServCore : public Module
this->mymemoserv.Check(u);
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->MemoServ)
return;
return EVENT_CONTINUE;
source.Reply(_("\002%s\002 is a utility allowing IRC users to send short\n"
"messages to other IRC users, whether they are online at\n"
"the time or not, or to channels(*). Both the sender's\n"
"nickname and the target nickname or channel must be\n"
"registered in order to send a memo.\n"
"%s's commands include:"), Config->MemoServ.c_str(), Config->MemoServ.c_str());
return EVENT_CONTINUE;
}
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params)
+3 -2
View File
@@ -267,16 +267,17 @@ class NickServCore : public Module
u->RemoveMode(NickServ, Name);
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->NickServ)
return;
return EVENT_CONTINUE;
source.Reply(_("\002%s\002 allows you to \"register\" a nickname and\n"
"prevent others from using it. The following\n"
"commands allow for registration and maintenance of\n"
"nicknames; to use them, type \002%s%s \037command\037\002.\n"
"For more information on a specific command, type\n"
"\002%s%s %s \037command\037\002.\n "), Config->NickServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), source.command.c_str());
return EVENT_CONTINUE;
}
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params)
+3 -2
View File
@@ -327,11 +327,12 @@ class OperServCore : public Module
return EVENT_CONTINUE;
}
void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!params.empty() || source.owner->nick != Config->OperServ)
return;
return EVENT_CONTINUE;
source.Reply(_("%s commands:"), Config->OperServ.c_str());
return EVENT_CONTINUE;
}
};