cthulhu-bot/commands.cpp
// Main command method. Tries to execute command and returns some response.

Main command method. Tries to execute command and returns some response.
Main command method . Tries to execute command and returns some response .
string ChtonianBot::executeCommand(const string &command,
    const int accessLevel, const bool fromMUC)
{
    vector<string> arguments;
    if(parseCommand(command, arguments))
    {
        for(vector<Command>::iterator cmd = commands.begin();
            cmd != commands.end(); ++cmd)        
        {
            if(arguments[0] == cmd->name
                && arguments.size() == cmd->argsCount + 1
                && accessLevel >= cmd->accessLevel)
            {
                return cmd->execute(arguments, accessLevel, *this);
            }
        }
    }
    return "";
}
string ChtonianBot :: executeCommand ( const string & command , const int accessLevel , const bool fromMUC ) { vector < string > arguments ; if ( parseCommand ( command , arguments ) ) { for ( vector < Command > :: iterator cmd = commands . begin ( ) ; cmd != commands . end ( ) ; ++ cmd ) { if ( arguments [ 0 ] == cmd -> name && arguments . size ( ) == cmd -> argsCount + 1 && accessLevel >= cmd -> accessLevel ) { return cmd -> execute ( arguments , accessLevel , * this ) ; } } } return " " ; }
Main command method.
Main command method .