sync roster after setting pgp id. fixes #2991

This commit is contained in:
Daniel Gultsch 2018-09-08 12:46:15 +02:00
parent 511335179f
commit 2d5bd539db
2 changed files with 7 additions and 2 deletions

View file

@ -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) {

View file

@ -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);