--- smsdaemon/plugins/TogPlugin.cpp 2008/12/07 15:51:02 142 +++ smsdaemon/plugins/TogPlugin.cpp 2008/12/18 06:53:29 196 @@ -1,27 +1,34 @@ #include "TogPlugin.h" -#include "IGsmModem.h" +#include "ISmsTransceiver.h" #include "Sms.h" #include "TrainInfo.h" -#include "util.h" +#include "Util.h" #include #include -#include "common.h" +#include "Common.h" using namespace std; +StationInfo::StationInfo(std::string c, std::string n) +{ + code = Util::str_characters(c); + name = Util::str_characters(n); +} + + TogPlugin::TogPlugin() - : Plugin("tog", "Henter tog info fra bane.dk") + : Plugin("tog", "Henter tog info fra bane.dk") { - _stationInfo["ar"] = StationInfo("AR","Århus"); - _stationInfo["la"] = StationInfo("LG","Langå"); + _stationInfo["ar"] = StationInfo("AR","Århus"); + _stationInfo["la"] = StationInfo("LG","Langå"); _stationInfo["ul"] = StationInfo("UP","Ulstrup"); _stationInfo["bj"] = StationInfo("BJ","Bjerringbro"); _stationInfo["vi"] = StationInfo("VG","Viborg"); - _stationInfo["ho"] = StationInfo("HØ","Højslev"); + _stationInfo["ho"] = StationInfo("HØ","Højslev"); _stationInfo["sk"] = StationInfo("SK","Skive"); } @@ -54,18 +61,17 @@ return os.str(); } -void TogPlugin::Execute(IGsmModem& modem, SMS& sms) +void TogPlugin::Execute(ISmsTransceiver& modem, SMS& sms) { string data = sms.ExtractParameters(); - data = Util::str_gsm2latin(data);; data = Util::str_tolower(data); if (data == "") { modem.SendSms(sms.GetSender(), "Usage: tog \ntog list - liste over stationer", false); - return; + return; } if (data == "list") @@ -88,7 +94,7 @@ { infos = GetTrainInfo( code , "" ); } - catch(std::exception& e) + catch (std::exception& e) { modem.SendSms(sms.GetSender(), e.what(), false ); return;