--- smsdaemon/plugins/SpamPlugin.cpp 2008/06/16 10:21:02 90 +++ smsdaemon/plugins/SpamPlugin.cpp 2008/12/18 06:53:29 196 @@ -1,39 +1,40 @@ #include "SpamPlugin.h" -#include "IGsmModem.h" +#include "ISmsTransceiver.h" #include "Sms.h" -#include "util.h" -#include "common.h" +#include "Util.h" +#include "Logger.h" #include +#include using namespace std; SpamPlugin::SpamPlugin() -: Plugin("spam", "Sends a number of messages to a given phone nr") + : Plugin("spam", "Sends a number of messages to a given phone nr") { } const string USAGE = "Usage: spam message"; -void SpamPlugin::Execute(IGsmModem& modem, SMS& sms) +void SpamPlugin::Execute(ISmsTransceiver& modem, SMS& sms) { - string cmd = GetSmsData(sms); + string cmd = sms.ExtractParameters(); if (cmd == "") { - modem.SendSms(sms.sender, USAGE, false); + modem.SendSms(sms.GetSender(), USAGE, false); return; } - + vector parts = Util::str_split(cmd," "); if (parts.size() < 2 ) { - modem.SendSms(sms.sender, USAGE, false); + modem.SendSms(sms.GetSender(), USAGE, false); return; } @@ -41,10 +42,10 @@ unsigned int count = atoi(parts[1].c_str()); if (count > 25) count = 25; - + ostringstream os; os << "Spamming " << nr << " " << count << " times."; - Common::instance()->logMessage(os.str()); + Logger::logMessage(os.str()); string message; for (unsigned i=2; i