diff options
| author | Adam <Adam@anope.org> | 2012-10-08 20:58:47 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-10-08 20:58:47 -0400 |
| commit | 3af786d4c97e8ee99ea122a5c058d82e6222f295 (patch) | |
| tree | 750c5de0ec2c001b6366fd5137478e6944cdc296 | |
| parent | e57b470e83fac205a354138b1daccec654214e39 (diff) | |
Fix fantasy !help & give it its own help header, not ChanServ's
49 files changed, 197 insertions, 188 deletions
diff --git a/data/botserv.example.conf b/data/botserv.example.conf index fd3d2dc1e..66f5af396 100644 --- a/data/botserv.example.conf +++ b/data/botserv.example.conf @@ -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"; } diff --git a/include/bots.h b/include/bots.h index fa3053b57..19f921dbb 100644 --- a/include/bots.h +++ b/include/bots.h @@ -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 */ diff --git a/include/commands.h b/include/commands.h index 45b122247..59e8f5f1c 100644 --- a/include/commands.h +++ b/include/commands.h @@ -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(); diff --git a/include/config.h b/include/config.h index f4f164b37..554959e38 100644 --- a/include/config.h +++ b/include/config.h @@ -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. diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index 30de67d29..ad7a49085 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -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" diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index d5b2693ad..199b17e3e 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -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; } }; diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index 32cfbe952..eeaccd5f9 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -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" diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index 61839ab1e..e169f3c83 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -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; } diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index df724db1e..9ad72623f 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -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; } diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index 1ff67215c..6c0dfa386 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -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; } }; diff --git a/modules/commands/cs_clearusers.cpp b/modules/commands/cs_clearusers.cpp index 1c26fe382..9a50f70c9 100644 --- a/modules/commands/cs_clearusers.cpp +++ b/modules/commands/cs_clearusers.cpp @@ -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; } }; diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index 99c635c8f..bbc06c7be 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -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)); diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp index 09c077fc6..32ef87e3e 100644 --- a/modules/commands/cs_invite.cpp +++ b/modules/commands/cs_invite.cpp @@ -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; } }; diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 49c0919c4..7528a96c0 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -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; } }; diff --git a/modules/commands/cs_saset.cpp b/modules/commands/cs_saset.cpp index c2e7b13d5..a4a72ee76 100644 --- a/modules/commands/cs_saset.cpp +++ b/modules/commands/cs_saset.cpp @@ -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; } }; diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 0d23b5550..9851a27a1 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -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; } }; diff --git a/modules/commands/cs_set_keeptopic.cpp b/modules/commands/cs_set_keeptopic.cpp index 1aeedfa0a..d95d4ac2b 100644 --- a/modules/commands/cs_set_keeptopic.cpp +++ b/modules/commands/cs_set_keeptopic.cpp @@ -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; } }; diff --git a/modules/commands/cs_set_peace.cpp b/modules/commands/cs_set_peace.cpp index 889a0c6ae..f7eb8af6b 100644 --- a/modules/commands/cs_set_peace.cpp +++ b/modules/commands/cs_set_peace.cpp @@ -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; } }; diff --git a/modules/commands/cs_set_private.cpp b/modules/commands/cs_set_private.cpp index 37a5dbbc9..45741eb20 100644 --- a/modules/commands/cs_set_private.cpp +++ b/modules/commands/cs_set_private.cpp @@ -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; } }; diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp index 5badaa12d..3474874d6 100644 --- a/modules/commands/cs_topic.cpp +++ b/modules/commands/cs_topic.cpp @@ -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; } }; diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp index 91776b0c0..aaa336438 100644 --- a/modules/commands/cs_unban.cpp +++ b/modules/commands/cs_unban.cpp @@ -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; } }; diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index ae1fe3110..884d7e437 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -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; } }; diff --git a/modules/commands/gl_global.cpp b/modules/commands/gl_global.cpp index 2ec39b3b9..09d44f9a0 100644 --- a/modules/commands/gl_global.cpp +++ b/modules/commands/gl_global.cpp @@ -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; } }; diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp index c0c57dbae..28bf963a8 100644 --- a/modules/commands/help.cpp +++ b/modules/commands/help.cpp @@ -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; |
