diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-09-13 19:49:31 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-09-13 19:49:31 +0200 |
commit | a3d8450d9d551c59277614fd50cad1d7b910d649 (patch) | |
tree | 1de799adbe33bc53aafbc47e28e42ba317773914 /src/main/java | |
parent | de1e375e88aed14db0e23279d80377966128422b (diff) |
sync roster after setting pgp id
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Contact.java | 5 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/PresenceParser.java | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java index 6d07c5901..6edb14ada 100644 --- a/src/main/java/de/pixart/messenger/entities/Contact.java +++ b/src/main/java/de/pixart/messenger/entities/Contact.java @@ -360,13 +360,16 @@ public class Contact implements ListItem, Blockable { } } - public void setPgpKeyId(long keyId) { + public boolean setPgpKeyId(long keyId) { + final long previousKeyId = getPgpKeyId(); synchronized (this.keys) { try { this.keys.put("pgp_keyid", keyId); + return previousKeyId != keyId; } catch (final JSONException ignored) { } } + return false; } public void setOption(int option) { diff --git a/src/main/java/de/pixart/messenger/parser/PresenceParser.java b/src/main/java/de/pixart/messenger/parser/PresenceParser.java index 4d0bf812f..39a3cfeba 100644 --- a/src/main/java/de/pixart/messenger/parser/PresenceParser.java +++ b/src/main/java/de/pixart/messenger/parser/PresenceParser.java @@ -306,7 +306,9 @@ public class PresenceParser extends AbstractParser implements if (pgp != null && x != null) { Element status = packet.findChild("status"); String msg = status != null ? status.getContent() : ""; - contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent())); + if (contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent()))) { + mXmppConnectionService.syncRoster(account); + } } boolean online = sizeBefore < contact.getPresences().size(); mXmppConnectionService.onContactStatusChanged.onContactStatusChanged(contact, online); |