Do not connect to server when user/pass is missing master
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 8 Oct 2014 06:55:09 +0000 (09:55 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 8 Oct 2014 06:55:09 +0000 (09:55 +0300)
src/ro/ieval/fonbot/FonBotMainService.java

index 9fb714533ea02b47b126e3b93a64e3aac2ce498d..5508557d749fcc5699312dbc54e2e1144710acf0 100644 (file)
@@ -206,7 +206,10 @@ public final class FonBotMainService extends Service {
                        Utils.processCommand(this, toNonNull(words[0]), args, toNonNull(address));
                }
 
-               if(longPollThread == null || !longPollThread.isAlive()){
+               final String user=PreferenceManager.getDefaultSharedPreferences(this).getString("username", null);
+               final String password=PreferenceManager.getDefaultSharedPreferences(this).getString("password", null);
+               final boolean has_user_pass = user != null && password != null && user.length() > 0 && password.length() > 0;
+               if((longPollThread == null || !longPollThread.isAlive()) && has_user_pass){
                        longPollThread = new Thread(new LongPollRunnable());
                        longPollThread.start();
                }
This page took 0.010438 seconds and 4 git commands to generate.