7 |
: _transceiver(realtransceiver), _hasCC(false) |
: _transceiver(realtransceiver), _hasCC(false) |
8 |
{ |
{ |
9 |
Common* cmn = Common::instance(); |
Common* cmn = Common::instance(); |
10 |
_countrycode = cmn->GetConfigfile()->GetValue("smsdaemon","countrycode").StringValue(); |
_countrycode = cmn->GetConfigfile()->GetValue("smsdaemon","countrycode","").StringValue(); |
11 |
if (_countrycode != "") |
if (_countrycode != "") |
12 |
{ |
{ |
13 |
try |
try |
17 |
_hasCC = true; |
_hasCC = true; |
18 |
} |
} |
19 |
} |
} |
20 |
catch (std::exception&e) |
catch (...) |
21 |
{ |
{ |
22 |
Logger::logMessage( "Invalid country code:" + _countrycode); |
Logger::logMessage( "Invalid country code:" + _countrycode); |
23 |
} |
} |
24 |
} |
} |
25 |
|
if (_hasCC) |
26 |
|
Logger::logMessage( "Enforcing country code: " + _countrycode); |
27 |
|
else |
28 |
|
Logger::logMessage( "No countrycode enforced"); |
29 |
} |
} |
30 |
|
|
31 |
|
|
44 |
if (to.substr(0,_countrycode.size()) != _countrycode) |
if (to.substr(0,_countrycode.size()) != _countrycode) |
45 |
to.insert(0, _countrycode); |
to.insert(0, _countrycode); |
46 |
} |
} |
47 |
|
|
48 |
|
if ( Common::instance()->IsBlacklisted(to)) |
49 |
|
{ |
50 |
|
Logger::logMessage( "Will not send message to blacklisted phone: " + to); |
51 |
|
return; |
52 |
|
} |
53 |
|
|
54 |
_transceiver.SendSms(to,message,allowMultipart); |
_transceiver.SendSms(to,message,allowMultipart); |
55 |
} |
} |