void execute (CCtrlBase * /* pCaller */, const std::string &sParams) { // Param uint mode; fromString(getParam (sParams, "mode"), mode); ucstring text; text.fromUtf8 (getParam (sParams, "text")); // text = getParam (sParams, "text"); // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { return; } // Find the base group if ((mode<CChatGroup::nbChatMode) && !text.empty()) { if(text[0] == '/') { string str = text.toUtf8(); string cmdWithArgs = str.substr(1); // Get the command name from the string, can contain spaces string cmd = cmdWithArgs.substr(0, cmdWithArgs.find(' ')); if (cmdWithArgs.find('"') == 0) { string::size_type pos = cmdWithArgs.find('"', 1); if (string::npos != pos) { cmd = cmdWithArgs.substr(1, pos - 1); } } if ( NLMISC::ICommand::exists( cmd ) ) { NLMISC::ICommand::execute( cmdWithArgs, g_log ); } else { CInterfaceManager *im = CInterfaceManager::getInstance(); im->displaySystemInfo (ucstring(cmd+": ")+CI18N::get ("uiCommandNotExists")); } } else { ChatMngr.setChatMode((CChatGroup::TGroupType)mode); ChatMngr.chat(text, mode == CChatGroup::team); } } }