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

Diff of /smsdaemon/ProxyTransceiver.cpp

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

revision 211 by torben, Sun Dec 21 22:08:20 2008 UTC revision 217 by torben, Tue Dec 23 14:20:43 2008 UTC
# Line 2  Line 2 
2  #include "ConfigFile.h"  #include "ConfigFile.h"
3  #include "Common.h"  #include "Common.h"
4  #include "Logger.h"  #include "Logger.h"
5    #include "AccessManager.h"
6    
7  ProxyTransceiver::ProxyTransceiver(ISmsTransceiver& realtransceiver)  ProxyTransceiver::ProxyTransceiver(ISmsTransceiver& realtransceiver)
8          : _transceiver(realtransceiver), _hasCC(false)          : _transceiver(realtransceiver), _hasCC(false)
9  {  {
10          Common* cmn = Common::instance();          Common* cmn = Common::instance();
11          _countrycode = cmn->GetConfigfile()->GetValue("smsdaemon","countrycode").StringValue();          _countrycode = cmn->GetConfigfile()->GetValue("smsdaemon","countrycode","").StringValue();
12          if (_countrycode != "")          if (_countrycode != "")
13          {          {
14                  try                  try
# Line 17  ProxyTransceiver::ProxyTransceiver(ISmsT Line 18  ProxyTransceiver::ProxyTransceiver(ISmsT
18                                  _hasCC = true;                                  _hasCC = true;
19                          }                          }
20                  }                  }
21                  catch (std::exception&e)                  catch (...)
22                  {                  {
23                          Logger::logMessage( "Invalid country code:" + _countrycode);                          Logger::logMessage( "Invalid country code:" + _countrycode);
24                  }                                }
25          }          }
26            if (_hasCC)
27                    Logger::logMessage( "Enforcing country code: " + _countrycode);
28            else
29                    Logger::logMessage( "No countrycode enforced");
30  }  }
31    
32    
# Line 40  void ProxyTransceiver::SendSms(std::stri Line 45  void ProxyTransceiver::SendSms(std::stri
45                  if (to.substr(0,_countrycode.size()) != _countrycode)                  if (to.substr(0,_countrycode.size()) != _countrycode)
46                          to.insert(0, _countrycode);                          to.insert(0, _countrycode);
47          }          }
48            
49            if ( AccessManager::IsBlacklisted(to))
50            {
51                    Logger::logMessage( "Will not send message to blacklisted phone: " + to);
52                    return;
53            }
54    
55          _transceiver.SendSms(to,message,allowMultipart);          _transceiver.SendSms(to,message,allowMultipart);
56  }  }

Legend:
Removed from v.211  
changed lines
  Added in v.217

  ViewVC Help
Powered by ViewVC 1.1.20