From b536c2569aac0b45be0e37e691fa3a6f6c452b76 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 7 Feb 2017 11:27:56 +0300 Subject: juick-xmpp: forward iq to=domain --- .../src/main/java/com/juick/components/s2s/ConnectionIn.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'juick-xmpp/src') diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java index 7bb02fa5..3304f73f 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java @@ -1,9 +1,9 @@ package com.juick.components.s2s; import com.juick.components.XMPPServer; -import com.juick.xmpp.Iq; import com.juick.xmpp.extensions.StreamError; import com.juick.xmpp.utils.XmlUtils; +import org.apache.commons.lang3.StringUtils; import org.xmlpull.v1.XmlPullParser; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.session.XmppSessionConfiguration; @@ -130,8 +130,8 @@ public class ConnectionIn extends Connection implements Runnable { updateTsRemoteData(); String type = parser.getAttributeValue(null, "type"); String xml = XmlUtils.parseToString(parser, false); - if (type == null || !type.equals(Iq.Type.error)) { - logger.info("stream {}: {}", streamID, xml); + if (type == null || !type.equals("error")) { + logger.info("stream {} iq: {}", streamID, xml); xmpp.getRouter().sendStanza(parse(xml)); } } else if (sc != null && !isSecured() && tag.equals("starttls")) { @@ -206,10 +206,9 @@ public class ConnectionIn extends Connection implements Runnable { boolean checkFromTo(XmlPullParser parser) throws Exception { String cfrom = parser.getAttributeValue(null, "from"); String cto = parser.getAttributeValue(null, "to"); - if (cfrom != null && cto != null && !cfrom.isEmpty() && !cto.isEmpty()) { + if (StringUtils.isNotEmpty(cfrom) && StringUtils.isNotEmpty(cto)) { Jid jidto = Jid.of(cto); - if (jidto.getDomain() != null && jidto.getLocal() != null && jidto.getDomain().equals(xmpp.HOSTNAME) - && jidto.getLocal().matches("^[a-zA-Z0-9\\-]{2,16}$")) { + if (jidto.getDomain().equals(xmpp.HOSTNAME)) { Jid jidfrom = Jid.of(cfrom); int size = from.size(); for (int i = 0; i < size; i++) { -- cgit v1.2.3