diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-08-21 12:32:50 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-08-21 12:32:50 +0200 |
commit | 4875b52f09eba8e32285e92372f076413d4f649f (patch) | |
tree | 8cb208ddc2c85998ca86baf214029dce13d2853b /src/eu/siacs/conversations/services | |
parent | 301477c764f4f23ff223f931b44179b5e09b5d0d (diff) |
make avatars persisent / available even without internet
Diffstat (limited to 'src/eu/siacs/conversations/services')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 593b1fd0..a6853f8a 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1218,7 +1218,9 @@ public class XmppConnectionService extends Service { @Override public void onIqPacketReceived(Account account, IqPacket result) { if (result.getType() == IqPacket.TYPE_RESULT) { - account.setAvatar(avatar.getFilename()); + if (account.setAvatar(avatar.getFilename())) { + databaseBackend.updateAccount(account); + } callback.success(avatar); } else { callback.error(R.string.error_publish_avatar_server_reject, avatar); @@ -1250,7 +1252,9 @@ public class XmppConnectionService extends Service { if (avatar.image!=null) { if (getFileBackend().save(avatar)) { if (account.getJid().equals(avatar.owner)) { - account.setAvatar(avatar.getFilename()); + if (account.setAvatar(avatar.getFilename())) { + databaseBackend.updateAccount(account); + } } else { Contact contact = account.getRoster().getContact(avatar.owner); contact.setAvatar(avatar.getFilename()); @@ -1283,7 +1287,9 @@ public class XmppConnectionService extends Service { if (avatar!=null) { avatar.owner = account.getJid(); if (fileBackend.isAvatarCached(avatar)) { - account.setAvatar(avatar.getFilename()); + if (account.setAvatar(avatar.getFilename())) { + databaseBackend.updateAccount(account); + } callback.success(avatar); } else { fetchAvatar(account, avatar,callback); |