4
0
mirror of https://github.com/cwinfo/envayasms.git synced 2025-07-01 12:56:17 +00:00

use string status codes instead of integers

This commit is contained in:
Jesse Young
2011-09-12 17:37:37 -07:00
parent cb8d95ebd5
commit aff22e51d8
4 changed files with 31 additions and 20 deletions

View File

@ -31,9 +31,9 @@ public class App {
public static final String ACTION_SEND_STATUS = "send_status";
public static final String ACTION_TEST = "test";
public static final int STATUS_QUEUED = 1;
public static final int STATUS_FAILED = 2;
public static final int STATUS_SENT = 3;
public static final String STATUS_QUEUED = "queued";
public static final String STATUS_FAILED = "failed";
public static final String STATUS_SENT = "sent";
public static final String LOG_NAME = "KALSMS";
public static final String LOG_INTENT = "org.envaya.kalsms.LOG";

View File

@ -15,20 +15,20 @@ public class MessageStatusNotifier extends BroadcastReceiver {
private App app;
public void notifyStatus(String serverId, int status, String errorMessage)
public void notifyStatus(String serverId, String status, String errorMessage)
{
String logMessage;
switch (status)
if (status.equals(App.STATUS_SENT))
{
case App.STATUS_SENT:
logMessage = "sent successfully";
break;
case App.STATUS_FAILED:
logMessage = "could not be sent (" + errorMessage + ")";
break;
default:
logMessage = "queued";
break;
logMessage = "sent successfully";
}
else if (status.equals(App.STATUS_FAILED))
{
logMessage = "could not be sent (" + errorMessage + ")";
}
else
{
logMessage = "queued";
}
String smsDesc = serverId == null ? "SMS reply" : ("SMS id=" + serverId);
@ -37,9 +37,8 @@ public class MessageStatusNotifier extends BroadcastReceiver {
app.log("Notifying server " + smsDesc + " " + logMessage);
new HttpTask(app).execute(
new BasicNameValuePair("from", app.getPhoneNumber()),
new BasicNameValuePair("id", serverId),
new BasicNameValuePair("status", "" + status),
new BasicNameValuePair("status", status),
new BasicNameValuePair("error", errorMessage),
new BasicNameValuePair("action", App.ACTION_SEND_STATUS)
);