summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-08 20:58:47 -0400
committerAdam <Adam@anope.org>2012-10-08 20:58:47 -0400
commit3af786d4c97e8ee99ea122a5c058d82e6222f295 (patch)
tree750c5de0ec2c001b6366fd5137478e6944cdc296
parente57b470e83fac205a354138b1daccec654214e39 (diff)
Fix fantasy !help & give it its own help header, not ChanServ's
-rw-r--r--data/botserv.example.conf2
-rw-r--r--include/bots.h3
-rw-r--r--include/commands.h6
-rw-r--r--include/config.h3
-rw-r--r--modules/commands/bs_badwords.cpp2
-rw-r--r--modules/commands/bs_info.cpp2
-rw-r--r--modules/commands/bs_kick.cpp4
-rw-r--r--modules/commands/bs_set.cpp4
-rw-r--r--modules/commands/cs_access.cpp10
-rw-r--r--modules/commands/cs_akick.cpp4
-rw-r--r--modules/commands/cs_clearusers.cpp2
-rw-r--r--modules/commands/cs_clone.cpp2
-rw-r--r--modules/commands/cs_invite.cpp2
-rw-r--r--modules/commands/cs_register.cpp4
-rw-r--r--modules/commands/cs_saset.cpp4
-rw-r--r--modules/commands/cs_set.cpp4
-rw-r--r--modules/commands/cs_set_keeptopic.cpp2
-rw-r--r--modules/commands/cs_set_peace.cpp2
-rw-r--r--modules/commands/cs_set_private.cpp2
-rw-r--r--modules/commands/cs_topic.cpp2
-rw-r--r--modules/commands/cs_unban.cpp2
-rw-r--r--modules/commands/cs_xop.cpp20
-rw-r--r--modules/commands/gl_global.cpp2
-rw-r--r--modules/commands/help.cpp11
-rw-r--r--modules/commands/ms_set.cpp2
-rw-r--r--modules/commands/ns_identify.cpp2
-rw-r--r--modules/commands/ns_recover.cpp2
-rw-r--r--modules/commands/ns_register.cpp4
-rw-r--r--modules/commands/ns_resetpass.cpp2
-rw-r--r--modules/commands/ns_saset.cpp2
-rw-r--r--modules/commands/ns_sendpass.cpp2
-rw-r--r--modules/commands/ns_set.cpp4
-rw-r--r--modules/commands/ns_set_email.cpp2
-rw-r--r--modules/commands/os_kick.cpp4
-rw-r--r--modules/commands/os_login.cpp6
-rw-r--r--modules/commands/os_mode.cpp6
-rw-r--r--modules/commands/os_modinfo.cpp2
-rw-r--r--modules/commands/os_oline.cpp8
-rw-r--r--modules/extra/m_xmlrpc_main.cpp6
-rw-r--r--modules/extra/webcpanel/webcpanel.cpp5
-rw-r--r--modules/pseudoclients/botserv.cpp190
-rw-r--r--modules/pseudoclients/chanserv.cpp4
-rw-r--r--modules/pseudoclients/global.cpp2
-rw-r--r--modules/pseudoclients/hostserv.cpp2
-rw-r--r--modules/pseudoclients/memoserv.cpp4
-rw-r--r--modules/pseudoclients/nickserv.cpp4
-rw-r--r--modules/pseudoclients/operserv.cpp2
-rw-r--r--src/bots.cpp7
-rw-r--r--src/command.cpp10
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;
diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp
index 998a5a062..02ce8d32c 100644
--- a/modules/commands/ms_set.cpp
+++ b/modules/commands/ms_set.cpp
@@ -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"
diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp
index 47df4255b..c71d8e4a7 100644
--- a/modules/commands/ns_identify.cpp
+++ b/modules/commands/ns_identify.cpp
@@ -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;
}
};
diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp
index 0611e6589..0afa9abbe 100644
--- a/modules/commands/ns_recover.cpp
+++ b/modules/commands/ns_recover.cpp
@@ -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)
{
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 2665b2381..4253b672b 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -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());
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index 6102c2d85..8965b6a3e 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -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());
diff --git a/modules/commands/ns_saset.cpp b/modules/commands/ns_saset.cpp
index f49af06e9..8d2ba08d9 100644
--- a/modules/commands/ns_saset.cpp
+++ b/modules/commands/ns_saset.cpp
@@ -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;
diff --git a/modules/commands/ns_sendpass.cpp b/modules/commands/ns_sendpass.cpp
index 6b2b2533b..5d88fd5a4 100644
--- a/modules/commands/ns_sendpass.cpp
+++ b/modules/commands/ns_sendpass.cpp
@@ -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());
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 719ddc4f3..0917d45bd 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -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;
}
};
diff --git a/modules/commands/ns_set_email.cpp b/modules/commands/ns_set_email.cpp
index 34aa68c5c..6966c2a79 100644
--- a/modules/commands/ns_set_email.cpp
+++ b/modules/commands/ns_set_email.cpp
@@ -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;
}
diff --git a/modules/commands/os_kick.cpp b/modules/commands/os_kick.cpp
index e3dd8cf8d..0a5165621 100644
--- a/modules/commands/os_kick.cpp
+++ b/modules/commands/os_kick.cpp
@@ -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;
}
};
diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp
index 0ceac6428..c282b9662 100644
--- a/modules/commands/os_login.cpp
+++ b/modules/commands/os_login.cpp
@@ -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;
}
};
diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp
index 55e5145c2..2fa8e5f69 100644
--- a/modules/commands/os_mode.cpp
+++ b/modules/commands/os_mode.cpp
@@ -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;
}
diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp
index 60fe8293f..88748a106 100644
--- a/modules/commands/os_modinfo.cpp
+++ b/modules/commands/os_modinfo.cpp
@@ -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;
diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp
index ccf053f7e..3fe622c1c 100644
--- a/modules/commands/os_oline.cpp
+++ b/modules/commands/os_oline.cpp
@@ -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;
}
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index cd7b68967..90c8fdc5d 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -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())
diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp
index 460efba3a..b6b2d5776 100644
--- a/modules/extra/webcpanel/webcpanel.cpp
+++ b/modules/extra/webcpanel/webcpanel.cpp
@@ -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);
}
}
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp
index ec4bac11d..f165423fc 100644
--- a/modules/pseudoclients/botserv.cpp
+++ b/modules/pseudoclients/botserv.cpp
@@ -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)
- {
- /* Strip off the fantasy character */
- if (!Config->BSFantasyCharacter.empty())
- realbuf.erase(realbuf.begin());
+ std::vector<Anope::string> params = BuildStringVector(realbuf);
- 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;
- 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());
+ CommandInfo::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());
- ++count;
- it = Config->Fantasy.find(full_command);
- }
+ ++count;
+ it = Config->Fantasy.find(full_command);
+ }
- if (it == Config->Fantasy.end())
- return;
+ if (it == Config->Fantasy.end())
+ return;
- 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;
- }
+ 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;
+ }
- for (unsigned i = 0, j = params.size() - (count - 1); i < j; ++i)
- params.erase(params.begin());
+ for (unsigned i = 0, j = params.size() - (count - 1); i < j; ++i)
+ params.erase(params.begin());
- while (cmd->MaxParams > 0 && params.size() > cmd->MaxParams)
- {
- params[cmd->MaxParams - 1] += " " + params[cmd->MaxParams];
- params.erase(params.begin() + cmd->MaxParams);
- }
+ while (cmd->MaxParams > 0 && params.size() > cmd->MaxParams)
+ {
+ params[cmd->MaxParams - 1] += " " + params[cmd->MaxParams];
+ params.erase(params.begin() + cmd->MaxParams);
+ }
- /* All ChanServ commands take the channel as a first parameter */
- if (cmd->name.find("chanserv/") == 0)
- params.insert(params.begin(), c->ci->name);
+ /* 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);
- // Command requires registered users only
- if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account())
- return;
+ // Command requires registered users only
+ if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account())
+ return;
- if (params.size() < cmd->MinParams)
- return;
+ if (params.size() < cmd->MinParams)
+ return;
- 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;
+ CommandSource source(u->nick, u, u->Account(), u, c->ci->bi);
+ source.c = c;
+ source.command = it->first;
+ source.permission = info.permission;
- 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));
- }
+ 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_STOP || !c->ci->AccessFor(u).HasPriv("FANTASIA"))
- return;
+ if (MOD_RESULT == EVENT_STOP || !c->ci->AccessFor(u).HasPriv("FANTASIA"))
+ return;
- if (MOD_RESULT != EVENT_ALLOW && !info.permission.empty() && !source.HasCommand(info.permission))
- return;
+ if (MOD_RESULT != EVENT_ALLOW && !info.permission.empty() && !source.HasCommand(info.permission))
+ return;
- FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, cmd, params));
- if (MOD_RESULT == EVENT_STOP)
- return;
+ 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);
+ 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> &params) 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> &params) 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);
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index 181baa7b8..c3a6e6479 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -151,7 +151,7 @@ class ChanServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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> &params) 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"
diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp
index 3fdfbf4e0..13e7570ce 100644
--- a/modules/pseudoclients/global.cpp
+++ b/modules/pseudoclients/global.cpp
@@ -81,7 +81,7 @@ class GlobalCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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;
diff --git a/modules/pseudoclients/hostserv.cpp b/modules/pseudoclients/hostserv.cpp
index 33d183b9a..d0d078a79 100644
--- a/modules/pseudoclients/hostserv.cpp
+++ b/modules/pseudoclients/hostserv.cpp
@@ -67,7 +67,7 @@ class HostServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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;
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index f24b69edf..faeeae1fc 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -202,7 +202,7 @@ class MemoServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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> &params) 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"
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index cda719a33..caffd74d4 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -320,7 +320,7 @@ class NickServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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> &params) 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"
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index b02120e91..cc051d685 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -249,7 +249,7 @@ class OperServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) 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;
diff --git a/src/bots.cpp b/src/bots.cpp
index 38f37c41d..bc7fc3cb0 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -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;
diff --git a/src/command.cpp b/src/command.cpp
index 976f89de7..6ae9275ca 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -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)
{