From 9645668991d7052f71a2974553c476a02126de00 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Mon, 1 Sep 2014 23:47:33 +0300 Subject: [PATCH] Add SMSQ command that skips delivery reports --- res/values/strings.xml | 7 ++++++- src/ro/ieval/fonbot/Heavy.java | 7 +++++-- src/ro/ieval/fonbot/Utils.java | 12 ++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3d8258e..2416822 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -216,9 +216,14 @@ The help command can be used to get a list of commands and help for them. Exampl Usage: sms phone_number message\n - Sends an sms with text <message> to <phone_number>.\n + Sends an sms with text <message> to <phone_number>. This command requests a delivery report. If you do not want one, use the SMSQ command.\n Example: sms 0755555555 \"Test message\" + + Usage: smsq phone_number message\n + Sends an sms with text <message> to <phone_number>. This command does not request a delivery report. If you want one, use the SMS command.\n + Example: smsq 0755555555 \"Test message\" + Usage: setpassword [password]\n With no argument, clears the device password.\n diff --git a/src/ro/ieval/fonbot/Heavy.java b/src/ro/ieval/fonbot/Heavy.java index 8fa7267..fcc5e4d 100644 --- a/src/ro/ieval/fonbot/Heavy.java +++ b/src/ro/ieval/fonbot/Heavy.java @@ -634,6 +634,9 @@ final class Heavy { case SMS: Utils.sendMessage(context, replyTo, sms_help); break; + case SMSQ: + Utils.sendMessage(context, replyTo, smsq_help); + break; case SMSLOG: Utils.sendMessage(context, replyTo, smslog_help); break; @@ -1418,7 +1421,7 @@ final class Heavy { * @param destination destination phone number * @param text text message contents */ - public static void sms(final Context context, final Address replyTo, final String destination, final String text){ + public static void sms(final Context context, final Address replyTo, final String destination, final String text, final boolean quiet){ final SmsManager manager=SmsManager.getDefault(); final ArrayList messages=manager.divideMessage(text); if(messages.size() > 1) @@ -1453,7 +1456,7 @@ final class Heavy { } Log.d(Heavy.class.getName(), "Sending sms to "+destination); - manager.sendMultipartTextMessage(destination, null, messages, sents, delivereds); + manager.sendMultipartTextMessage(destination, null, messages, sents, quiet ? null : delivereds); } /** diff --git a/src/ro/ieval/fonbot/Utils.java b/src/ro/ieval/fonbot/Utils.java index e2e0dab..37049c5 100644 --- a/src/ro/ieval/fonbot/Utils.java +++ b/src/ro/ieval/fonbot/Utils.java @@ -59,7 +59,7 @@ public final class Utils { */ @SuppressWarnings("javadoc") public static enum Command{ - TOAST, ECHO, SMS, FLASH, WIFI, + TOAST, ECHO, SMS, SMSQ, FLASH, WIFI, BLUETOOTH, DIAL, RING, SPEAK, VIBRATE, DIALOG, LOCATION, NOLOCATION, RINGER, NCFILE, PHOTO, SETNOTIFICATION, DELNOTIFICATION, SETPASSWORD, HELP, @@ -447,7 +447,15 @@ public final class Utils { Heavy.help(context, replyTo, toNonNull(Command.SMS)); break; } - Heavy.sms(context, replyTo, toNonNull(args[0]), join(" ", 1, args)); + Heavy.sms(context, replyTo, toNonNull(args[0]), join(" ", 1, args), false); + break; + + case SMSQ: + if(args.length < 2){ + Heavy.help(context, replyTo, toNonNull(Command.SMSQ)); + break; + } + Heavy.sms(context, replyTo, toNonNull(args[0]), join(" ", 1, args), true); break; case FLASH: -- 2.39.2