]> iEval git - fonbot.git/blobdiff - src/ro/ieval/fonbot/Utils.java
Convert everything to HTTPS
[fonbot.git] / src / ro / ieval / fonbot / Utils.java
index d9060eb662734475026200ef84587260ef931794..c6993562b049eca70ea8d2884ba4c7c02cdd5932 100644 (file)
@@ -316,8 +316,8 @@ public final class Utils {
        public static void sendMessage(final Context context, final Address address, final String message){
                switch(address.protocol){
                case HTTP:
-                       new SendHttpMessageAsyncTask("/send", toNonNull(Arrays.asList(
-                                       new Header("X-Destination", toNonNull(address.data)))), context).execute(message);
+                       new HttpCallExecutableRunnable("/send", toNonNull(Arrays.asList(
+                                       new Header("X-Destination", toNonNull(address.data)))), context, null, message).execute();
                        break;
 
                case SMS:
@@ -419,12 +419,21 @@ public final class Utils {
         * @throws MalformedURLException if the user preferences create an invalid URL
         */
        public static URL getServerURL(final Context context, final String path) throws MalformedURLException{
-               final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "ieval.ro");
+               final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "fonbot.ieval.ro");
                final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "7777"));
-               final URL url=new URL("http", hostname, port, path);
+               final URL url=new URL("https", hostname, port, path);
                return url;
        }
 
+       /**
+        * Poll the server for pending commands.
+        *
+        * @param context Context instance
+        */
+       public static void pollServer(final Context context){
+               new HttpCallExecutableRunnable("/get", null, context, new PollResultCallback(context)).execute();
+       }
+
        /**
         * Executes a given command
         *
This page took 0.023952 seconds and 4 git commands to generate.