Change summary
src/main/java/eu/siacs/conversations/entities/Contact.java | 5 ++
src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 4 +
2 files changed, 7 insertions(+), 2 deletions(-)
Detailed changes
@@ -312,13 +312,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) {
@@ -311,7 +311,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);