You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ra...@apache.org on 2019/09/07 22:22:17 UTC

[mina-vysper] branch master updated: Message archive management: do not filter out origin-id

This is an automated email from the ASF dual-hosted git repository.

ralaoui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-vysper.git


The following commit(s) were added to refs/heads/master by this push:
     new da0e1e6  Message archive management: do not filter out origin-id
da0e1e6 is described below

commit da0e1e64c66cbcd7bbc65ac5faa4ec1269eea57e
Author: RĂ©da Housni Alaoui <re...@gmail.com>
AuthorDate: Sun Sep 8 00:22:09 2019 +0200

    Message archive management: do not filter out origin-id
---
 .../modules/extension/xep0313_mam/MessageStanzaWithId.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/server/extensions/xep0313-mam/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0313_mam/MessageStanzaWithId.java b/server/extensions/xep0313-mam/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0313_mam/MessageStanzaWithId.java
index efdf316..5de0fd2 100644
--- a/server/extensions/xep0313-mam/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0313_mam/MessageStanzaWithId.java
+++ b/server/extensions/xep0313-mam/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0313_mam/MessageStanzaWithId.java
@@ -24,6 +24,7 @@ import static java.util.Objects.requireNonNull;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.function.Predicate;
 
 import org.apache.vysper.xml.fragment.Attribute;
 import org.apache.vysper.xml.fragment.XMLElement;
@@ -58,9 +59,7 @@ public class MessageStanzaWithId {
         MessageStanza archivedMessageStanza = archivedMessage.stanza();
 
         List<XMLElement> innerElements = new ArrayList<>();
-        archivedMessageStanza.getInnerElements().stream().filter(xmlElement -> !STANZA_ID.equals(xmlElement.getName()))
-                .filter(xmlElement -> !NamespaceURIs.XEP0359_STANZA_IDS.equals(xmlElement.getNamespaceURI()))
-                .forEach(innerElements::add);
+        archivedMessageStanza.getInnerElements().stream().filter(notStanzaId()).forEach(innerElements::add);
         List<Attribute> stanzaIdAttributes = new ArrayList<>();
         if (archiveId != null) {
             stanzaIdAttributes.add(new Attribute("by", archiveId.getFullQualifiedName()));
@@ -76,4 +75,9 @@ public class MessageStanzaWithId {
         return archivedMessageStanzaWithIdBuilder.build();
     }
 
+    private Predicate<XMLElement> notStanzaId() {
+        return xmlElement -> !STANZA_ID.equals(xmlElement.getName())
+                || !NamespaceURIs.XEP0359_STANZA_IDS.equals(xmlElement.getNamespaceURI());
+    }
+
 }