From 46c0afcb1fa2b4688dbb250e9d56e0913a681772 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 8 Oct 2014 09:55:09 +0300 Subject: [PATCH] Do not connect to server when user/pass is missing --- src/ro/ieval/fonbot/FonBotMainService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); } -- 2.39.2