1 |
#include "DelaySpamPlugin.h" |
#include "SpamPlugin.h" |
2 |
#include "ISmsTransceiver.h" |
#include "ISmsTransceiver.h" |
3 |
#include "Sms.h" |
#include "Sms.h" |
4 |
|
|
5 |
#include "tasks/DelaySpamTask.h" |
#include "tasks/SpamTask.h" |
6 |
#include "TaskManager.h" |
#include "TaskManager.h" |
7 |
|
|
8 |
#include "Common.h" |
#include "Common.h" |
17 |
|
|
18 |
using namespace std; |
using namespace std; |
19 |
|
|
20 |
const string USAGE = "Usage: delayspam <recipient> <nr> <interval> message"; |
const string USAGE = "Usage: spam <recipient> <nr> <interval> <message>"; |
21 |
|
|
22 |
DelaySpamPlugin::DelaySpamPlugin() |
SpamPlugin::SpamPlugin() |
23 |
: Plugin("delayspam", "Like spam plugin but with interval between transmitted SMS") |
: Plugin("spam", "Sends a number of messages to a given phone nr") |
24 |
{ |
{ |
25 |
} |
} |
26 |
|
|
27 |
void DelaySpamPlugin::Execute(ISmsTransceiver& modem, SMS& sms) |
void SpamPlugin::Execute(ISmsTransceiver& modem, SMS& sms) |
28 |
{ |
{ |
29 |
|
|
30 |
string cmd = sms.ExtractParameters(); |
string cmd = sms.ExtractParameters(); |
39 |
vector<string> parts = Util::str_split(cmd," "); |
vector<string> parts = Util::str_split(cmd," "); |
40 |
|
|
41 |
|
|
42 |
if (parts.size() < 3 ) |
if (parts.size() < 4 ) |
43 |
{ |
{ |
44 |
modem.SendSms(sms.GetSender(), USAGE, false); |
modem.SendSms(sms.GetSender(), USAGE, false); |
45 |
return; |
return; |
65 |
|
|
66 |
Logger::logMessage(os.str()); |
Logger::logMessage(os.str()); |
67 |
|
|
68 |
DelaySpamTask* task = new DelaySpamTask(); |
SpamTask* task = new SpamTask(); |
69 |
task->SetDestination( nr ); |
task->SetDestination( nr ); |
70 |
task->SetNumber( count ); |
task->SetNumber( count ); |
71 |
task->SetInterval( interval ); |
task->SetInterval( interval ); |