mirror of
https://github.com/anope/anope.git
synced 2026-06-30 10:36:38 +02:00
Add ability for fantasy to be disabled for some commands and strip the channel name from them
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2341 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -11,8 +11,8 @@ Legend:
|
||||
[ ] burn do_sjoin with fire
|
||||
[x] Seamless fantasy support for all ChanServ commands, instead of requiring bs_fantasy_*
|
||||
Remaining issues:
|
||||
[?] Allow fantasy to be disabled from some commands (e.g. FORBID?) seems unnecessary, really.
|
||||
[ ] (think on this carefully): some commands (e.g. !help) need to strip the pre-provided channelname from them.
|
||||
[x] Allow fantasy to be disabled from some commands (e.g. FORBID?) seems unnecessary, really.
|
||||
[x] (think on this carefully): some commands (e.g. !help) need to strip the pre-provided channelname from them.
|
||||
[ ] (will require wider re-work): allow replies/notifications to fantasy commands to go to the channel via notice
|
||||
[x] HelpServ must die
|
||||
[+] Command parser cleanup: mod_current_buffer needs to go away and be replaced by a proper parser. Commands should then indicate how they want the buffer split.
|
||||
|
||||
+3
-1
@@ -220,7 +220,9 @@ enum CommandFlags
|
||||
CFLAG_ALLOW_UNREGISTERED = 1,
|
||||
CFLAG_ALLOW_FORBIDDEN = 2,
|
||||
CFLAG_ALLOW_SUSPENDED = 4,
|
||||
CFLAG_ALLOW_UNREGISTEREDCHANNEL = 8
|
||||
CFLAG_ALLOW_UNREGISTEREDCHANNEL = 8,
|
||||
CFLAG_STRIP_CHANNEL = 16,
|
||||
CFLAG_DISABLE_FANTASY = 32
|
||||
};
|
||||
|
||||
/** Every services command is a class, inheriting from Command.
|
||||
|
||||
+28
-5
@@ -136,6 +136,8 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
|
||||
char *cmd;
|
||||
UserData *ud;
|
||||
bool was_action = false;
|
||||
Command *command;
|
||||
std::string bbuf;
|
||||
|
||||
if (!u || !buf || !ci) {
|
||||
return;
|
||||
@@ -426,13 +428,34 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
|
||||
|
||||
if (check_access(u, ci, CA_FANTASIA))
|
||||
{
|
||||
std::string bbuf = std::string(cmd) + " " + ci->name;
|
||||
if (params)
|
||||
if ((command = findCommand(CHANSERV, cmd)))
|
||||
{
|
||||
bbuf += " ";
|
||||
bbuf += params;
|
||||
/* Command exists but can not be called by fantasy */
|
||||
if (command->HasFlag(CFLAG_DISABLE_FANTASY))
|
||||
notice_lang(s_ChanServ, u, UNKNOWN_COMMAND_HELP, cmd, s_ChanServ);
|
||||
else
|
||||
{
|
||||
bbuf = std::string(cmd);
|
||||
|
||||
/* Some commands don't need the channel name added.. eg !help */
|
||||
if (!command->HasFlag(CFLAG_STRIP_CHANNEL))
|
||||
{
|
||||
bbuf += " ";
|
||||
bbuf += ci->name;
|
||||
}
|
||||
|
||||
if (params)
|
||||
{
|
||||
bbuf += " ";
|
||||
bbuf += params;
|
||||
}
|
||||
|
||||
chanserv(u, const_cast<char *>(bbuf.c_str())); // XXX Unsafe cast, this needs reviewing -- CyberBotX
|
||||
}
|
||||
}
|
||||
chanserv(u, const_cast<char *>(bbuf.c_str())); // XXX Unsafe cast, this needs reviewing -- CyberBotX
|
||||
else
|
||||
notice_lang(s_ChanServ, u, UNKNOWN_COMMAND_HELP, cmd, s_ChanServ);
|
||||
|
||||
FOREACH_MOD(I_OnBotFantasy, OnBotFantasy(cmd, u, ci, params));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,6 +21,7 @@ class CommandCSHelp : public Command
|
||||
CommandCSHelp() : Command("HELP", 1, 1)
|
||||
{
|
||||
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
|
||||
this->SetFlag(CFLAG_STRIP_CHANNEL);
|
||||
}
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
|
||||
@@ -21,6 +21,7 @@ class CommandCSList : public Command
|
||||
public:
|
||||
CommandCSList() : Command("LIST",1,2)
|
||||
{
|
||||
this->SetFlag(CFLAG_STRIP_CHANNEL);
|
||||
}
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
|
||||
Reference in New Issue
Block a user