--- smsdaemon/common.cpp 2008/12/08 21:28:40 157 +++ smsdaemon/Common.cpp 2008/12/23 12:09:08 216 @@ -1,4 +1,4 @@ -#include "common.h" +#include "Common.h" #include "version.h" @@ -13,6 +13,8 @@ #include "TaskManager.h" #include "PluginManager.h" #include "ConfigFile.h" +#include "Util.h" +#include "Logger.h" using namespace std; @@ -24,7 +26,7 @@ Common::Common() - : _pluginManager(0), _taskManager(0) + : _pluginManager(0), _taskManager(0) { _pluginManager = new PluginManager(); _taskManager = new TaskManager(); @@ -32,6 +34,7 @@ _configFile = new ConfigFile(); daemonized = false; + reloadConfig = false; } @@ -70,7 +73,7 @@ cout << " --debug : Run as normal (frontground) process," << endl; cout << " with all messages written to std out" << endl; cout << " --config : Specify which config file to use " << endl; - cout << " default" << configFilePath << endl; + cout << " default" << configFilePath << endl; cout << " --help : Show this help screen" << endl; exit(0); @@ -84,11 +87,11 @@ for (int i = 1; i< argc; i++) { string current(argv[i]); - if (current == "--daemon") + if (current == "--daemon") { - isDaemon = true; + isDaemon = true; isDebug = false; - + } else if (current == "--debug") { @@ -97,6 +100,17 @@ } else if (current == "--config") { + i++; + if ( ismsCounter.incomming << ". "; out << "Messages sent:" << this->smsCounter.outgoing << "."; - + return out.str(); } + +void Common::LoadWorker(std::set& set, std::string config) +{ + set.clear(); + + std::vector items = Util::str_split( + _configFile->GetValue("smsdaemon",config,""), + ","); + + std::ostringstream log; + log << "Loaded list '" << config << "': "; + for (unsigned i=0; i::iterator it = _blacklist.find(phone); + return ( it != _blacklist.end() ); +} + +bool Common::IsPrivileged(const std::string& phone) +{ + std::set::iterator it = _privileged.find(phone); + return ( it != _privileged.end() ); +}