From: Marius Gavrilescu Date: Wed, 8 Oct 2014 06:55:09 +0000 (+0300) Subject: Do not connect to server when user/pass is missing X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=fonbot.git Do not connect to server when user/pass is missing --- diff --git a/src/ro/ieval/fonbot/FonBotMainService.java b/src/ro/ieval/fonbot/FonBotMainService.java index 9fb7145..5508557 100644 --- a/src/ro/ieval/fonbot/FonBotMainService.java +++ b/src/ro/ieval/fonbot/FonBotMainService.java @@ -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(); }