/[projects]/smsdaemon/plugins/ShellExecPlugin.cpp
ViewVC logotype

Contents of /smsdaemon/plugins/ShellExecPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (show annotations) (download)
Tue Jun 10 20:25:15 2008 UTC (15 years, 11 months ago) by torben
File size: 633 byte(s)
Added some extra string functions to Util::

Made Util::str_clean into Util::str_replace

1 #include "ShellExecPlugin.h"
2 #include "GsmModem.h"
3
4 #include "util.h"
5
6 ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand)
7 : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ),
8 _exeCommand(exeCommand)
9 {
10 }
11
12 void ShellExecPlugin::Execute(GsmModem& modem, SMS& sms)
13 {
14 std::string parameters = GetSmsData(sms);
15 parameters = Util::str_replace(parameters,";");
16
17 std::string command = _exeCommand + " " + parameters;
18 int retval = ::system( command.c_str() );
19
20 std::string message;
21 if (retval == -1)
22 message = "Error";
23 else
24 message = "OK";
25
26 modem.SendSms(sms.sender, message );
27 }

  ViewVC Help
Powered by ViewVC 1.1.20