]> iEval git - fonbot.git/commitdiff
Add SMSQ command that skips delivery reports
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 1 Sep 2014 20:47:33 +0000 (23:47 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 1 Sep 2014 20:47:33 +0000 (23:47 +0300)
res/values/strings.xml
src/ro/ieval/fonbot/Heavy.java
src/ro/ieval/fonbot/Utils.java

index 3d8258e048b8f97bc2c37f9f90ff10ebc6f6afe8..241682271371033f1a32fab005f7c524208ab194 100644 (file)
@@ -216,9 +216,14 @@ The help command can be used to get a list of commands and help for them. Exampl
     </string>
     <string name="sms_help">
         Usage: sms phone_number message\n
-               Sends an sms with text &lt;message&gt; to &lt;phone_number&gt;.\n
+               Sends an sms with text &lt;message&gt; to &lt;phone_number&gt;. This command requests a delivery report. If you do not want one, use the SMSQ command.\n
                Example: sms 0755555555 \"Test message\"
     </string>
+    <string name="smsq_help">
+        Usage: smsq phone_number message\n
+               Sends an sms with text &lt;message&gt; to &lt;phone_number&gt;. This command does not request a delivery report. If you want one, use the SMS command.\n
+               Example: smsq 0755555555 \"Test message\"
+    </string>
     <string name="setpassword_help">
         Usage: setpassword [password]\n
                With no argument, clears the device password.\n
index 8fa72677a31461728dbd49e0dd6e437634f11d8c..fcc5e4d40b9bbb54ab1fea6eeb6fb888864facdb 100644 (file)
@@ -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<String> 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);
        }
 
        /**
index e2e0dab2319ed86e085e98c52c91972ca8a8bcf7..37049c566a75fb4e2fdc8fc2299c9c78b29bc01f 100644 (file)
@@ -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:
This page took 0.033136 seconds and 4 git commands to generate.