mirror of
https://github.com/cwinfo/envayasms.git
synced 2024-12-04 20:45:32 +00:00
don't request delivery reports but leave option open in future; fix bug with encoding of apostrophe by php library
This commit is contained in:
parent
03d5f556d7
commit
faffc6c568
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.envaya.sms"
|
package="org.envaya.sms"
|
||||||
android:versionCode="9"
|
android:versionCode="10"
|
||||||
android:versionName="2.0-beta7">
|
android:versionName="2.0-beta8">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="4" />
|
<uses-sdk android:minSdkVersion="4" />
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class EnvayaSMS
|
|||||||
|
|
||||||
static function escape($val)
|
static function escape($val)
|
||||||
{
|
{
|
||||||
return htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
|
return htmlspecialchars($val, ENT_COMPAT | ENT_XML1, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static $request;
|
private static $request;
|
||||||
@ -123,8 +123,8 @@ class EnvayaSMS_Request
|
|||||||
echo "<messages>";
|
echo "<messages>";
|
||||||
foreach ($messages as $message)
|
foreach ($messages as $message)
|
||||||
{
|
{
|
||||||
$id = isset($message->id) ? " id='".EnvayaSMS::escape($message->id)."'" : "";
|
$id = isset($message->id) ? " id=\"".EnvayaSMS::escape($message->id)."\"" : "";
|
||||||
$to = isset($message->to) ? " to='".EnvayaSMS::escape($message->to)."'" : "";
|
$to = isset($message->to) ? " to=\"".EnvayaSMS::escape($message->to)."\"" : "";
|
||||||
echo "<sms$id$to>".EnvayaSMS::escape($message->message)."</sms>";
|
echo "<sms$id$to>".EnvayaSMS::escape($message->message)."</sms>";
|
||||||
}
|
}
|
||||||
echo "</messages>";
|
echo "</messages>";
|
||||||
|
@ -68,12 +68,13 @@ public final class App extends Application {
|
|||||||
public static final String OUTGOING_SMS_INTENT_SUFFIX = ".OUTGOING_SMS";
|
public static final String OUTGOING_SMS_INTENT_SUFFIX = ".OUTGOING_SMS";
|
||||||
public static final String OUTGOING_SMS_EXTRA_TO = "to";
|
public static final String OUTGOING_SMS_EXTRA_TO = "to";
|
||||||
public static final String OUTGOING_SMS_EXTRA_BODY = "body";
|
public static final String OUTGOING_SMS_EXTRA_BODY = "body";
|
||||||
|
public static final String OUTGOING_SMS_EXTRA_DELIVERY_REPORT = "delivery";
|
||||||
public static final int OUTGOING_SMS_UNHANDLED = Activity.RESULT_FIRST_USER;
|
public static final int OUTGOING_SMS_UNHANDLED = Activity.RESULT_FIRST_USER;
|
||||||
|
|
||||||
// intent for MessageStatusNotifier to receive status updates for outgoing SMS
|
// intent for MessageStatusNotifier to receive status updates for outgoing SMS
|
||||||
// (even if sent by an expansion pack)
|
// (even if sent by an expansion pack)
|
||||||
public static final String MESSAGE_STATUS_INTENT = "org.envaya.sms.MESSAGE_STATUS";
|
public static final String MESSAGE_STATUS_INTENT = "org.envaya.sms.MESSAGE_STATUS";
|
||||||
public static final String MESSAGE_DELIVERY_INTENT = "org.envaya.sms.MESSAGE_DELIVERY";
|
public static final String MESSAGE_DELIVERY_INTENT = "org.envaya.sms.MESSAGE_DELIVERY";
|
||||||
|
|
||||||
public static final String STATUS_EXTRA_INDEX = "status";
|
public static final String STATUS_EXTRA_INDEX = "status";
|
||||||
public static final String STATUS_EXTRA_NUM_PARTS = "num_parts";
|
public static final String STATUS_EXTRA_NUM_PARTS = "num_parts";
|
||||||
|
@ -4,6 +4,7 @@ package org.envaya.sms;
|
|||||||
import org.envaya.sms.receiver.OutgoingMessageRetry;
|
import org.envaya.sms.receiver.OutgoingMessageRetry;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.telephony.SmsManager;
|
import android.telephony.SmsManager;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ public class OutgoingMessage extends QueuedMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(packageName + App.OUTGOING_SMS_INTENT_SUFFIX, this.getUri());
|
Intent intent = new Intent(packageName + App.OUTGOING_SMS_INTENT_SUFFIX, this.getUri());
|
||||||
|
intent.putExtra(App.OUTGOING_SMS_EXTRA_DELIVERY_REPORT, false);
|
||||||
intent.putExtra(App.OUTGOING_SMS_EXTRA_TO, getTo());
|
intent.putExtra(App.OUTGOING_SMS_EXTRA_TO, getTo());
|
||||||
intent.putExtra(App.OUTGOING_SMS_EXTRA_BODY, bodyParts);
|
intent.putExtra(App.OUTGOING_SMS_EXTRA_BODY, bodyParts);
|
||||||
|
|
||||||
|
@ -16,11 +16,17 @@ public class OutgoingSmsReceiver extends BroadcastReceiver {
|
|||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
String to = extras.getString(App.OUTGOING_SMS_EXTRA_TO);
|
String to = extras.getString(App.OUTGOING_SMS_EXTRA_TO);
|
||||||
ArrayList<String> bodyParts = extras.getStringArrayList(App.OUTGOING_SMS_EXTRA_BODY);
|
ArrayList<String> bodyParts = extras.getStringArrayList(App.OUTGOING_SMS_EXTRA_BODY);
|
||||||
|
boolean deliveryReport = extras.getBoolean(App.OUTGOING_SMS_EXTRA_DELIVERY_REPORT, false);
|
||||||
|
|
||||||
SmsManager smgr = SmsManager.getDefault();
|
SmsManager smgr = SmsManager.getDefault();
|
||||||
|
|
||||||
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
|
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
|
||||||
ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();
|
ArrayList<PendingIntent> deliveryIntents = null;
|
||||||
|
|
||||||
|
if (deliveryReport)
|
||||||
|
{
|
||||||
|
deliveryIntents = new ArrayList<PendingIntent>();
|
||||||
|
}
|
||||||
|
|
||||||
int numParts = bodyParts.size();
|
int numParts = bodyParts.size();
|
||||||
|
|
||||||
@ -36,15 +42,18 @@ public class OutgoingSmsReceiver extends BroadcastReceiver {
|
|||||||
statusIntent,
|
statusIntent,
|
||||||
PendingIntent.FLAG_ONE_SHOT));
|
PendingIntent.FLAG_ONE_SHOT));
|
||||||
|
|
||||||
Intent deliveryIntent = new Intent(App.MESSAGE_DELIVERY_INTENT, intent.getData());
|
if (deliveryReport)
|
||||||
deliveryIntent.putExtra(App.STATUS_EXTRA_INDEX, i);
|
{
|
||||||
deliveryIntent.putExtra(App.STATUS_EXTRA_NUM_PARTS, numParts);
|
Intent deliveryIntent = new Intent(App.MESSAGE_DELIVERY_INTENT, intent.getData());
|
||||||
|
deliveryIntent.putExtra(App.STATUS_EXTRA_INDEX, i);
|
||||||
deliveryIntents.add(PendingIntent.getBroadcast(
|
deliveryIntent.putExtra(App.STATUS_EXTRA_NUM_PARTS, numParts);
|
||||||
context,
|
|
||||||
0,
|
deliveryIntents.add(PendingIntent.getBroadcast(
|
||||||
deliveryIntent,
|
context,
|
||||||
PendingIntent.FLAG_ONE_SHOT));
|
0,
|
||||||
|
deliveryIntent,
|
||||||
|
PendingIntent.FLAG_ONE_SHOT));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
smgr.sendMultipartTextMessage(to, null, bodyParts, sentIntents, deliveryIntents);
|
smgr.sendMultipartTextMessage(to, null, bodyParts, sentIntents, deliveryIntents);
|
||||||
|
Loading…
Reference in New Issue
Block a user