3 |
#include "Sms.h" |
#include "Sms.h" |
4 |
|
|
5 |
#include "Util.h" |
#include "Util.h" |
6 |
|
#include "ConfigFile.h" |
7 |
|
|
8 |
ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand, bool allowParameters, bool returnOutput) |
#include <stdexcept> |
9 |
: Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ), |
|
10 |
_exeCommand(exeCommand), |
ShellExecPlugin::ShellExecPlugin(std::map<std::string,std::string> args) |
11 |
_allowParameters(allowParameters), |
: Plugin("", "") |
|
_returnOutput(returnOutput) |
|
12 |
{ |
{ |
13 |
|
_command = args["trigger"]; |
14 |
|
_exeCommand = args["cmd"]; |
15 |
|
_description = std::string("ShellExec: ")+_exeCommand; |
16 |
|
std::string allowParms = args["allowparms"]; |
17 |
|
std::string returnOutput = args["returnoutput"]; |
18 |
|
|
19 |
|
if (_command == "" || _exeCommand == "" || allowParms == "" || returnOutput == "") |
20 |
|
throw std::runtime_error("Usage: plugin = shellexec trigger=<trigger>; cmd=<command>; allowparms=<0|1>; returnoutput=<0|1>"); |
21 |
|
|
22 |
|
|
23 |
|
_allowParameters = ( ConfigHelper::StringToInt(allowParms) == 1); |
24 |
|
_returnOutput = ( ConfigHelper::StringToInt(returnOutput) == 1); |
25 |
} |
} |
26 |
|
|
27 |
void ShellExecPlugin::Execute(ISmsTransceiver& modem, SMS& sms) |
void ShellExecPlugin::Execute(ISmsTransceiver& modem, SMS& sms) |