From 4142360189a66efee8561fcbbef0963bce104348 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 31 Aug 2019 15:20:44 +0200 Subject: make config flag for leave before join --- src/main/java/de/pixart/messenger/Config.java | 1 + .../java/de/pixart/messenger/services/XmppConnectionService.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index ccfc3e834..d6063ab19 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -130,6 +130,7 @@ public final class Config { public static final boolean ONLY_INTERNAL_STORAGE = false; //use internal storage instead of sdcard to save attachments public static final boolean IGNORE_ID_REWRITE_IN_MUC = true; + public static final boolean MUC_LEAVE_BEFORE_JOIN = true; public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY * 5; public static final int MAM_MAX_MESSAGES = 750; diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index bb7162bb3..5028fea28 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1581,7 +1581,7 @@ public class XmppConnectionService extends Service { final boolean inProgressJoin; synchronized (account.inProgressConferenceJoins) { - inProgressJoin = conversation.getMode() == Conversational.MODE_MULTI && account.inProgressConferenceJoins.contains(conversation); + inProgressJoin = conversation.getMode() == Conversational.MODE_MULTI && (account.inProgressConferenceJoins.contains(conversation) || account.pendingConferenceJoins.contains(conversation)); } if (account.isOnlineAndConnected() && !inProgressJoin) { @@ -2819,7 +2819,9 @@ public class XmppConnectionService extends Service { synchronized (account.inProgressConferenceJoins) { account.inProgressConferenceJoins.add(conversation); } - sendPresencePacket(account, mPresenceGenerator.leave(conversation.getMucOptions())); + if (Config.MUC_LEAVE_BEFORE_JOIN) { + sendPresencePacket(account, mPresenceGenerator.leave(conversation.getMucOptions())); + } conversation.resetMucOptions(); if (onConferenceJoined != null) { conversation.getMucOptions().flagNoAutoPushConfiguration(); -- cgit v1.2.3