aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-12-25 22:08:13 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-12-25 22:08:13 +0100
commit0c22a8d1c6a984ccd0080d74a07d500879ee8242 (patch)
tree7b9da3710baa83ba11baf2fe110e61e767912f26 /src/main/java/eu/siacs/conversations/services
parente4d9dca2fe6a75960d24f8af4dadba9a1a42845c (diff)
added callback to change account password to notify UI on success / failure
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 640074ba6..dc895e5b6 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1100,19 +1100,25 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
getNotificationService().updateErrorNotification();
}
- public void updateAccountPasswordOnServer(final Account account, final String newPassword) {
- if (account.isOnlineAndConnected()) {
- final IqPacket iq = getIqGenerator().generateSetPassword(account, newPassword);
- sendIqPacket(account, iq, new OnIqPacketReceived() {
- @Override
- public void onIqPacketReceived(final Account account, final IqPacket packet) {
- if (packet.getType() == IqPacket.TYPE_RESULT) {
- account.setPassword(newPassword);
- updateAccount(account);
- }
+ public void updateAccountPasswordOnServer(final Account account, final String newPassword, final OnAccountPasswordChanged callback) {
+ final IqPacket iq = getIqGenerator().generateSetPassword(account, newPassword);
+ sendIqPacket(account, iq, new OnIqPacketReceived() {
+ @Override
+ public void onIqPacketReceived(final Account account, final IqPacket packet) {
+ if (packet.getType() == IqPacket.TYPE_RESULT) {
+ account.setPassword(newPassword);
+ databaseBackend.updateAccount(account);
+ callback.onPasswordChangeSucceeded();
+ } else {
+ callback.onPasswordChangeFailed();
}
- });
- }
+ }
+ });
+ }
+
+ public interface OnAccountPasswordChanged {
+ public void onPasswordChangeSucceeded();
+ public void onPasswordChangeFailed();
}
public void deleteAccount(final Account account) {