X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=src%2Fro%2Fieval%2Ffonbot%2FUtils.java;h=8548404aa2b62ae1af196f02287313dfe459c1d1;hb=ca40a5cc0f95f37d2ac3008d5fa3f0adaf47d736;hp=79ff2e1e37236de3b571e246f434415827527ed0;hpb=72de2947b5234e3b8495065e358530d9fddf3fb8;p=fonbot.git diff --git a/src/ro/ieval/fonbot/Utils.java b/src/ro/ieval/fonbot/Utils.java index 79ff2e1..8548404 100644 --- a/src/ro/ieval/fonbot/Utils.java +++ b/src/ro/ieval/fonbot/Utils.java @@ -184,9 +184,7 @@ public final class Utils { /** Location tracking is active. Registered by {@link Command#LOCATION}, unregistered by {@link Command#NOLOCATION} */ LOCATION(location_tracking_is_active), /** The phone is ringing. Registered/unregistered by {@link Command#RING} */ - RING(ringing), - /** The polling alarm is on. Registered/unregistered by {@link Command#POLL} */ - POLL(the_polling_service_is_running); + RING(ringing); /** String resource: the event description */ public final int resource; @@ -409,29 +407,10 @@ public final class Utils { public static URL getServerURL(final Context context, final String path) throws MalformedURLException{ final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "fonbot.ieval.ro"); final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "443")); - final URL url=new URL("https", hostname, port, path); + final URL url=new URL("http", hostname, port, path); return url; } - /** - * 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), 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 * @@ -907,25 +886,7 @@ public final class Utils { break; case POLL: - if(args.length>1){ - Heavy.help(context, replyTo, toNonNull(Command.POLL)); - break; - } - - if(args.length==0){ - Heavy.poll(context, replyTo); - break; - } - - final long interval; - try{ - interval=Long.parseLong(args[0]); - } catch(NumberFormatException e){ - sendMessage(context, replyTo, cannot_parse_interval); - break; - } - - Heavy.poll(context, replyTo, interval); + Heavy.poll(context, replyTo); break; case HANGUP: