bool AccessList::parseList(const std::string& _list) { playerList.clear(); guildList.clear(); expressionList.clear(); regExList.clear(); list = _list; if(_list == "") return true; std::istringstream listStream(_list); std::string line; while(getline(listStream, line)) { trimString(line); trim_left(line, "\t"); trim_right(line, "\t"); trimString(line); std::transform(line.begin(), line.end(), line.begin(), tolower); if(line.substr(0,1) == "#" || line.length() > 100) continue; if(line.find("@") != std::string::npos) { std::string::size_type pos = line.find("@"); addGuild(line.substr(pos + 1), ""); } else if(line.find("!") != std::string::npos || line.find("*") != std::string::npos || line.find("?") != std::string::npos) addExpression(line); else addPlayer(line); } return true; }
bool AccessList::parseList(const std::string& _list) { playerList.clear(); guildList.clear(); expressionList.clear(); regExList.clear(); list = _list; if (_list.empty()) { return true; } std::istringstream listStream(_list); std::string line; while (getline(listStream, line)) { trimString(line); trim_left(line, '\t'); trim_right(line, '\t'); trimString(line); if (line.empty() || line.front() == '#' || line.length() > 100) { continue; } toLowerCaseString(line); std::string::size_type at_pos = line.find("@"); if (at_pos != std::string::npos) { addGuild(line.substr(at_pos + 1)); } else if (line.find("!") != std::string::npos || line.find("*") != std::string::npos || line.find("?") != std::string::npos) { addExpression(line); } else { addPlayer(line); } } return true; }