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

Diff of /smsdaemon/plugins/WeatherPlugin.cpp

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

revision 188 by torben, Mon Dec 15 13:27:53 2008 UTC revision 196 by torben, Thu Dec 18 06:53:29 2008 UTC
# Line 1  Line 1 
1  #include "WeatherPlugin.h"  #include "WeatherPlugin.h"
2  #include "ISmsTransceiver.h"  #include "ISmsTransceiver.h"
3  #include "Sms.h"  #include "Sms.h"
4    #include "HttpClient.h"
5    #include "Exceptions.h"
6  #include "Util.h"  #include "Util.h"
7    
8  using namespace std;  using namespace std;
9  using namespace Util;  using namespace Util;
10    
11  WeatherPlugin::WeatherPlugin()  WeatherPlugin::WeatherPlugin()
12    : Plugin("vejr", "Find danish weather report on dmi.dk")                  : Plugin("vejr", "Find danish weather report on dmi.dk")
13  {  {
14  }  }
15    
16  void WeatherPlugin::Execute(ISmsTransceiver& modem, SMS& sms)  void WeatherPlugin::Execute(ISmsTransceiver& modem, SMS& sms)
17  {  {
18          string doc = Util::readUrl("http://www.dmi.dk/dmi/danmark.htm","/tmp/sms_vejr.tmp");          string doc;
19            try
20            {
21                    doc = HttpClient::GetString("http://www.dmi.dk/dmi/danmark.htm");
22            }
23            catch (httpexception&e )
24            {
25                    modem.SendSms(sms.GetSender(), "could not retrieve data", true);
26                    return;
27            }
28    
29          int pos = doc.find("<!-- tekst 5 -->");          int pos = doc.find("<!-- tekst 5 -->");
30          int pos2 = doc.find("</table>",pos);          int pos2 = doc.find("</table>",pos);

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

  ViewVC Help
Powered by ViewVC 1.1.20