aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-02-07 11:27:56 +0300
committerGravatar Vitaly Takmazov2017-02-07 11:28:07 +0300
commitb536c2569aac0b45be0e37e691fa3a6f6c452b76 (patch)
tree0fde8121a34eb4cc97880a48e8b21e443cec6aef /juick-xmpp/src/main/java/com/juick
parent81ff64a57608cb6480f28af6fa46905c067e76c4 (diff)
juick-xmpp: forward iq to=domain
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java11
1 files changed, 5 insertions, 6 deletions
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++) {