aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-08 13:57:48 +0300
committerGravatar Vitaly Takmazov2016-05-08 13:57:48 +0300
commitd3424cc0a583928086afd06244acdfd21a9113f5 (patch)
treee1c951b16052e022ba1df91213e88550a205f1cd /src/main/java
parent768951b8c25abf34f6045cf2f352c64f7d2ecc37 (diff)
fix ejabberd dialback
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionOut.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
index 4ebeffb6..5ef5fd3c 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
@@ -45,8 +45,8 @@ public class ConnectionOut extends Connection implements Runnable {
}
void sendOpenStream() throws IOException {
- sendStanza("<?xml version='1.0'?><stream:stream xmlns='jabber:server' " +
- "xmlns:stream='http://etherx.jabber.org/streams' xmlns:db='jabber:server:dialback' from='" +
+ sendStanza("<?xml version='1.0'?><stream:stream xmlns='jabber:server' id='" + streamID +
+ "' xmlns:stream='http://etherx.jabber.org/streams' xmlns:db='jabber:server:dialback' from='" +
XMPPComponent.HOSTNAME + "' to='" + to + "' version='1.0'>");
}
@@ -64,9 +64,7 @@ public class ConnectionOut extends Connection implements Runnable {
try {
HostnamePort addr = DNSQueries.getServerAddress(to);
socket = new Socket(InetAddress.getByName(addr.hostname), addr.port);
- parser.setInput(new InputStreamReader(socket.getInputStream()));
-
- writer = new OutputStreamWriter(socket.getOutputStream());
+ restartParser();
sendOpenStream();
@@ -78,6 +76,10 @@ public class ConnectionOut extends Connection implements Runnable {
LOGGER.info("STREAM TO " + to + " " + streamID + " OPEN");
XMPPComponent.addConnectionOut(ConnectionOut.this);
+ boolean xmppversionnew = parser.getAttributeValue(null, "version") != null;
+ if (!xmppversionnew) {
+ processDialback();
+ }
while (parser.next() != XmlPullParser.END_DOCUMENT) {
if (parser.getEventType() != XmlPullParser.START_TAG) {