aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-09-07 14:34:58 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-09-07 14:34:58 +0200
commit416481bb656c5fc73d0500b09a0c4ec62590dc00 (patch)
treef41eaa6d6b17ac4fcd647e459562feaeb28c2471 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
parente1d2c32e63d6f2276b56600945569dede3e34890 (diff)
be a bit more careful when deleting and deactivating accounts
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 337c0b4d..2fb33bb6 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1642,12 +1642,17 @@ public class XmppConnectionService extends Service {
}
}
- public void updateAccount(final Account account) {
- this.statusListener.onStatusChanged(account);
- databaseBackend.updateAccount(account);
- reconnectAccountInBackground(account);
- updateAccountUi();
- getNotificationService().updateErrorNotification();
+ public boolean updateAccount(final Account account) {
+ if (databaseBackend.updateAccount(account)) {
+ this.statusListener.onStatusChanged(account);
+ databaseBackend.updateAccount(account);
+ reconnectAccountInBackground(account);
+ updateAccountUi();
+ getNotificationService().updateErrorNotification();
+ return true;
+ } else {
+ return false;
+ }
}
public void updateAccountPasswordOnServer(final Account account, final String newPassword, final OnAccountPasswordChanged callback) {
@@ -1685,12 +1690,14 @@ public class XmppConnectionService extends Service {
public void run() {
disconnect(account, true);
}
- });
+ }).start();
}
Runnable runnable = new Runnable() {
@Override
public void run() {
- databaseBackend.deleteAccount(account);
+ if (!databaseBackend.deleteAccount(account)) {
+ Log.d(Config.LOGTAG,account.getJid().toBareJid()+": unable to delete account");
+ }
}
};
mDatabaseExecutor.execute(runnable);
@@ -3240,7 +3247,8 @@ public class XmppConnectionService extends Service {
}
}
- public void sendOfflinePresence(final Account account) {
+ private void sendOfflinePresence(final Account account) {
+ Log.d(Config.LOGTAG,account.getJid().toBareJid()+": sending offline presence");
sendPresencePacket(account, mPresenceGenerator.sendOfflinePresence(account));
}