5
0
mirror of https://github.com/cwinfo/envayasms.git synced 2024-11-08 09:50:26 +00:00

fix bug where outgoing sms would be cut off if they contain xml entities

This commit is contained in:
Jesse Young 2011-09-24 18:47:05 -07:00
parent 6384942c57
commit 986b50f0a8
6 changed files with 19 additions and 15 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.envaya.sms"
android:versionCode="7"
android:versionName="2.0-beta 5">
android:versionCode="8"
android:versionName="2.0-beta6">
<uses-sdk android:minSdkVersion="4" />

View File

@ -11,6 +11,8 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/help"
android:textSize="16sp"
android:autoLink="web"
android:textColor="#FFFFFF"
android:layout_margin="5px">
</TextView>

View File

@ -78,7 +78,9 @@ public final class App extends Application {
public static final String STATUS_EXTRA_NUM_PARTS = "num_parts";
public static final int MAX_DISPLAYED_LOG = 4000;
public static final int LOG_TIMESTAMP_INTERVAL = 60000;
public static final int LOG_TIMESTAMP_INTERVAL = 60000; // ms
public static final int HTTP_CONNECTION_TIMEOUT = 10000; // ms
// Each QueuedMessage is identified within our internal Map by its Uri.
// Currently QueuedMessage instances are only available within EnvayaSMS,
@ -690,8 +692,8 @@ public final class App extends Application {
public HttpParams getDefaultHttpParams()
{
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 8000);
HttpConnectionParams.setSoTimeout(httpParams, 8000);
HttpConnectionParams.setConnectionTimeout(httpParams, HTTP_CONNECTION_TIMEOUT);
HttpConnectionParams.setSoTimeout(httpParams, HTTP_CONNECTION_TIMEOUT);
HttpProtocolParams.setContentCharset(httpParams, "UTF-8");
return httpParams;
}

View File

@ -6,14 +6,11 @@ import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.envaya.sms.App;
import org.envaya.sms.IncomingMessage;
import org.envaya.sms.IncomingSms;
public class SmsReceiver extends BroadcastReceiver {
private App app;

View File

@ -20,17 +20,13 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.FormBodyPart;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.envaya.sms.App;
import org.envaya.sms.Base64Coder;
import org.envaya.sms.OutgoingMessage;
@ -202,8 +198,15 @@ public class HttpTask extends AsyncTask<String, Void, HttpResponse> {
sms.setServerId(serverId.equals("") ? null : serverId);
Node firstChild = smsElement.getFirstChild();
sms.setMessageBody(firstChild != null ? firstChild.getNodeValue(): "");
StringBuilder messageBody = new StringBuilder();
NodeList childNodes = smsElement.getChildNodes();
int numChildren = childNodes.getLength();
for (int j = 0; j < numChildren; j++)
{
messageBody.append(childNodes.item(j).getNodeValue());
}
sms.setMessageBody(messageBody.toString());
messages.add(sms);
}

View File

@ -23,7 +23,7 @@ public class Help extends Activity {
+ "EnvayaSMS is a SMS gateway.<br /><br /> "
+ "It forwards all incoming SMS messages received by this phone to a server on the internet, "
+ "and also sends outgoing SMS messages from that server to other phones.<br /><br />"
+ "See http://sms.envaya.org/ for more information.<br /><br />"
+ "See sms.envaya.org for more information.<br /><br />"
+ "The Settings screen allows you configure EnvayaSMS to work with a particular server, "
+ "by entering the server URL, your phone number, "
+ "and the password assigned to your phone on the server.<br /><br />"