+ while (i != upperbound)
+ {
+ if (i->second.UserCommand)
+ {
+ if (DoAlias(user, NULL, &(i->second), compare, original_line))
+ {
+ return MOD_RES_DENY;
+ }
+ }
+
+ i++;
+ }
+
+ // If we made it here, no aliases actually matched.
+ return MOD_RES_PASSTHRU;
+ }
+
+ virtual void OnUserMessage(User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
+ {
+ if (target_type != TYPE_CHANNEL)
+ {
+ return;
+ }
+
+ // fcommands are only for local users. Spanningtree will send them back out as their original cmd.
+ if (!user || !IS_LOCAL(user))
+ {
+ return;
+ }
+
+ /* Stop here if the user is +B and allowbot is set to no. */
+ if (!AllowBots && user->IsModeSet('B'))
+ {
+ return;
+ }
+
+ Channel *c = (Channel *)dest;
+ std::string fcommand;
+
+ // text is like "!moo cows bite me", we want "!moo" first
+ irc::spacesepstream ss(text);
+ ss.GetToken(fcommand);
+
+ if (fcommand.empty())
+ {
+ return; // wtfbbq
+ }
+
+ // we don't want to touch non-fantasy stuff
+ if (*fcommand.c_str() != fprefix)
+ {
+ return;
+ }
+
+ // nor do we give a shit about the prefix
+ fcommand.erase(fcommand.begin());
+ std::transform(fcommand.begin(), fcommand.end(), fcommand.begin(), ::toupper);
+
+ std::multimap<std::string, Alias>::iterator i = Aliases.find(fcommand);