+ std::string fprefix;
+
+ /* We cant use a map, there may be multiple aliases with the same name.
+ * We can, however, use a fancy invention: the multimap. Maps a key to one or more values.
+ * -- w00t
+ */
+ typedef insp::flat_multimap<std::string, Alias, irc::insensitive_swo> AliasMap;
+
+ AliasMap Aliases;
+
+ /* whether or not +B users are allowed to use fantasy commands */
+ bool AllowBots;
+ UserModeReference botmode;
+
+ public:
+ void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
+ {
+ ConfigTag* fantasy = ServerInstance->Config->ConfValue("fantasy");
+ AllowBots = fantasy->getBool("allowbots", false);
+ fprefix = fantasy->getString("prefix", "!", 1, ServerInstance->Config->Limits.MaxLine);
+
+ Aliases.clear();
+ ConfigTagList tags = ServerInstance->Config->ConfTags("alias");
+ for(ConfigIter i = tags.first; i != tags.second; ++i)
+ {
+ ConfigTag* tag = i->second;
+ Alias a;
+ a.AliasedCommand = tag->getString("text");
+ std::transform(a.AliasedCommand.begin(), a.AliasedCommand.end(), a.AliasedCommand.begin(), ::toupper);
+ tag->readString("replace", a.ReplaceFormat, true);
+ a.RequiredNick = tag->getString("requires");
+ a.ULineOnly = tag->getBool("uline");
+ a.ChannelCommand = tag->getBool("channelcommand", false);
+ a.UserCommand = tag->getBool("usercommand", true);
+ a.OperOnly = tag->getBool("operonly");
+ a.format = tag->getString("format");
+ Aliases.insert(std::make_pair(a.AliasedCommand, a));
+ }
+ }
+
+ ModuleAlias()
+ : botmode(this, "bot")
+ {
+ }
+
+ Version GetVersion() CXX11_OVERRIDE
+ {
+ return Version("Provides aliases of commands.", VF_VENDOR);
+ }
+
+ std::string GetVar(std::string varname, const std::string &original_line)
+ {
+ irc::spacesepstream ss(original_line);
+ varname.erase(varname.begin());
+ int index = *(varname.begin()) - 48;
+ varname.erase(varname.begin());
+ bool everything_after = (varname == "-");
+ std::string word;
+
+ for (int j = 0; j < index; j++)
+ ss.GetToken(word);