From 98dbc0ee2eb1e15ae83c7ed9025a9b3075670bb1 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Fri, 14 Jun 2024 22:25:05 +0200 Subject: [PATCH] [muc] Prevent duplicate processing of mediated invitations MUC mediated invitations usually have the form Hey Hecate, this is the place for all good witches! cauldronburn (source: XEP-0045 Example 57.) However, previous versions of XEP-0045 specified an additional element to be included (see implementation note in XEP-0045). Therefore, a legacy implementation may emit a mediated invitations in the form of Unfortunately, this matches MultiUserChatManager.DIRECT_INVITATION_FILTER because GroupChatInvitation matches . However the message is not a direct invitation but a mediated one. Besides this invoking the wrong listeners (direct vs. medidated) the value for 'inviter' that's used to invoke that listener will be false. To fix this, extend DIRECT_INVITATION_FILTER with NotFilter.of(MUCUser.class) to avoid matching those legacy mediated invitations. Fixes SMACK-943 Co-authored-by: Florian Schmaus --- .../java/org/jivesoftware/smackx/muc/MultiUserChatManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index 47de2163d..9d031a8bd 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -148,6 +148,7 @@ public final class MultiUserChatManager extends Manager { private static final StanzaFilter DIRECT_INVITATION_FILTER = new AndFilter(StanzaTypeFilter.MESSAGE, new ExtensionElementFilter(GroupChatInvitation.class), + NotFilter.of(MUCUser.class), new NotFilter(MessageTypeFilter.ERROR)); private static final ExpirationCache KNOWN_MUC_SERVICES = new ExpirationCache<>(