From 5bb8f3f9aa61acb74f3c4ad222c23d7538631991 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Nov 2023 15:24:31 +0100 Subject: [PATCH] stricter bind 2 inline feature parsing --- .../java/eu/siacs/conversations/xmpp/bind/Bind2.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/bind/Bind2.java b/src/main/java/eu/siacs/conversations/xmpp/bind/Bind2.java index 21c957a0f..c3f847eca 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/bind/Bind2.java +++ b/src/main/java/eu/siacs/conversations/xmpp/bind/Bind2.java @@ -1,5 +1,6 @@ package eu.siacs.conversations.xmpp.bind; +import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import java.util.Arrays; @@ -27,7 +28,12 @@ public class Bind2 { if (inlineBind2Inline == null) { return Collections.emptyList(); } - return Collections2.transform( - inlineBind2Inline.getChildren(), c -> c == null ? null : c.getAttribute("var")); + return Collections2.filter( + Collections2.transform( + Collections2.filter( + inlineBind2Inline.getChildren(), + c -> "feature".equals(c.getName())), + c -> c.getAttribute("var")), + Predicates.notNull()); } }