From abe01f18f2705ce1ee2678ffdd9999ed2e54cb35 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 19 Sep 2019 10:00:50 +0200 Subject: [PATCH] improved logging for messages waiting for join --- build.gradle | 4 ++-- .../crypto/axolotl/AxolotlService.java | 2 +- .../conversations/parser/MessageParser.java | 3 +-- .../services/XmppConnectionService.java | 23 +++++++++++++++---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 6f3272c54..e24b05d42 100644 --- a/build.gradle +++ b/build.gradle @@ -66,8 +66,8 @@ dependencies { implementation 'org.conscrypt:conscrypt-android:2.1.0' implementation 'me.drakeet.support:toastcompat:1.1.0' implementation "com.leinardi.android:speed-dial:2.0.1" - implementation 'com.squareup.retrofit2:retrofit:2.6.0' - implementation 'com.squareup.retrofit2:converter-gson:2.6.0' + implementation 'com.squareup.retrofit2:retrofit:2.6.1' + implementation 'com.squareup.retrofit2:converter-gson:2.6.1' implementation 'com.google.guava:guava:27.1-android' quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.10.1' } diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index e44e5dcd2..b804f4222 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -1484,7 +1484,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { while (iterator.hasNext()) { final XmppAxolotlSession session = iterator.next(); if (trustedOrPreviouslyResponded(session)) { - completeSession(iterator.next()); + completeSession(session); } iterator.remove(); } diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 972ce4195..fba10bd72 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -803,9 +803,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece mXmppConnectionService.markRead(conversation); } } else if (!counterpart.isBareJid() && trueJid != null) { - ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid); + final ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid); if (message.addReadByMarker(readByMarker)) { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'"); mXmppConnectionService.updateMessage(message, false); } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5024a9613..68db573a9 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1383,10 +1383,8 @@ public class XmppConnectionService extends Service { } } - final boolean inProgressJoin; - synchronized (account.inProgressConferenceJoins) { - inProgressJoin = conversation.getMode() == Conversational.MODE_MULTI && (account.inProgressConferenceJoins.contains(conversation) || account.pendingConferenceJoins.contains(conversation)); - } + final boolean inProgressJoin = isJoinInProgress(conversation); + if (account.isOnlineAndConnected() && !inProgressJoin) { switch (message.getEncryption()) { @@ -1516,6 +1514,23 @@ public class XmppConnectionService extends Service { } } + private boolean isJoinInProgress(final Conversation conversation) { + final Account account = conversation.getAccount(); + synchronized (account.inProgressConferenceJoins) { + if (conversation.getMode() == Conversational.MODE_MULTI) { + final boolean inProgress = account.inProgressConferenceJoins.contains(conversation); + final boolean pending = account.pendingConferenceJoins.contains(conversation); + final boolean inProgressJoin = inProgress || pending; + if (inProgressJoin) { + Log.d(Config.LOGTAG,account.getJid().asBareJid()+": holding back message to group. inProgress="+inProgress+", pending="+pending); + } + return inProgressJoin; + } else { + return false; + } + } + } + private void sendUnsentMessages(final Conversation conversation) { conversation.findWaitingMessages(message -> resendMessage(message, true)); }