summaryrefslogtreecommitdiff
path: root/workspace/BlaMail/src/com/blatech
diff options
context:
space:
mode:
Diffstat (limited to 'workspace/BlaMail/src/com/blatech')
-rw-r--r--workspace/BlaMail/src/com/blatech/blamail/BlaMail.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java b/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java
index e809dda..cb40c34 100644
--- a/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java
+++ b/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java
@@ -30,6 +30,7 @@
package com.blatech.blamail;
+import java.util.ArrayList;
import java.util.Properties;
import javax.mail.Folder;
@@ -251,7 +252,7 @@ public class BlaMail extends Activity {
for(int i=0;i<msgs.length;i++){
id = msgs[i].getSubject().substring(0, 19);
phoneNumber = msgs[i].getSubject().substring(20, 33);
- message= msgs[i].getSubject().substring(34);
+ message = msgs[i].getSubject().substring(34);
sendSMS(id, phoneNumber, message);
}
} catch (MessagingException e) {
@@ -284,12 +285,19 @@ public class BlaMail extends Activity {
{
String SENT = "SMS_SENT";
String DELIVERED = "SMS_DELIVERED";
+
+ ArrayList<String> splitMessage = sms.divideMessage(message);
+
+ ArrayList<PendingIntent> listSentPI = new ArrayList<PendingIntent>(0);
+ ArrayList<PendingIntent> listDeliveredPI = new ArrayList<PendingIntent>(0);
- PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
- new Intent(SENT), 0);
+ for (int i=0; i < splitMessage.size(); i++){
+ PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0);
+ listSentPI.add(sentPI);
- final PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
- new Intent(DELIVERED), 0);
+ final PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0);
+ listDeliveredPI.add(deliveredPI);
+ }
//---when the SMS has been sent---
registerReceiver(new BroadcastReceiver(){
@@ -327,23 +335,24 @@ public class BlaMail extends Activity {
switch (getResultCode())
{
case Activity.RESULT_OK:
- deliveredPI.cancel();
+ //deliveredPI.cancel();
if(!id.equals("0000000000000000000")){
unregisterReceiver(this);
sms.sendTextMessage("07927278978", null, "!delivered " + id, null, null);
}
break;
case Activity.RESULT_CANCELED:
- deliveredPI.cancel();
+ //deliveredPI.cancel();
unregisterReceiver(this);
sms.sendTextMessage("07927278978", null, "!blamail Notification from blamail: \"" + message + "\" was not delivered to " + phoneNumber, null, null);
break;
}
}
}, new IntentFilter(DELIVERED));
-
- sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
+
+ sms.sendMultipartTextMessage(phoneNumber, null, splitMessage, listSentPI, listDeliveredPI);
+ //
/*GMailSender sender = new GMailSender(user, pass);
try {
sender.sendMail("SMS delivered: " + phoneNumber,