142 |
return out.str(); |
return out.str(); |
143 |
} |
} |
144 |
|
|
|
void Common::LoadWorker(std::set<std::string>& set, std::string config) |
|
|
{ |
|
|
set.clear(); |
|
|
|
|
|
std::vector<std::string> items = Util::str_split( |
|
|
_configFile->GetValue("smsdaemon",config,""), |
|
|
","); |
|
|
|
|
|
std::ostringstream log; |
|
|
log << "Loaded list '" << config << "': "; |
|
|
for (unsigned i=0; i<items.size(); i++) |
|
|
{ |
|
|
set.insert( Util::str_trim(items[i]) ); |
|
|
log << items[i] << " "; |
|
|
} |
|
|
Logger::logMessage(log.str()); |
|
|
} |
|
|
|
|
|
void Common::LoadLists() |
|
|
{ |
|
|
LoadWorker(_blacklist, "blacklist"); |
|
|
LoadWorker(_privileged, "privileged"); |
|
|
} |
|
|
|
|
|
|
|
|
bool Common::IsBlacklisted(const std::string& phone) |
|
|
{ |
|
|
std::set<std::string>::iterator it = _blacklist.find(phone); |
|
|
return ( it != _blacklist.end() ); |
|
|
} |
|
|
|
|
|
bool Common::IsPrivileged(const std::string& phone) |
|
|
{ |
|
|
std::set<std::string>::iterator it = _privileged.find(phone); |
|
|
return ( it != _privileged.end() ); |
|
|
} |
|