diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index f861b23e0..9f28acdfb 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -102,6 +102,22 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } } + public boolean isCatchingUp(Conversation conversation) { + final Account account = conversation.getAccount(); + if (account.getXmppConnection().isWaitingForSmCatchup()) { + return true; + } else { + synchronized (this.queries) { + for(Query query : this.queries) { + if (query.getAccount() == account && query.isCatchup() && ((conversation.getMode() == Conversation.MODE_SINGLE && query.getWith() == null) || query.getConversation() == conversation)) { + return true; + } + } + } + return false; + } + } + public Query query(final Conversation conversation, long end, boolean allowCatchup) { return this.query(conversation,conversation.getLastMessageTransmitted(),end, allowCatchup); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index adb097c0d..d1f6cf192 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1275,9 +1275,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa action = SendButtonAction.TEXT; } } - if (activity.useSendButtonToIndicateStatus() && c != null - && c.getAccount().getStatus() == Account.State.ONLINE) { - if (c.getMode() == Conversation.MODE_SINGLE) { + if (activity.useSendButtonToIndicateStatus() && c.getAccount().getStatus() == Account.State.ONLINE) { + if (activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) { + status = Presence.Status.OFFLINE; + } else if (c.getMode() == Conversation.MODE_SINGLE) { status = c.getContact().getShownStatus(); } else { status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE;