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

Diff of /smsdaemon/plugins/UrlTriggerPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 195 by torben, Wed Dec 17 23:43:26 2008 UTC revision 196 by torben, Thu Dec 18 06:53:29 2008 UTC
# Line 12  Line 12 
12  using namespace std;  using namespace std;
13    
14  UrlTriggerPlugin::UrlTriggerPlugin(string cmd, string url)  UrlTriggerPlugin::UrlTriggerPlugin(string cmd, string url)
15    : Plugin(cmd, string("URL Trigger:")+url ),                  : Plugin(cmd, string("URL Trigger:")+url ),
16      command(cmd), URL(url)                  command(cmd), URL(url)
17  {  {
18  }  }
19    
# Line 25  void UrlTriggerPlugin::Execute(ISmsTrans Line 25  void UrlTriggerPlugin::Execute(ISmsTrans
25          request << "data=" << HttpClient::UrlEncode(sms.ExtractParameters());          request << "data=" << HttpClient::UrlEncode(sms.ExtractParameters());
26    
27          string reply;          string reply;
28          try {          try
29            {
30                  reply = HttpClient::GetString( request.str() );                  reply = HttpClient::GetString( request.str() );
31                  reply = Util::str_replace(reply, "\r"); //remove carriage return                  reply = Util::str_replace(reply, "\r"); //remove carriage return
32                  if (reply == "")                  if (reply == "")
33                          reply = "Empty reply from server !?!";                          reply = "Empty reply from server !?!";
34          } catch (httpexception& e) {          }
35            catch (httpexception& e)
36            {
37                  reply = "Error: Could not execute command";                  reply = "Error: Could not execute command";
38                  Logger::logMessage(string("UrlTrigger failed: ") + command + ">" + e.what() );                  Logger::logMessage(string("UrlTrigger failed: ") + command + ">" + e.what() );
39          }          }

Legend:
Removed from v.195  
changed lines
  Added in v.196

  ViewVC Help
Powered by ViewVC 1.1.20