fixed bug with disabling accounts
This commit is contained in:
parent
838270432f
commit
11a8a747e3
|
@ -292,7 +292,7 @@ public class XmppConnectionService extends Service {
|
||||||
// TODO: ask user to handle it maybe
|
// TODO: ask user to handle it maybe
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOGTAG, packet.toString());
|
//Log.d(LOGTAG, packet.toString());
|
||||||
}
|
}
|
||||||
replaceContactInConversation(contact.getJid(), contact);
|
replaceContactInConversation(contact.getJid(), contact);
|
||||||
}
|
}
|
||||||
|
@ -414,9 +414,15 @@ public class XmppConnectionService extends Service {
|
||||||
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
||||||
if (!isConnected) {
|
if (!isConnected) {
|
||||||
account.setStatus(Account.STATUS_NO_INTERNET);
|
account.setStatus(Account.STATUS_NO_INTERNET);
|
||||||
|
if (statusListener!=null) {
|
||||||
|
statusListener.onStatusChanged(account);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (account.getStatus() == Account.STATUS_NO_INTERNET) {
|
if (account.getStatus() == Account.STATUS_NO_INTERNET) {
|
||||||
account.setStatus(Account.STATUS_OFFLINE);
|
account.setStatus(Account.STATUS_OFFLINE);
|
||||||
|
if (statusListener!=null) {
|
||||||
|
statusListener.onStatusChanged(account);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 3 remaining cases
|
// TODO 3 remaining cases
|
||||||
|
@ -440,6 +446,7 @@ public class XmppConnectionService extends Service {
|
||||||
new Thread(account.getXmppConnection()).start();
|
new Thread(account.getXmppConnection()).start();
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOGTAG,account.getJid()+": status="+account.getStatus());
|
Log.d(LOGTAG,account.getJid()+": status="+account.getStatus());
|
||||||
|
// TODO notify user of ssl cert problem or auth problem or what ever
|
||||||
}
|
}
|
||||||
//in any case. reschedule wakup call
|
//in any case. reschedule wakup call
|
||||||
this.scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
this.scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
||||||
|
@ -1053,7 +1060,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect(final Account account, boolean blocking) {
|
public void disconnect(final Account account, boolean blocking) {
|
||||||
if (account.getStatus() == Account.STATUS_ONLINE) {
|
if ((account.getStatus() == Account.STATUS_ONLINE)||(account.getStatus() == Account.STATUS_DISABLED)) {
|
||||||
List<Conversation> conversations = getConversations();
|
List<Conversation> conversations = getConversations();
|
||||||
for (int i = 0; i < conversations.size(); i++) {
|
for (int i = 0; i < conversations.size(); i++) {
|
||||||
Conversation conversation = conversations.get(i);
|
Conversation conversation = conversations.get(i);
|
||||||
|
|
|
@ -48,7 +48,6 @@ public class ManageAccountActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccountListChangedListener() {
|
public void onAccountListChangedListener() {
|
||||||
Log.d("xmppService", "ui on account list changed listener");
|
|
||||||
accountList.clear();
|
accountList.clear();
|
||||||
accountList.addAll(xmppConnectionService.getAccounts());
|
accountList.addAll(xmppConnectionService.getAccounts());
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
|
Loading…
Reference in New Issue