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

Diff of /smsdaemon/plugins/TogPlugin.cpp

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

revision 149 by torben, Sun Dec 7 20:58:41 2008 UTC revision 196 by torben, Thu Dec 18 06:53:29 2008 UTC
# Line 3  Line 3 
3  #include "Sms.h"  #include "Sms.h"
4    
5  #include "TrainInfo.h"  #include "TrainInfo.h"
6  #include "util.h"  #include "Util.h"
7    
8  #include <iostream>  #include <iostream>
9  #include <sstream>  #include <sstream>
10    
11  #include "common.h"  #include "Common.h"
12    
13  using namespace std;  using namespace std;
14    
15    
16    StationInfo::StationInfo(std::string c, std::string n)
17    {
18            code = Util::str_characters(c);
19            name = Util::str_characters(n);
20    }
21    
22    
23  TogPlugin::TogPlugin()  TogPlugin::TogPlugin()
24    : Plugin("tog", "Henter tog info fra bane.dk")                  : Plugin("tog", "Henter tog info fra bane.dk")
25  {  {
26          _stationInfo["ar"] = StationInfo("AR","�rhus");          _stationInfo["ar"] = StationInfo("AR","&Aring;rhus");
27          _stationInfo["la"] = StationInfo("LG","Lang�");          _stationInfo["la"] = StationInfo("LG","Lang&aring;");
28          _stationInfo["ul"] = StationInfo("UP","Ulstrup");          _stationInfo["ul"] = StationInfo("UP","Ulstrup");
29          _stationInfo["bj"] = StationInfo("BJ","Bjerringbro");          _stationInfo["bj"] = StationInfo("BJ","Bjerringbro");
30          _stationInfo["vi"] = StationInfo("VG","Viborg");          _stationInfo["vi"] = StationInfo("VG","Viborg");
31          _stationInfo["ho"] = StationInfo("H�","H�jslev");          _stationInfo["ho"] = StationInfo("H&Oslash;","H&oslash;jslev");
32          _stationInfo["sk"] = StationInfo("SK","Skive");          _stationInfo["sk"] = StationInfo("SK","Skive");
33  }  }
34    
# Line 58  void TogPlugin::Execute(ISmsTransceiver& Line 65  void TogPlugin::Execute(ISmsTransceiver&
65  {  {
66          string data = sms.ExtractParameters();          string data = sms.ExtractParameters();
67    
         data = Util::str_gsm2latin(data);;  
68          data = Util::str_tolower(data);          data = Util::str_tolower(data);
69    
70    
71          if (data == "")          if (data == "")
72          {          {
73                  modem.SendSms(sms.GetSender(), "Usage: tog <stationskode>\ntog list - liste over stationer", false);                  modem.SendSms(sms.GetSender(), "Usage: tog <stationskode>\ntog list - liste over stationer", false);
74                  return;                  return;
75          }          }
76    
77          if (data == "list")          if (data == "list")
# Line 88  void TogPlugin::Execute(ISmsTransceiver& Line 94  void TogPlugin::Execute(ISmsTransceiver&
94          {          {
95                  infos = GetTrainInfo( code , "" );                  infos = GetTrainInfo( code , "" );
96          }          }
97          catch(std::exception& e)          catch (std::exception& e)
98          {          {
99                  modem.SendSms(sms.GetSender(), e.what(), false );                  modem.SendSms(sms.GetSender(), e.what(), false );
100                  return;                  return;

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

  ViewVC Help
Powered by ViewVC 1.1.20