improved logging for messages waiting for join

This commit is contained in:
Daniel Gultsch 2019-09-19 10:00:50 +02:00
parent af74c3604c
commit abe01f18f2
4 changed files with 23 additions and 9 deletions

View file

@ -66,8 +66,8 @@ dependencies {
implementation 'org.conscrypt:conscrypt-android:2.1.0' implementation 'org.conscrypt:conscrypt-android:2.1.0'
implementation 'me.drakeet.support:toastcompat:1.1.0' implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation "com.leinardi.android:speed-dial:2.0.1" implementation "com.leinardi.android:speed-dial:2.0.1"
implementation 'com.squareup.retrofit2:retrofit:2.6.0' implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0' implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.google.guava:guava:27.1-android' implementation 'com.google.guava:guava:27.1-android'
quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.10.1' quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.10.1'
} }

View file

@ -1484,7 +1484,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
while (iterator.hasNext()) { while (iterator.hasNext()) {
final XmppAxolotlSession session = iterator.next(); final XmppAxolotlSession session = iterator.next();
if (trustedOrPreviouslyResponded(session)) { if (trustedOrPreviouslyResponded(session)) {
completeSession(iterator.next()); completeSession(session);
} }
iterator.remove(); iterator.remove();
} }

View file

@ -803,9 +803,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
mXmppConnectionService.markRead(conversation); mXmppConnectionService.markRead(conversation);
} }
} else if (!counterpart.isBareJid() && trueJid != null) { } else if (!counterpart.isBareJid() && trueJid != null) {
ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid); final ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid);
if (message.addReadByMarker(readByMarker)) { if (message.addReadByMarker(readByMarker)) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'");
mXmppConnectionService.updateMessage(message, false); mXmppConnectionService.updateMessage(message, false);
} }
} }

View file

@ -1383,10 +1383,8 @@ public class XmppConnectionService extends Service {
} }
} }
final boolean inProgressJoin; final boolean inProgressJoin = isJoinInProgress(conversation);
synchronized (account.inProgressConferenceJoins) {
inProgressJoin = conversation.getMode() == Conversational.MODE_MULTI && (account.inProgressConferenceJoins.contains(conversation) || account.pendingConferenceJoins.contains(conversation));
}
if (account.isOnlineAndConnected() && !inProgressJoin) { if (account.isOnlineAndConnected() && !inProgressJoin) {
switch (message.getEncryption()) { 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) { private void sendUnsentMessages(final Conversation conversation) {
conversation.findWaitingMessages(message -> resendMessage(message, true)); conversation.findWaitingMessages(message -> resendMessage(message, true));
} }