--- smsdaemon/plugins/ShellExecPlugin.cpp 2008/12/19 07:33:01 204 +++ smsdaemon/plugins/ShellExecPlugin.cpp 2008/12/19 22:29:25 205 @@ -3,13 +3,25 @@ #include "Sms.h" #include "Util.h" +#include "ConfigFile.h" -ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand, bool allowParameters, bool returnOutput) - : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ), - _exeCommand(exeCommand), - _allowParameters(allowParameters), - _returnOutput(returnOutput) +#include + +ShellExecPlugin::ShellExecPlugin(std::map args) + : Plugin("", "") { + _command = args["trigger"]; + _exeCommand = args["cmd"]; + _description = std::string("ShellExec: ")+_exeCommand; + std::string allowParms = args["allowparms"]; + std::string returnOutput = args["returnoutput"]; + + if (_command == "" || _exeCommand == "" || allowParms == "" || returnOutput == "") + throw std::runtime_error("Usage: plugin = shellexec trigger=; cmd=; allowparms=<0|1>; returnoutput=<0|1>"); + + + _allowParameters = ( ConfigHelper::StringToInt(allowParms) == 1); + _returnOutput = ( ConfigHelper::StringToInt(returnOutput) == 1); } void ShellExecPlugin::Execute(ISmsTransceiver& modem, SMS& sms)