From 7b5d0e034e14b040d1697f32190d790f9f5ef091 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 2 Mar 2020 11:11:23 +0100 Subject: [PATCH] when setting moderated also set non standard field to not make users participants by default --- .../services/XmppConnectionService.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 4280e6f00..63d6a1911 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1838,7 +1838,7 @@ public class XmppConnectionService extends Service { private void markFileDeleted(final String path) { synchronized (FILENAMES_TO_IGNORE_DELETION) { if (FILENAMES_TO_IGNORE_DELETION.remove(path)) { - Log.d(Config.LOGTAG,"ignored deletion of "+path); + Log.d(Config.LOGTAG, "ignored deletion of " + path); return; } } @@ -1854,7 +1854,7 @@ public class XmppConnectionService extends Service { for (Conversation conversation : getConversations()) { deleted |= conversation.markAsDeleted(uuids); } - for(final String uuid : uuids) { + for (final String uuid : uuids) { evictPreview(uuid); } if (deleted) { @@ -3172,16 +3172,20 @@ public class XmppConnectionService extends Service { conversation.setAttribute("accept_non_anonymous", true); updateConversation(conversation); } - IqPacket request = new IqPacket(IqPacket.TYPE.GET); + if (options.containsKey("muc#roomconfig_moderatedroom")) { + final boolean moderated = "1".equals(options.getString("muc#roomconfig_moderatedroom")); + options.putString("members_by_default", moderated ? "0" : "1"); + } + final IqPacket request = new IqPacket(IqPacket.TYPE.GET); request.setTo(conversation.getJid().asBareJid()); request.query("http://jabber.org/protocol/muc#owner"); sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { if (packet.getType() == IqPacket.TYPE.RESULT) { - Data data = Data.parse(packet.query().findChild("x", Namespace.DATA)); + final Data data = Data.parse(packet.query().findChild("x", Namespace.DATA)); data.submit(options); - IqPacket set = new IqPacket(IqPacket.TYPE.SET); + final IqPacket set = new IqPacket(IqPacket.TYPE.SET); set.setTo(conversation.getJid().asBareJid()); set.query("http://jabber.org/protocol/muc#owner").addChild(data); sendIqPacket(account, set, new OnIqPacketReceived() { @@ -4580,7 +4584,7 @@ public class XmppConnectionService extends Service { public void evictPreview(String uuid) { if (mBitmapCache.remove(uuid) != null) { - Log.d(Config.LOGTAG,"deleted cached preview"); + Log.d(Config.LOGTAG, "deleted cached preview"); } }