From 44833c1499caf41e6433d76a90fa42ab60a5dec1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 27 May 2016 10:35:00 +0200 Subject: [PATCH] don't push default muc conf twice --- .../eu/siacs/conversations/entities/MucOptions.java | 10 ++++++++++ .../eu/siacs/conversations/parser/PresenceParser.java | 2 +- .../conversations/services/XmppConnectionService.java | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 68c1fb508..d08483703 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -18,6 +18,8 @@ import eu.siacs.conversations.xmpp.pep.Avatar; @SuppressLint("DefaultLocale") public class MucOptions { + private boolean mAutoPushConfiguration = true; + public Account getAccount() { return this.conversation.getAccount(); } @@ -39,6 +41,14 @@ public class MucOptions { } } + public void flagNoAutoPushConfiguration() { + mAutoPushConfiguration = false; + } + + public boolean autoPushConfiguration() { + return mAutoPushConfiguration; + } + public enum Affiliation { OWNER("owner", 4, R.string.owner), ADMIN("admin", 3, R.string.admin), diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index edcd986ed..b5718b612 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -78,7 +78,7 @@ public class PresenceParser extends AbstractParser implements } else { mucOptions.addUser(user); } - if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED)) { + if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) { Log.d(Config.LOGTAG,mucOptions.getAccount().getJid().toBareJid() +": room '" +mucOptions.getConversation().getJid().toBareJid() diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index c05b78aa0..b88ee7af2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1832,6 +1832,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa account.pendingConferenceLeaves.remove(conversation); if (account.getStatus() == Account.State.ONLINE) { conversation.resetMucOptions(); + if (onConferenceJoined != null) { + conversation.getMucOptions().flagNoAutoPushConfiguration(); + } conversation.setHasMessagesLeftOnServer(false); fetchConferenceConfiguration(conversation, new OnConferenceConfigurationFetched() {