From 07f5fc9ef69a73167a4c64caec2a814641ee80b5 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Tue, 17 Jan 2006 21:28:46 +0000 Subject: [PATCH] 1. Stream compression is now negotiated after authentication as defined in JEP-170. 2. Keep copy of ConnectionConfiguration to prevent future modifications. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3314 b35dd754-fafc-0310-a699-88a17e54d16e --- .../jivesoftware/smack/XMPPConnection.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/org/jivesoftware/smack/XMPPConnection.java b/source/org/jivesoftware/smack/XMPPConnection.java index 6226fef77..cbeb019f1 100644 --- a/source/org/jivesoftware/smack/XMPPConnection.java +++ b/source/org/jivesoftware/smack/XMPPConnection.java @@ -284,12 +284,13 @@ public class XMPPConnection { ioe); } this.serviceName = config.getServiceName(); - this.configuration = config; - init(); - // If compression is enabled then request the server to use stream compression - if (config.isCompressionEnabled()) { - useCompression(); + try { + // Keep a copy to be sure that once the configuration has been passed to the + // constructor it cannot be modified + this.configuration = (ConnectionConfiguration) config.clone(); } + catch (CloneNotSupportedException e) {} + init(); } /** @@ -442,6 +443,11 @@ public class XMPPConnection { } } + // If compression is enabled then request the server to use stream compression + if (configuration.isCompressionEnabled()) { + useCompression(); + } + // Create the roster. this.roster = new Roster(this); roster.reload(); @@ -497,6 +503,11 @@ public class XMPPConnection { // Update the serviceName with the one returned by the server this.serviceName = StringUtils.parseServer(response); + // If compression is enabled then request the server to use stream compression + if (configuration.isCompressionEnabled()) { + useCompression(); + } + // Anonymous users can't have a roster. roster = null;