void cIrc::parse_cmd(vector szToken, bool bTopic) { host_info hostInfo; int iTer; string szSendBuf; szToken[0] = szToken[0].substr(1,szToken[0].length()); if(szToken[3].find_first_of('#') != string::npos) { iTer = 4; strcpy(hostInfo.szFullHost,"*!*@*"); strcpy(hostInfo.szHost,"*"); strcpy(hostInfo.szIdent,"*"); strcpy(hostInfo.szNick,"*"); } else { iTer = 3; strcpy(hostInfo.szFullHost,szToken[0].c_str()); strcpy(hostInfo.szHost,szToken[0].substr(szToken[0].find_first_of('@'),szToken[0].find_first_of(' ')).c_str()); strcpy(hostInfo.szIdent,szToken[0].substr(szToken[0].find_first_of('!'),szToken[0].find_first_of('@')).c_str()); strcpy(hostInfo.szNick,szToken[0].substr(0,szToken[0].find_first_of('!')).c_str()); } strcpy(hostInfo.szTarget,szToken[iTer-1].c_str()); hostInfo.bSilent = false; hostInfo.Socket = irc_socket; hostInfo.gIrc = ((cIrc)*this); szToken.erase(szToken.begin(), szToken.begin() + iTer); szToken[0] = szToken[0].substr(1,szToken[0].length()); for(int i = 0;i < szToken.size();i++) { if(szToken[i].compare("-s") == 0) hostInfo.bSilent = true; } int iCmd = cmds.FindCommand(szToken[0].c_str()); #ifdef _DEBUG DebugConsole("Cmd -> %s (%d)",szToken[0].c_str(),iCmd); #endif if (iCmd != -1) { if(!gUsr.IsLoggedIn(hostInfo.szNick) && cmds.Commands[iCmd].bAllAccess) { #ifdef _DEBUG DebugConsole("DEBUG -> All Access Command Executed."); #endif cmds.Commands[iCmd].function(szToken,hostInfo); } else if (gUsr.IsLoggedIn(hostInfo.szNick) || bTopic) cmds.Commands[iCmd].function(szToken,hostInfo); } }