prefetch omemo device lists only if muc has omemo enabled

This commit is contained in:
Daniel Gultsch 2018-05-20 12:10:07 +02:00
parent 383b32c80d
commit 39e4b26ff0

View file

@ -2181,7 +2181,7 @@ public class XmppConnectionService extends Service {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
final boolean omemoEnabled = conversation.getNextEncryption() == Message.ENCRYPTION_AXOLOTL;
Element query = packet.query("http://jabber.org/protocol/muc#admin"); Element query = packet.query("http://jabber.org/protocol/muc#admin");
if (packet.getType() == IqPacket.TYPE.RESULT && query != null) { if (packet.getType() == IqPacket.TYPE.RESULT && query != null) {
for (Element child : query.getChildren()) { for (Element child : query.getChildren()) {
@ -2190,7 +2190,8 @@ public class XmppConnectionService extends Service {
if (!user.realJidMatchesAccount()) { if (!user.realJidMatchesAccount()) {
boolean isNew = conversation.getMucOptions().updateUser(user); boolean isNew = conversation.getMucOptions().updateUser(user);
Contact contact = user.getContact(); Contact contact = user.getContact();
if (isNew if (omemoEnabled
&& isNew
&& user.getRealJid() != null && user.getRealJid() != null
&& (contact == null || !contact.mutualPresenceSubscription()) && (contact == null || !contact.mutualPresenceSubscription())
&& axolotlService.hasEmptyDeviceList(user.getRealJid())) { && axolotlService.hasEmptyDeviceList(user.getRealJid())) {