]> iEval git - fonbot.git/blobdiff - src/ro/ieval/fonbot/Utils.java
Fix the notify command help
[fonbot.git] / src / ro / ieval / fonbot / Utils.java
index ddb506bfdbabe17d80e81b002742ad2604c5146b..5fd941048c8595e2c9783dab2d78ec1ae0070959 100644 (file)
@@ -317,7 +317,7 @@ public final class Utils {
                switch(address.protocol){
                case HTTP:
                        new HttpCallExecutableRunnable("/send", toNonNull(Arrays.asList(
-                                       new Header("X-Destination", toNonNull(address.data)))), context, null, message).execute();
+                                       new Header("X-Destination", toNonNull(address.data)))), context, null, true, message).execute();
                        break;
 
                case SMS:
@@ -411,14 +411,24 @@ public final class Utils {
        }
 
        /**
-        * Poll the server for pending commands.
+        * Poll the server for pending commands. This function must not be called from BroadcastReceivers
         *
         * @param context Context instance
         */
        public static void pollServer(final Context context){
-               new HttpCallExecutableRunnable("/get", null, context, new PollResultCallback(context)).execute();
+               new HttpCallExecutableRunnable("/get", null, context, new PollResultCallback(context), false).execute();
        }
 
+       /**
+        * Poll the server for pending commands from {@link FonBotMainService}. This function should be used from BroadcastReceviers instead of {@link #pollServer}
+        *
+        * @param context Context instance
+        */
+       public static void safePollServer(final Context context){
+               final Intent intent=new Intent(context, FonBotMainService.class);
+               intent.setAction(FonBotMainService.ACTION_TRIGGER_POLL);
+               context.startService(intent);
+       }
        /**
         * Executes a given command
         *
@@ -1000,6 +1010,7 @@ public final class Utils {
                case NOTIFY:
                        if(args.length!=1 && args.length!=3){
                                Heavy.help(context, replyTo, toNonNull(Command.NOTIFY));
+                               return;
                        }
 
                        final int id;
This page took 0.022292 seconds and 4 git commands to generate.