mirror of
https://github.com/anope/anope.git
synced 2026-07-06 18:23:12 +02:00
Fix fantasy !help & give it its own help header, not ChanServ's
This commit is contained in:
@@ -333,7 +333,7 @@ fantasy { name = "ENFORCE"; command = "chanserv/enforce"; }
|
||||
fantasy { name = "ENTRYMSG"; command = "chanserv/entrymsg"; }
|
||||
fantasy { name = "FLAGS"; command = "chanserv/flags"; }
|
||||
fantasy { name = "HALFOP"; command = "chanserv/halfop"; }
|
||||
fantasy { name = "HELP"; command = "chanserv/help"; }
|
||||
fantasy { name = "HELP"; command = "generic/help"; }
|
||||
fantasy { name = "HOP"; command = "chanserv/hop"; }
|
||||
fantasy { name = "INFO"; command = "chanserv/info"; }
|
||||
fantasy { name = "INVITE"; command = "chanserv/invite"; }
|
||||
|
||||
+1
-2
@@ -43,8 +43,7 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Se
|
||||
public:
|
||||
time_t created; /* Birth date ;) */
|
||||
time_t lastmsg; /* Last time we said something */
|
||||
typedef Anope::insensitive_map<CommandInfo> command_map;
|
||||
command_map commands; /* Commands, actual name to service name */
|
||||
CommandInfo::map commands; /* Commands, actual name to service name */
|
||||
Anope::string botmodes; /* Modes the bot should have as configured in service:modes */
|
||||
std::vector<Anope::string> botchannels; /* Channels the bot should be in as configured in service:channels */
|
||||
bool introduced; /* Whether or not this bot is introduced */
|
||||
|
||||
+3
-3
@@ -29,6 +29,8 @@ const Anope::string CommandFlagStrings[] = {
|
||||
|
||||
struct CommandInfo
|
||||
{
|
||||
typedef Anope::insensitive_map<CommandInfo> map;
|
||||
|
||||
Anope::string name;
|
||||
Anope::string permission;
|
||||
};
|
||||
@@ -53,15 +55,13 @@ class CoreExport CommandSource
|
||||
/* Channel the command was executed on (fantasy) */
|
||||
dynamic_reference<Channel> c;
|
||||
/* The service this command is on */
|
||||
dynamic_reference<BotInfo> owner;
|
||||
/* The service the reply should come from, *not* necessarily the service the command is on */
|
||||
dynamic_reference<BotInfo> service;
|
||||
/* The actual name of the command being executed */
|
||||
Anope::string command;
|
||||
/* The permission of the command being executed */
|
||||
Anope::string permission;
|
||||
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply);
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
|
||||
|
||||
const Anope::string &GetNick() const;
|
||||
User *GetUser();
|
||||
|
||||
+1
-2
@@ -690,8 +690,7 @@ class CoreExport ServerConfig
|
||||
std::vector<Oper *> Opers;
|
||||
|
||||
/* Map of fantasy commands */
|
||||
typedef Anope::insensitive_map<CommandInfo> fantasy_map;
|
||||
fantasy_map Fantasy;
|
||||
CommandInfo::map Fantasy;
|
||||
};
|
||||
|
||||
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
|
||||
|
||||
@@ -289,7 +289,7 @@ class CommandBSBadwords : public Command
|
||||
"will be done if a user says a word that ends with\n"
|
||||
"\037word\037. If you don't specify anything, a kick will\n"
|
||||
"be issued every time \037word\037 is said by a user.\n"
|
||||
" \n"), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
" \n"), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
|
||||
source.Reply(_("The \002DEL\002 command removes the given word from the\n"
|
||||
"bad words list. If a list of entry numbers is given, those\n"
|
||||
"entries are deleted. (See the example for LIST below.)\n"
|
||||
|
||||
@@ -228,7 +228,7 @@ class CommandBSInfo : public Command
|
||||
"If the parameter is a channel, then you'll get information\n"
|
||||
"such as enabled kickers. If the parameter is a nick,\n"
|
||||
"you'll get information about a bot, such as creation\n"
|
||||
"time or number of channels it is on."), source.owner->nick.c_str());
|
||||
"time or number of channels it is on."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -482,7 +482,7 @@ class CommandBSKick : public Command
|
||||
"on a specific option.\n"
|
||||
" \n"
|
||||
"Note: access to this command is controlled by the\n"
|
||||
"level SET."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"level SET."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
}
|
||||
else if (subcommand.equals_ci("BADWORDS"))
|
||||
source.Reply(_("Syntax: \002\037#channel\037 BADWORDS {\037ON|OFF\037} [\037ttb\037]\002\n"
|
||||
@@ -494,7 +494,7 @@ class CommandBSKick : public Command
|
||||
"more information.\n"
|
||||
"ttb is the number of times a user can be kicked\n"
|
||||
"before it get banned. Don't give ttb to disable\n"
|
||||
"the ban system once activated."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"the ban system once activated."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
else if (subcommand.equals_ci("BOLDS"))
|
||||
source.Reply(_("Syntax: \002\037channel\037 BOLDS {\037ON|OFF\037} [\037ttb\037]\002\n"
|
||||
"Sets the bolds kicker on or off. When enabled, this\n"
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommandBSSet : public Command
|
||||
" \n"
|
||||
"Available options:"));
|
||||
Anope::string this_name = source.command;
|
||||
for (BotInfo::command_map::const_iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
@@ -50,7 +50,7 @@ class CommandBSSet : public Command
|
||||
}
|
||||
}
|
||||
source.Reply(_("Type \002%s%s HELP SET \037option\037\002 for more information on a\n"
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ class CommandCSAccess : public Command
|
||||
"user levels allow for access to different subsets of\n"
|
||||
"privileges. Any registered user not on the access list has\n"
|
||||
"a user level of 0, and any unregistered user has a user level\n"
|
||||
"of -1."), source.owner->nick.c_str());
|
||||
"of -1."), source.service->nick.c_str());
|
||||
source.Reply(" ");
|
||||
source.Reply(_("The \002ACCESS ADD\002 command adds the given mask to the\n"
|
||||
"access list with the given user level; if the mask is\n"
|
||||
@@ -557,7 +557,7 @@ class CommandCSAccess : public Command
|
||||
" \n"
|
||||
"These levels may be changed, or new ones added, using the\n"
|
||||
"\002LEVELS\002 command; type \002%s%s HELP LEVELS\002 for\n"
|
||||
"information."), source.owner->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"information."), source.service->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -592,7 +592,7 @@ class CommandCSLevels : public Command
|
||||
{
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(what);
|
||||
if (p == NULL)
|
||||
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
else
|
||||
{
|
||||
ci->SetLevel(p->name, level);
|
||||
@@ -630,7 +630,7 @@ class CommandCSLevels : public Command
|
||||
}
|
||||
}
|
||||
|
||||
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -772,7 +772,7 @@ class CommandCSLevels : public Command
|
||||
"\002HELP ACCESS LEVELS\002).\n"
|
||||
" \n"
|
||||
"For a list of the features and functions whose levels can be\n"
|
||||
"set, see \002HELP LEVELS DESC\002."), source.owner->nick.c_str());
|
||||
"set, see \002HELP LEVELS DESC\002."), source.service->nick.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ class CommandCSAKick : public Command
|
||||
"When akicking a \037registered nick\037 the nickserv account\n"
|
||||
"will be added to the akick list instead of the mask.\n"
|
||||
"All users within that nickgroup will then be akicked.\n"),
|
||||
source.owner->nick.c_str());
|
||||
source.service->nick.c_str());
|
||||
source.Reply(_(
|
||||
" \n"
|
||||
"The \002AKICK DEL\002 command removes the given nick or mask\n"
|
||||
@@ -484,7 +484,7 @@ class CommandCSAKick : public Command
|
||||
"AKICK mask.\n"
|
||||
" \n"
|
||||
"The \002AKICK CLEAR\002 command clears all entries of the\n"
|
||||
"akick list."), source.owner->nick.c_str());
|
||||
"akick list."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ class CommandCSClearUsers : public Command
|
||||
source.Reply(_("Tells %s to clear (kick) all users on a channel."
|
||||
" \n"
|
||||
"By default, limited to those with founder access on the\n"
|
||||
"channel."), source.owner->nick.c_str());
|
||||
"channel."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
target_ci->last_topic_time = target_ci->c->topic_time;
|
||||
}
|
||||
else
|
||||
target_ci->last_topic_setter = source.owner->nick;
|
||||
target_ci->last_topic_setter = source.service->nick;
|
||||
|
||||
FOREACH_MOD(I_OnChanRegistered, OnChanRegistered(target_ci));
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class CommandCSInvite : public Command
|
||||
"nick into the given channel.\n"
|
||||
" \n"
|
||||
"By default, limited to AOPs or those with level 5 and above\n"
|
||||
"on the channel."), source.owner->nick.c_str());
|
||||
"on the channel."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ class CommandCSRegister : public Command
|
||||
ci->last_topic_time = c->topic_time;
|
||||
}
|
||||
else
|
||||
ci->last_topic_setter = source.owner->nick;
|
||||
ci->last_topic_setter = source.service->nick;
|
||||
|
||||
Log(LOG_COMMAND, source, this, ci);
|
||||
source.Reply(_("Channel \002%s\002 registered under your account: %s"), chan.c_str(), nc->display.c_str());
|
||||
@@ -125,7 +125,7 @@ class CommandCSRegister : public Command
|
||||
"NOTICE: In order to register a channel, you must have\n"
|
||||
"first registered your nickname. If you haven't,\n"
|
||||
"\002%s%s HELP\002 for information on how to do so."),
|
||||
source.owner->nick.c_str(), source.owner->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
|
||||
source.service->nick.c_str(), source.service->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ class CommandCSSASet : public Command
|
||||
" \n"
|
||||
"Available options:"));
|
||||
Anope::string this_name = source.command;
|
||||
for (BotInfo::command_map::const_iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
@@ -52,7 +52,7 @@ class CommandCSSASet : public Command
|
||||
}
|
||||
}
|
||||
source.Reply(_("Type \002%s%s HELP SASET \037option\037\002 for more information on a\n"
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ class CommandCSSet : public Command
|
||||
" \n"
|
||||
"Available options:"));
|
||||
Anope::string this_name = source.command;
|
||||
for (BotInfo::command_map::const_iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
@@ -52,7 +52,7 @@ class CommandCSSet : public Command
|
||||
}
|
||||
}
|
||||
source.Reply(_("Type \002%s%s HELP SET \037option\037\002 for more information on a\n"
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ class CommandCSSetKeepTopic : public Command
|
||||
"channel. When \002%s\002 is set, the topic for the\n"
|
||||
"channel will be remembered by %s even after the\n"
|
||||
"last user leaves the channel, and will be restored the\n"
|
||||
"next time the channel is created."), this->name.c_str(), source.owner->nick.c_str());
|
||||
"next time the channel is created."), this->name.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ class CommandCSSetPeace : public Command
|
||||
source.Reply(_("Enables or disables the \002peace\002 option for a channel.\n"
|
||||
"When \002peace\002 is set, a user won't be able to kick,\n"
|
||||
"ban or remove a channel status of a user that has\n"
|
||||
"a level superior or equal to his via %s commands."), source.owner->nick.c_str());
|
||||
"a level superior or equal to his via %s commands."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ class CommandCSSetPrivate : public Command
|
||||
source.Reply(_("Enables or disables the \002private\002 option for a channel.\n"
|
||||
"When \002private\002 is set, a \002%s%s LIST\002 will not\n"
|
||||
"include the channel in any lists."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ class CommandCSTopic : public Command
|
||||
"is set. This command is most useful in conjunction\n"
|
||||
"with topic lock.\n"
|
||||
"By default, limited to those with founder access on the\n"
|
||||
"channel."), source.owner->nick.c_str());
|
||||
"channel."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ class CommandCSUnban : public Command
|
||||
"user from entering the given channel.\n"
|
||||
" \n"
|
||||
"By default, limited to AOPs or those with level 5 and above\n"
|
||||
"on the channel."), source.owner->nick.c_str());
|
||||
"on the channel."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
+10
-10
@@ -620,8 +620,8 @@ class CommandCSQOP : public XOPBase
|
||||
"available. See \002%s%s HELP ACCESS\002 for information\n"
|
||||
"about the access list, and \002%s%s HELP FLAGS\002 for\n"
|
||||
"information about the flags based system."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -675,8 +675,8 @@ class CommandCSAOP : public XOPBase
|
||||
"available. See \002%s%s HELP ACCESS\002 for information\n"
|
||||
"about the access list, and \002%s%s HELP FLAGS\002 for\n"
|
||||
"information about the flags based system."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -729,8 +729,8 @@ class CommandCSHOP : public XOPBase
|
||||
"available. See \002%s%s HELP ACCESS\002 for information\n"
|
||||
"about the access list, and \002%s%s HELP FLAGS\002 for\n"
|
||||
"information about the flags based system."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -783,8 +783,8 @@ class CommandCSSOP : public XOPBase
|
||||
"available. See \002%s%s HELP ACCESS\002 for information\n"
|
||||
"about the access list, and \002%s%s HELP FLAGS\002 for\n"
|
||||
"information about the flags based system."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -837,8 +837,8 @@ class CommandCSVOP : public XOPBase
|
||||
"available. See \002%s%s HELP ACCESS\002 for information\n"
|
||||
"about the access list, and \002%s%s HELP FLAGS\002 for\n"
|
||||
"information about the flags based system."),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(),
|
||||
Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ class CommandGLGlobal : public Command
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Allows Administrators to send messages to all users on the \n"
|
||||
"network. The message will be sent from the nick \002%s\002."), source.owner->nick.c_str());
|
||||
"network. The message will be sent from the nick \002%s\002."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,18 +30,19 @@ class CommandHelp : public Command
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
const BotInfo *bi = source.owner;
|
||||
const BotInfo *bi = source.service;
|
||||
const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands;
|
||||
|
||||
if (params.empty())
|
||||
{
|
||||
for (BotInfo::command_map::const_iterator it = bi->commands.begin(), it_end = bi->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = map.begin(), it_end = map.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
|
||||
// Smaller command exists
|
||||
Anope::string cmd = myStrGetToken(c_name, ' ', 0);
|
||||
if (cmd != it->first && bi->commands.count(cmd))
|
||||
if (cmd != it->first && map.count(cmd))
|
||||
continue;
|
||||
|
||||
service_reference<Command> c("Command", info.name);
|
||||
@@ -64,8 +65,8 @@ class CommandHelp : public Command
|
||||
full_command += " " + params[i];
|
||||
full_command.erase(full_command.begin());
|
||||
|
||||
BotInfo::command_map::const_iterator it = bi->commands.find(full_command);
|
||||
if (it == bi->commands.end())
|
||||
CommandInfo::map::const_iterator it = map.find(full_command);
|
||||
if (it == map.end())
|
||||
continue;
|
||||
|
||||
const CommandInfo &info = it->second;
|
||||
|
||||
@@ -239,7 +239,7 @@ class CommandMSSet : public Command
|
||||
" receive\n"
|
||||
" \n"
|
||||
"Type \002%s%s HELP %s \037option\037\002 for more information\n"
|
||||
"on a specific option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
"on a specific option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
|
||||
}
|
||||
else if (subcommand.equals_ci("NOTIFY"))
|
||||
source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n"
|
||||
|
||||
@@ -96,7 +96,7 @@ class CommandNSIdentify : public Command
|
||||
"nick. Many commands require you to authenticate yourself\n"
|
||||
"with this command before you use them. The password\n"
|
||||
"should be the same one you sent with the \002REGISTER\002\n"
|
||||
"command."), source.owner->nick.c_str());
|
||||
"command."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ class NSRecoverRequest : public IdentifyRequest
|
||||
|
||||
User *u = source.GetUser();
|
||||
|
||||
u->SendMessage(source.owner, FORCENICKCHANGE_NOW);
|
||||
u->SendMessage(source.service, FORCENICKCHANGE_NOW);
|
||||
|
||||
if (u->Account() == na->nc)
|
||||
{
|
||||
|
||||
@@ -217,7 +217,7 @@ class CommandNSRegister : public Command
|
||||
else if (Config->NSRegistration.equals_ci("mail"))
|
||||
{
|
||||
nc->SetFlag(NI_UNCONFIRMED);
|
||||
if (SendRegmail(u, na, source.owner))
|
||||
if (SendRegmail(u, na, source.service))
|
||||
{
|
||||
source.Reply(_("A passcode has been sent to %s, please type %s%s confirm <passcode> to confirm your email address."), email.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
|
||||
source.Reply(_("If you do not confirm your email address within %s your account will expire."), duration(Config->NSUnconfirmedExpire).c_str());
|
||||
@@ -300,7 +300,7 @@ class CommandNSResend : public Command
|
||||
{
|
||||
if (Anope::CurTime < source.nc->lastmail + Config->NSResendDelay)
|
||||
source.Reply(_("Cannot send mail now; please retry a little later."));
|
||||
else if (SendRegmail(source.GetUser(), na, source.owner))
|
||||
else if (SendRegmail(source.GetUser(), na, source.service))
|
||||
{
|
||||
na->nc->lastmail = Anope::CurTime;
|
||||
source.Reply(_("Your passcode has been re-sent to %s."), na->nc->email.c_str());
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommandNSResetPass : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
|
||||
else
|
||||
{
|
||||
if (SendResetEmail(source.GetUser(), na, source.owner))
|
||||
if (SendResetEmail(source.GetUser(), na, source.service))
|
||||
{
|
||||
Log(LOG_COMMAND, source, this) << "for " << na->nick << " (group: " << na->nc->display << ")";
|
||||
source.Reply(_("Password reset email for \002%s\002 has been sent."), na->nick.c_str());
|
||||
|
||||
@@ -33,7 +33,7 @@ class CommandNSSASet : public Command
|
||||
this->SendSyntax(source);
|
||||
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
|
||||
Anope::string this_name = source.command;
|
||||
for (BotInfo::command_map::const_iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
|
||||
@@ -39,7 +39,7 @@ class CommandNSSendPass : public Command
|
||||
Anope::string tmp_pass;
|
||||
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
|
||||
{
|
||||
if (SendPassMail(source.GetUser(), na, source.owner, tmp_pass))
|
||||
if (SendPassMail(source.GetUser(), na, source.service, tmp_pass))
|
||||
{
|
||||
Log(Config->RestrictMail ? LOG_ADMIN : LOG_COMMAND, source, this) << "for " << na->nick;
|
||||
source.Reply(_("Password of \002%s\002 has been sent."), nick.c_str());
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommandNSSet : public Command
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
|
||||
Anope::string this_name = source.command;
|
||||
for (BotInfo::command_map::const_iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
|
||||
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
|
||||
{
|
||||
const Anope::string &c_name = it->first;
|
||||
const CommandInfo &info = it->second;
|
||||
@@ -50,7 +50,7 @@ class CommandNSSet : public Command
|
||||
}
|
||||
}
|
||||
source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n"
|
||||
"on a specific option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
"on a specific option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ class CommandNSSetEmail : public Command
|
||||
source.nc->Extend("ns_set_email", new ExtensibleItemClass<Anope::string>(param));
|
||||
Anope::string old = source.nc->email;
|
||||
source.nc->email = param;
|
||||
if (SendConfirmMail(source.GetUser(), source.owner))
|
||||
if (SendConfirmMail(source.GetUser(), source.service))
|
||||
source.Reply(_("A confirmation email has been sent to \002%s\002. Follow the instructions in it to change your email address."), param.c_str());
|
||||
source.nc->email = old;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class CommandOSKick : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
c->Kick(source.owner, u2, "%s (%s)", source.GetNick().c_str(), s.c_str());
|
||||
c->Kick(source.service, u2, "%s (%s)", source.GetNick().c_str(), s.c_str());
|
||||
Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")";
|
||||
return;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class CommandOSKick : public Command
|
||||
"command. The kick message will have the nickname of the\n"
|
||||
"IRCop sending the KICK command prepended; for example:\n"
|
||||
" \n"
|
||||
"*** SpamMan has been kicked off channel #my_channel by %s (Alcan (Flood))"), source.owner->nick.c_str());
|
||||
"*** SpamMan has been kicked off channel #my_channel by %s (Alcan (Flood))"), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ class CommandOSLogin : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.owner->nick;
|
||||
Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.service->nick;
|
||||
u->Extend("os_login_password_correct", NULL);
|
||||
source.Reply(_("Password accepted."));
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class CommandOSLogin : public Command
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Logs you in to %s so you gain Services Operator privileges.\n"
|
||||
"This command may be unnecessary if your oper block is\n"
|
||||
"configured without a password."), source.owner->nick.c_str());
|
||||
"configured without a password."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -100,7 +100,7 @@ class CommandOSLogout : public Command
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Logs you out from %s so you lose Services Operator privileges.\n"
|
||||
"This command is only useful if your oper block is configured\n"
|
||||
"with a password."), source.owner->nick.c_str());
|
||||
"with a password."), source.service->nick.c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommandOSMode : public Command
|
||||
source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?"));
|
||||
else
|
||||
{
|
||||
c->SetModes(source.owner, false, modes.c_str());
|
||||
c->SetModes(source.service, false, modes.c_str());
|
||||
|
||||
Log(LOG_ADMIN, source, this) << modes << " on " << target;
|
||||
}
|
||||
@@ -69,10 +69,10 @@ class CommandOSUMode : public Command
|
||||
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
|
||||
else
|
||||
{
|
||||
u2->SetModes(source.owner, "%s", modes.c_str());
|
||||
u2->SetModes(source.service, "%s", modes.c_str());
|
||||
source.Reply(_("Changed usermodes of \002%s\002 to %s."), u2->nick.c_str(), modes.c_str());
|
||||
|
||||
u2->SendMessage(source.owner, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str());
|
||||
u2->SendMessage(source.service, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str());
|
||||
|
||||
Log(LOG_ADMIN, source, this) << modes << " on " << target;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class CommandOSModInfo : public Command
|
||||
{
|
||||
const BotInfo *bi = it->second;
|
||||
|
||||
for (BotInfo::command_map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
|
||||
for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
|
||||
{
|
||||
const Anope::string &c_name = cit->first;
|
||||
const CommandInfo &info = cit->second;
|
||||
|
||||
@@ -33,15 +33,15 @@ class CommandOSOLine : public Command
|
||||
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
|
||||
else if (u2 && flag[0] == '+')
|
||||
{
|
||||
ircdproto->SendSVSO(source.owner, nick, flag);
|
||||
u2->SetMode(source.owner, UMODE_OPER);
|
||||
u2->SendMessage(source.owner, _("You are now an IRC Operator."));
|
||||
ircdproto->SendSVSO(source.service, nick, flag);
|
||||
u2->SetMode(source.service, UMODE_OPER);
|
||||
u2->SendMessage(source.service, _("You are now an IRC Operator."));
|
||||
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
|
||||
Log(LOG_ADMIN, source, this) << "for " << nick;
|
||||
}
|
||||
else if (u2 && flag[0] == '-')
|
||||
{
|
||||
ircdproto->SendSVSO(source.owner, nick, flag);
|
||||
ircdproto->SendSVSO(source.service, nick, flag);
|
||||
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
|
||||
Log(LOG_ADMIN, source, this) << "for " << nick;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,7 @@ class MyXMLRPCEvent : public XMLRPCEvent
|
||||
}
|
||||
reply(out);
|
||||
|
||||
CommandSource source(user, NULL, na ? *na->nc : NULL, &reply);
|
||||
source.c = NULL;
|
||||
source.owner = bi;
|
||||
source.service = bi;
|
||||
|
||||
CommandSource source(user, NULL, na ? *na->nc : NULL, &reply, bi);
|
||||
RunCommand(source, command);
|
||||
|
||||
if (!out.empty())
|
||||
|
||||
@@ -214,10 +214,7 @@ namespace WebPanel
|
||||
}
|
||||
my_reply(r);
|
||||
|
||||
CommandSource source(user, NULL, nc, &my_reply);
|
||||
source.owner = bi;
|
||||
source.service = bi;
|
||||
|
||||
CommandSource source(user, NULL, nc, &my_reply, bi);
|
||||
cmd->Execute(source, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,105 +46,106 @@ class BotServCore : public Module
|
||||
|
||||
Anope::string realbuf = msg;
|
||||
|
||||
bool was_action = false;
|
||||
if (realbuf.substr(0, 8).equals_ci("\1ACTION ") && realbuf[realbuf.length() - 1] == '\1')
|
||||
{
|
||||
realbuf.erase(0, 8);
|
||||
realbuf.erase(realbuf.length() - 1);
|
||||
was_action = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (realbuf.empty())
|
||||
if (realbuf.empty() || !c->ci->botflags.HasFlag(BS_FANTASY))
|
||||
return;
|
||||
|
||||
/* Fantaisist commands */
|
||||
if (c->ci->botflags.HasFlag(BS_FANTASY) && (Config->BSFantasyCharacter.empty() || realbuf.find_first_of(Config->BSFantasyCharacter) == 0) && !was_action)
|
||||
std::vector<Anope::string> params = BuildStringVector(realbuf);
|
||||
|
||||
if (!realbuf.find_first_of(c->ci->bi->nick))
|
||||
params.erase(params.begin());
|
||||
else if (Config->BSFantasyCharacter.empty())
|
||||
;
|
||||
else if (!realbuf.find_first_of(Config->BSFantasyCharacter))
|
||||
params[0].erase(params[0].begin());
|
||||
else
|
||||
return;
|
||||
|
||||
if (params.empty())
|
||||
return;
|
||||
|
||||
CommandInfo::map::const_iterator it = Config->Fantasy.end();
|
||||
unsigned count = 0;
|
||||
for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max)
|
||||
{
|
||||
/* Strip off the fantasy character */
|
||||
if (!Config->BSFantasyCharacter.empty())
|
||||
realbuf.erase(realbuf.begin());
|
||||
Anope::string full_command;
|
||||
for (unsigned i = 0; i < max; ++i)
|
||||
full_command += " " + params[i];
|
||||
full_command.erase(full_command.begin());
|
||||
|
||||
std::vector<Anope::string> params = BuildStringVector(realbuf);
|
||||
++count;
|
||||
it = Config->Fantasy.find(full_command);
|
||||
}
|
||||
|
||||
ServerConfig::fantasy_map::const_iterator it = Config->Fantasy.end();
|
||||
unsigned count = 0;
|
||||
for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max)
|
||||
{
|
||||
Anope::string full_command;
|
||||
for (unsigned i = 0; i < max; ++i)
|
||||
full_command += " " + params[i];
|
||||
full_command.erase(full_command.begin());
|
||||
if (it == Config->Fantasy.end())
|
||||
return;
|
||||
|
||||
++count;
|
||||
it = Config->Fantasy.find(full_command);
|
||||
}
|
||||
const CommandInfo &info = it->second;
|
||||
service_reference<Command> cmd("Command", info.name);
|
||||
if (!cmd)
|
||||
{
|
||||
Log(LOG_DEBUG) << "Fantasy command " << it->first << " exists for nonexistant service " << info.name << "!";
|
||||
return;
|
||||
}
|
||||
|
||||
if (it == Config->Fantasy.end())
|
||||
return;
|
||||
for (unsigned i = 0, j = params.size() - (count - 1); i < j; ++i)
|
||||
params.erase(params.begin());
|
||||
|
||||
const CommandInfo &info = it->second;
|
||||
service_reference<Command> cmd("Command", info.name);
|
||||
if (!cmd)
|
||||
{
|
||||
Log(LOG_DEBUG) << "Fantasy command " << it->first << " exists for nonexistant service " << info.name << "!";
|
||||
return;
|
||||
}
|
||||
while (cmd->MaxParams > 0 && params.size() > cmd->MaxParams)
|
||||
{
|
||||
params[cmd->MaxParams - 1] += " " + params[cmd->MaxParams];
|
||||
params.erase(params.begin() + cmd->MaxParams);
|
||||
}
|
||||
|
||||
for (unsigned i = 0, j = params.size() - (count - 1); i < j; ++i)
|
||||
params.erase(params.begin());
|
||||
/* All ChanServ commands take the channel as a first parameter */
|
||||
if (cmd->name.find("chanserv/") == 0 && !cmd->HasFlag(CFLAG_STRIP_CHANNEL))
|
||||
params.insert(params.begin(), c->ci->name);
|
||||
|
||||
while (cmd->MaxParams > 0 && params.size() > cmd->MaxParams)
|
||||
{
|
||||
params[cmd->MaxParams - 1] += " " + params[cmd->MaxParams];
|
||||
params.erase(params.begin() + cmd->MaxParams);
|
||||
}
|
||||
// Command requires registered users only
|
||||
if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account())
|
||||
return;
|
||||
|
||||
/* All ChanServ commands take the channel as a first parameter */
|
||||
if (cmd->name.find("chanserv/") == 0)
|
||||
params.insert(params.begin(), c->ci->name);
|
||||
if (params.size() < cmd->MinParams)
|
||||
return;
|
||||
|
||||
// Command requires registered users only
|
||||
if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account())
|
||||
return;
|
||||
CommandSource source(u->nick, u, u->Account(), u, c->ci->bi);
|
||||
source.c = c;
|
||||
source.command = it->first;
|
||||
source.permission = info.permission;
|
||||
|
||||
if (params.size() < cmd->MinParams)
|
||||
return;
|
||||
EventReturn MOD_RESULT;
|
||||
if (c->ci->AccessFor(u).HasPriv("FANTASIA"))
|
||||
{
|
||||
FOREACH_RESULT(I_OnBotFantasy, OnBotFantasy(source, cmd, c->ci, params));
|
||||
}
|
||||
else
|
||||
{
|
||||
FOREACH_RESULT(I_OnBotNoFantasyAccess, OnBotNoFantasyAccess(source, cmd, c->ci, params));
|
||||
}
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u);
|
||||
source.c = c;
|
||||
source.owner = c->ci->bi;
|
||||
source.service = c->ci->bi;
|
||||
source.command = it->first;
|
||||
source.permission = info.permission;
|
||||
if (MOD_RESULT == EVENT_STOP || !c->ci->AccessFor(u).HasPriv("FANTASIA"))
|
||||
return;
|
||||
|
||||
EventReturn MOD_RESULT;
|
||||
if (c->ci->AccessFor(u).HasPriv("FANTASIA"))
|
||||
{
|
||||
FOREACH_RESULT(I_OnBotFantasy, OnBotFantasy(source, cmd, c->ci, params));
|
||||
}
|
||||
else
|
||||
{
|
||||
FOREACH_RESULT(I_OnBotNoFantasyAccess, OnBotNoFantasyAccess(source, cmd, c->ci, params));
|
||||
}
|
||||
if (MOD_RESULT != EVENT_ALLOW && !info.permission.empty() && !source.HasCommand(info.permission))
|
||||
return;
|
||||
|
||||
if (MOD_RESULT == EVENT_STOP || !c->ci->AccessFor(u).HasPriv("FANTASIA"))
|
||||
return;
|
||||
FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, cmd, params));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (MOD_RESULT != EVENT_ALLOW && !info.permission.empty() && !source.HasCommand(info.permission))
|
||||
return;
|
||||
dynamic_reference<User> user_reference(u);
|
||||
dynamic_reference<NickCore> nc_reference(u->Account());
|
||||
cmd->Execute(source, params);
|
||||
|
||||
FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, cmd, params));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
dynamic_reference<User> user_reference(u);
|
||||
dynamic_reference<NickCore> nc_reference(u->Account());
|
||||
cmd->Execute(source, params);
|
||||
|
||||
if (user_reference && nc_reference)
|
||||
{
|
||||
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, cmd, params));
|
||||
}
|
||||
if (user_reference && nc_reference)
|
||||
{
|
||||
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, cmd, params));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,24 +201,43 @@ class BotServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->BotServ)
|
||||
if (!params.empty())
|
||||
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"
|
||||
"allow user bots. Available commands are listed \n"
|
||||
"below; to use them, type \002%s%s \037command\037\002. For\n"
|
||||
"more information on a specific command, type\n"
|
||||
"\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());
|
||||
|
||||
if (source.c)
|
||||
{
|
||||
source.Reply(_("\2%s\2 allows you to execute \"fantasy\" commands in the channel.\n"
|
||||
"Fantasy commands are tied to existing commands, usually on \2%s\2,\n"
|
||||
"and provide a more convenient way to execute commands. Commands that\n"
|
||||
"require a channel as a parameter will automatically have that parameter\n"
|
||||
"given.\n"), source.service->nick.c_str(), Config->ChanServ.c_str());
|
||||
if (!Config->BSFantasyCharacter.empty())
|
||||
source.Reply(_(" \n"
|
||||
"Fantasy commands may be prefixed with one of the following characters: %s\n"), Config->BSFantasyCharacter.c_str());
|
||||
source.Reply(_(" \n"
|
||||
"Available commands are:"));
|
||||
}
|
||||
else if (source.service->nick == Config->BotServ)
|
||||
{
|
||||
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"
|
||||
"allow user bots. Available commands are listed \n"
|
||||
"below; to use them, type \002%s%s \037command\037\002. For\n"
|
||||
"more information on a specific command, type\n"
|
||||
"\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> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->BotServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->BotServ)
|
||||
return;
|
||||
|
||||
source.Reply(_(" \n"
|
||||
"Bot will join a channel whenever there is at least\n"
|
||||
"\002%d\002 user(s) on it."), Config->BSMinUsers);
|
||||
|
||||
@@ -151,7 +151,7 @@ class ChanServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->ChanServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->ChanServ)
|
||||
return EVENT_CONTINUE;
|
||||
source.Reply(_("\002%s\002 allows you to register and control various\n"
|
||||
"aspects of channels. %s can often prevent\n"
|
||||
@@ -166,7 +166,7 @@ class ChanServCore : public Module
|
||||
|
||||
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->ChanServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->ChanServ)
|
||||
return;
|
||||
if (Config->CSExpire >= 86400)
|
||||
source.Reply(_(" \n"
|
||||
|
||||
@@ -81,7 +81,7 @@ class GlobalCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->Global)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->Global)
|
||||
return EVENT_CONTINUE;
|
||||
source.Reply(_("%s commands:"), Config->Global.c_str());
|
||||
return EVENT_CONTINUE;
|
||||
|
||||
@@ -67,7 +67,7 @@ class HostServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->HostServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->HostServ)
|
||||
return EVENT_CONTINUE;
|
||||
source.Reply(_("%s commands:"), Config->HostServ.c_str());
|
||||
return EVENT_CONTINUE;
|
||||
|
||||
@@ -202,7 +202,7 @@ class MemoServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->MemoServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->MemoServ)
|
||||
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"
|
||||
@@ -215,7 +215,7 @@ class MemoServCore : public Module
|
||||
|
||||
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->MemoServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->MemoServ)
|
||||
return;
|
||||
source.Reply(_(" \n"
|
||||
"Type \002%s%s HELP \037command\037\002 for help on any of the\n"
|
||||
|
||||
@@ -320,7 +320,7 @@ class NickServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->NickServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->NickServ)
|
||||
return EVENT_CONTINUE;
|
||||
source.Reply(_("\002%s\002 allows you to \"register\" a nickname and\n"
|
||||
"prevent others from using it. The following\n"
|
||||
@@ -333,7 +333,7 @@ class NickServCore : public Module
|
||||
|
||||
void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->NickServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->NickServ)
|
||||
return;
|
||||
if (source.IsServicesOper())
|
||||
source.Reply(_(" \n"
|
||||
|
||||
@@ -249,7 +249,7 @@ class OperServCore : public Module
|
||||
|
||||
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!params.empty() || source.owner->nick != Config->OperServ)
|
||||
if (!params.empty() || source.c || source.service->nick != Config->OperServ)
|
||||
return EVENT_CONTINUE;
|
||||
source.Reply(_("%s commands:"), Config->OperServ.c_str());
|
||||
return EVENT_CONTINUE;
|
||||
|
||||
+2
-5
@@ -230,10 +230,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
|
||||
if (this->commands.empty())
|
||||
return;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u);
|
||||
source.owner = this;
|
||||
source.service = this;
|
||||
|
||||
CommandSource source(u->nick, u, u->Account(), u, this);
|
||||
RunCommand(source, message);
|
||||
}
|
||||
|
||||
@@ -256,7 +253,7 @@ void BotInfo::SetCommand(const Anope::string &cname, const Anope::string &sname,
|
||||
*/
|
||||
CommandInfo *BotInfo::GetCommand(const Anope::string &cname)
|
||||
{
|
||||
command_map::iterator it = this->commands.find(cname);
|
||||
CommandInfo::map::iterator it = this->commands.find(cname);
|
||||
if (it != this->commands.end())
|
||||
return &it->second;
|
||||
return NULL;
|
||||
|
||||
+5
-5
@@ -17,8 +17,8 @@
|
||||
#include "regchannel.h"
|
||||
#include "channels.h"
|
||||
|
||||
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r) : nick(n), u(user), nc(core), reply(r),
|
||||
c(NULL), owner(NULL), service(NULL)
|
||||
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r, BotInfo *bi) : nick(n), u(user), nc(core), reply(r),
|
||||
c(NULL), service(bi)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void Command::SendSyntax(CommandSource &source)
|
||||
void Command::SendSyntax(CommandSource &source, const Anope::string &syn)
|
||||
{
|
||||
source.Reply(_("Syntax: \002%s %s\002"), source.command.c_str(), syn.c_str());
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
|
||||
}
|
||||
|
||||
const Anope::string &Command::GetDesc() const
|
||||
@@ -171,7 +171,7 @@ bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { r
|
||||
void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
|
||||
{
|
||||
this->SendSyntax(source);
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
|
||||
}
|
||||
|
||||
void RunCommand(CommandSource &source, const Anope::string &message)
|
||||
@@ -179,7 +179,7 @@ void RunCommand(CommandSource &source, const Anope::string &message)
|
||||
std::vector<Anope::string> params = BuildStringVector(message);
|
||||
bool has_help = source.service->commands.find("HELP") != source.service->commands.end();
|
||||
|
||||
BotInfo::command_map::const_iterator it = source.service->commands.end();
|
||||
CommandInfo::map::const_iterator it = source.service->commands.end();
|
||||
unsigned count = 0;
|
||||
for (unsigned max = params.size(); it == source.service->commands.end() && max > 0; --max)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user