diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionOut.java | 12 |
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) { |