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

Diff of /smsdaemon/SmsPdu.cpp

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

revision 136 by torben, Sun Dec 7 10:15:44 2008 UTC revision 157 by torben, Mon Dec 8 21:28:40 2008 UTC
# Line 10  Line 10 
10  #include <time.h>  #include <time.h>
11  #include <stdlib.h>  #include <stdlib.h>
12    
13  #include "common.h"  #include "Logger.h"
14  #include "util.h"  #include "util.h"
15    
16    
# Line 154  namespace SmsPdu Line 154  namespace SmsPdu
154                  {                  {
155                          if (message.length() > 800)                          if (message.length() > 800)
156                          {                          {
157                                  Common::instance()->logMessage("Trying to send multipart sms > 800 bytes !!!");                                  Logger::logMessage("Trying to send multipart sms > 800 bytes !!!");
158                                  message = message.substr(0,800);                                  message = message.substr(0,800);
159                          }                          }
160    
# Line 207  namespace SmsPdu Line 207  namespace SmsPdu
207                                  if (message.length() > 160)                                  if (message.length() > 160)
208                                  {                                  {
209                                          message_part = message.substr(0,160); //truncate to 160                                          message_part = message.substr(0,160); //truncate to 160
210                                          Common::instance()->logMessage("Truncated message");                                          Logger::logMessage("Truncated message");
211                                  }                                  }
212                                  else                                  else
213                                  {                                  {
# Line 276  namespace SmsPdu Line 276  namespace SmsPdu
276    
277          SMS ParseSmsPdu(std::string pdu_str)          SMS ParseSmsPdu(std::string pdu_str)
278          {          {
                 SMS result;  
279    
280                  vector<unsigned char> pdu = HexDecodeString(pdu_str);                  vector<unsigned char> pdu = HexDecodeString(pdu_str);
281    
# Line 294  namespace SmsPdu Line 293  namespace SmsPdu
293    
294                  ++it; //ignore Type-Of-Address                  ++it; //ignore Type-Of-Address
295    
296                  result.sender = DecodeRawPhonenr( it, it+(sender_len/2) );                  string sender = DecodeRawPhonenr( it, it+(sender_len/2) );
297    
298                  it += (sender_len/2);                  it += (sender_len/2);
299                  ++it; //protocol identifier                  ++it; //protocol identifier
300                  ++it; //Data encoding                  ++it; //Data encoding
301    
302                  result.timestamp = DecodeTimestamp(it, it+7);                  string timestamp = DecodeTimestamp(it, it+7);
303                  it += 7;                  it += 7;
304    
305    
# Line 320  namespace SmsPdu Line 319  namespace SmsPdu
319                  vector<unsigned char> user_data;                  vector<unsigned char> user_data;
320                  user_data.insert(user_data.end(), it, it+data_len);                  user_data.insert(user_data.end(), it, it+data_len);
321                                    
322                  result.message = Decode8to7bit(user_data, shift_start).substr(0,data_len);                  string message = Decode8to7bit(user_data, shift_start).substr(0,data_len);
323    
324                  result.message = Util::str_trim(result.message);                  message = Util::str_trim(message);
325                                    
326                    SMS result;
327                    result.SetMessage(message);
328                    result.SetSender(sender);
329    
330                  return result;                  return result;
331          }          }

Legend:
Removed from v.136  
changed lines
  Added in v.157

  ViewVC Help
Powered by ViewVC 1.1.20