/[projects]/smsdaemon/SmsToolTransceiver.cpp
ViewVC logotype

Diff of /smsdaemon/SmsToolTransceiver.cpp

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

revision 158 by torben, Mon Dec 8 21:49:49 2008 UTC revision 162 by torben, Tue Dec 9 09:35:36 2008 UTC
# Line 2  Line 2 
2    
3  #include "Logger.h"  #include "Logger.h"
4  #include "Util.h"  #include "Util.h"
5    #include "Common.h"
6    
7  #include <stdexcept>  #include <stdexcept>
8  #include <iostream>  #include <iostream>
# Line 37  void SmsToolTransceiver::SendSms(std::st Line 38  void SmsToolTransceiver::SendSms(std::st
38          }          }
39          out << "To: " << to << "\n\n" << message ;          out << "To: " << to << "\n\n" << message ;
40          out.close();          out.close();
41    
42            Common::instance()->smsCounter.outgoing++;
43                    
44          int result = rename(tempfile.c_str(), destfile.c_str());          int result = rename(tempfile.c_str(), destfile.c_str());
45    
# Line 67  std::vector<SMS> SmsToolTransceiver::Rea Line 70  std::vector<SMS> SmsToolTransceiver::Rea
70                  {                  {
71                          if (entry->d_name[0] == '.')                          if (entry->d_name[0] == '.')
72                                  continue;                                  continue;
73                                                    Logger::logMessage( string("SmsTool::ReadSms >") +entry->d_name);
74    
75                          try                          try
76                          {                          {
77                                  SMS sms = ParseFile( incoming + entry->d_name);                                  SMS sms = ParseFile( incoming + entry->d_name);
# Line 135  void SmsToolTransceiver::ParseHeaders(st Line 139  void SmsToolTransceiver::ParseHeaders(st
139    
140          for (unsigned int i=0; i<headers.size(); i++)          for (unsigned int i=0; i<headers.size(); i++)
141          {          {
142                  int pos = headers[i].find(":");                  unsigned int  pos = headers[i].find(":");
143                  string key = Util::str_trim( headers[i].substr(0,pos) );                  if (pos != string::npos)
144                  string val = Util::str_trim( headers[i].substr(pos+1) );                  {
145                            string key = Util::str_trim( headers[i].substr(0,pos) );
146                            string val = Util::str_trim( headers[i].substr(pos+1) );
147    
148                  if (key == "From")                          if (key == "From")
149                          sms.SetSender(val);                                  sms.SetSender(val);
150    
151                  if (key == "Received")                          if (key == "Received")
152                          sms.SetTimestamp(val);                                  sms.SetTimestamp(val);
153                    }
154                    else
155                    {
156                            Logger::logMessage(string("SmsTool: Invalid sms file header> ") + headers[i]);
157                    }
158          }          }
159    
160  }  }

Legend:
Removed from v.158  
changed lines
  Added in v.162

  ViewVC Help
Powered by ViewVC 1.1.20