diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-20 23:57:29 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-20 23:57:29 +0200 |
commit | c75fbc7e57ec0ad5085a111c51c70926ef590ba7 (patch) | |
tree | a349fcca4847f557663e2fa45c186312452c787b /src/main/java | |
parent | 346b272bac84d7e77f918230a98bb2c46a472ded (diff) |
improved logging for messages waiting for join
Diffstat (limited to 'src/main/java')
3 files changed, 25 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index fca50d3ec..444bcf717 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -1496,7 +1496,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/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 3d9b5d881..a8d568d71 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -919,9 +919,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); updateReadMarker(account, from, id, selfAddressed, counterpart, query); } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index dded48c0a..55ad48954 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -33,16 +33,17 @@ import android.os.Vibrator; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.security.KeyChain; -import androidx.annotation.BoolRes; -import androidx.annotation.IntegerRes; -import androidx.core.app.RemoteInput; -import androidx.core.content.ContextCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.LruCache; import android.util.Pair; +import androidx.annotation.BoolRes; +import androidx.annotation.IntegerRes; +import androidx.core.app.RemoteInput; +import androidx.core.content.ContextCompat; + import net.java.otr4j.OtrException; import net.java.otr4j.session.Session; import net.java.otr4j.session.SessionID; @@ -1586,10 +1587,7 @@ public class XmppConnectionService extends Service { message1 -> markMessage(message1, Message.STATUS_SEND_FAILED)); } - 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()) { @@ -1746,6 +1744,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)); } |