diff options
author | Adam <Adam@anope.org> | 2011-03-11 15:10:30 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-03-11 15:10:30 -0500 |
commit | 1b2f3bf36964dd08c1bf6e803a36c03d6b7c492e (patch) | |
tree | be4314eae8f70083753b67bb6552b5d8bd90bf25 /src | |
parent | bb3b421385c0516a6a7091d77f45290dfe3e710c (diff) |
Fixed some problems with m_alias and fantasy
Diffstat (limited to 'src')
-rw-r--r-- | src/botserv.cpp | 59 | ||||
-rw-r--r-- | src/channels.cpp | 2 |
2 files changed, 31 insertions, 30 deletions
diff --git a/src/botserv.cpp b/src/botserv.cpp index c1b7fde56..a7076bcf5 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -317,41 +317,42 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) /* Fantaisist commands */ if (ci->botflags.HasFlag(BS_FANTASY) && buf[0] == Config->BSFantasyCharacter[0] && !was_action) { - spacesepstream sep(buf); - Anope::string command; - - if (sep.GetToken(command) && command[0] == Config->BSFantasyCharacter[0]) + Anope::string message = buf; + /* Strip off the fantasy character */ + message.erase(message.begin()); + + size_t space = message.find(' '); + Anope::string command, rest; + if (space == Anope::string::npos) + command = message; + else { - /* Strip off the fantasy character */ - command.erase(command.begin()); - - if (check_access(u, ci, CA_FANTASIA)) - { - Anope::string message = sep.GetRemaining(); - - FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, ci->bi, command, message, ci)); - if (MOD_RESULT == EVENT_STOP) - return; - - Command *cmd = FindCommand(ChanServ, command); + command = message.substr(0, space); + rest = message.substr(space + 1); + } - /* Command exists and can be called by fantasy */ - if (cmd && !cmd->HasFlag(CFLAG_DISABLE_FANTASY)) - { - /* Some commands don't need the channel name added.. eg !help */ - if (!cmd->HasFlag(CFLAG_STRIP_CHANNEL)) - message = ci->name + " " + message; - message = command + " " + message; + if (check_access(u, ci, CA_FANTASIA)) + { - mod_run_cmd(ChanServ, u, ci, message); - } + Command *cmd = FindCommand(ChanServ, command); - FOREACH_MOD(I_OnBotFantasy, OnBotFantasy(command, u, ci, sep.GetRemaining())); - } - else + /* Command exists and can be called by fantasy */ + if (cmd && !cmd->HasFlag(CFLAG_DISABLE_FANTASY)) { - FOREACH_MOD(I_OnBotNoFantasyAccess, OnBotNoFantasyAccess(command, u, ci, sep.GetRemaining())); + Anope::string params = rest; + /* Some commands don't need the channel name added.. eg !help */ + if (!cmd->HasFlag(CFLAG_STRIP_CHANNEL)) + params = ci->name + " " + params; + params = command + " " + params; + + mod_run_cmd(ChanServ, u, ci, params); } + + FOREACH_MOD(I_OnBotFantasy, OnBotFantasy(command, u, ci, rest)); + } + else + { + FOREACH_MOD(I_OnBotNoFantasyAccess, OnBotNoFantasyAccess(command, u, ci, rest)); } } } diff --git a/src/channels.cpp b/src/channels.cpp index 089b3831b..2fe4e037d 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -809,7 +809,7 @@ void Channel::KickInternal(const Anope::string &source, const Anope::string &nic /* Bots get rejoined */ if (bi) - bi->Join(chname); + bi->Join(this, &Config->BotModeList); } /** Kick a user from the channel |