don't send sms messages in queue if sms support has been turned off

This commit is contained in:
Eric House 2015-02-07 13:37:14 -08:00
parent 17307f910b
commit fa856e1db0

View file

@ -620,6 +620,7 @@ public class SMSService extends XWService {
private boolean sendBuffers( byte[][] fragments, String phone, byte[] data )
{
boolean success = false;
if ( XWPrefs.getSMSEnabled( this ) ) {
short nbsPort = (short)Integer.parseInt( getString( R.string.nbs_port ) );
try {
SmsManager mgr = SmsManager.getDefault();
@ -628,6 +629,8 @@ public class SMSService extends XWService {
for ( byte[] fragment : fragments ) {
mgr.sendDataMessage( phone, null, nbsPort, fragment, sent,
delivery );
DbgUtils.logf( "SMSService.sendBuffers(): sent %d byte fragment",
fragment.length );
}
if ( s_showToasts ) {
DbgUtils.showf( this, "sent %dth msg", s_nSent );
@ -640,6 +643,9 @@ public class SMSService extends XWService {
} catch ( Exception ee ) {
DbgUtils.loge( ee );
}
} else {
DbgUtils.logf( "sendBuffers(): dropping because SMS disabled" );
}
ConnStatusHandler.updateStatusOut( this, null,
CommsConnType.COMMS_CONN_SMS,
@ -697,9 +703,9 @@ public class SMSService extends XWService {
@Override
public void onReceive(Context arg0, Intent arg1)
{
DbgUtils.logf( "SMS delivery result: %s",
Activity.RESULT_OK == getResultCode()
? "SUCCESS" : "FAILURE" );
if ( Activity.RESULT_OK != getResultCode() ) {
DbgUtils.logf( "SMS delivery result: FAILURE" );
}
}
};
registerReceiver( m_receiveReceiver, new IntentFilter(MSG_DELIVERED) );