--- smsdaemon/plugins/ShellExecPlugin.cpp 2008/06/17 17:56:45 106 +++ smsdaemon/plugins/ShellExecPlugin.cpp 2008/06/19 14:47:52 107 @@ -4,10 +4,11 @@ #include "util.h" -ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand, bool allowParameters) +ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand, bool allowParameters, bool returnOutput) : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ), _exeCommand(exeCommand), - _allowParameters(allowParameters) + _allowParameters(allowParameters), + _returnOutput(returnOutput) { } @@ -28,13 +29,24 @@ command += " "; command += parameters; } - int retval = Util::my_system( command.c_str() ); + std::string output; + std::string* out_p = 0; + + if (_returnOutput) + out_p = &output; + + int retval = Util::my_system( command.c_str(), out_p ); std::string message; if (retval == -1) message = "Error"; else - message = "OK"; + { + if (_returnOutput) + message = output; + else + message = "OK"; + } modem.SendSms(sms.sender, message, false ); }