From f369a009ac67c45e0f0d883c01516eefabe59484 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 18 May 2015 16:48:23 +0200 Subject: [PATCH] Rename 'serviceName' to 'xmppServiceDomain' Also use 'null' as default value for the resource, to enforce server generated resources. Fixes Smack-665 --- .../smack/bosh/XMPPBOSHConnection.java | 10 ++-- .../org/jivesoftware/smack/MessageTest.java | 10 ++-- .../org/jivesoftware/smack/PresenceTest.java | 2 +- .../jivesoftware/smack/RosterSmackTest.java | 10 ++-- .../smack/test/SmackTestCase.java | 6 +-- .../jivesoftware/smack/util/DNSUtilTest.java | 2 +- .../smack/AbstractXMPPConnection.java | 18 ++++--- .../smack/ConnectionConfiguration.java | 49 +++++++++---------- .../smack/SASLAuthentication.java | 6 +-- .../jivesoftware/smack/XMPPConnection.java | 11 +++++ .../smack/debugger/AbstractDebugger.java | 2 +- .../smack/filter/IQReplyFilter.java | 2 +- .../org/jivesoftware/smack/util/DNSUtil.java | 2 +- .../jivesoftware/smack/DummyConnection.java | 2 +- .../smackx/debugger/EnhancedDebugger.java | 2 +- .../smackx/debugger/LiteDebugger.java | 2 +- .../jivesoftware/smackx/CompressionTest.java | 4 +- .../smackx/ServiceDiscoveryManagerTest.java | 4 +- .../smackx/muc/MultiUserChatTest.java | 6 +-- .../smackx/pubsub/TestEvents.java | 2 +- .../smackx/pubsub/test/PubSubTestCase.java | 2 +- .../jivesoftware/smackx/amp/AMPManager.java | 2 +- .../socks5/Socks5BytestreamManager.java | 2 +- .../smackx/caps/EntityCapsManager.java | 4 +- .../smackx/disco/ServiceDiscoveryManager.java | 4 +- .../smackx/iqregister/AccountManager.java | 8 +-- .../smackx/muc/MultiUserChatException.java | 2 +- .../smackx/muc/MultiUserChatManager.java | 2 +- .../jivesoftware/smackx/ping/PingManager.java | 4 +- .../smackx/pubsub/PubSubManager.java | 2 +- .../jivesoftware/smackx/ping/PingTest.java | 2 +- .../jivesoftware/util/ConnectionUtils.java | 2 +- .../org/jivesoftware/smack/roster/Roster.java | 2 +- .../muc/MultiUserChatIntegrationTest.java | 2 +- .../MultiUserChatLowLevelIntegrationTest.java | 4 +- .../smackx/jingleold/nat/RTPBridge.java | 10 ++-- .../smackx/jingleold/nat/STUN.java | 4 +- .../smack/tcp/XMPPTCPConnection.java | 10 ++-- 38 files changed, 116 insertions(+), 104 deletions(-) diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java index db44e93a2..9594b5692 100644 --- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java +++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java @@ -113,12 +113,12 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection { * (e.g. 7070 for http://domain.lt:7070/http-bind). * @param filePath the file which is described by the URL * (e.g. /http-bind for http://domain.lt:7070/http-bind). - * @param xmppDomain the XMPP service name + * @param xmppServiceDomain the XMPP service name * (e.g. domain.lt for the user alice@domain.lt) */ - public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, DomainBareJid xmppDomain) { + public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, DomainBareJid xmppServiceDomain) { this(BOSHConfiguration.builder().setUseHttps(https).setHost(host) - .setPort(port).setFile(filePath).setServiceName(xmppDomain) + .setPort(port).setFile(filePath).setServiceName(xmppServiceDomain) .setUsernameAndPassword(username, password).build()); } @@ -145,7 +145,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection { // Initialize BOSH client BOSHClientConfig.Builder cfgBuilder = BOSHClientConfig.Builder - .create(config.getURI(), config.getServiceName().toString()); + .create(config.getURI(), config.getXMPPServiceDomain().toString()); if (config.isProxyEnabled()) { cfgBuilder.setProxy(config.getProxyAddress(), config.getProxyPort()); } @@ -495,7 +495,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection { XMPPBOSHConnection.XMPP_BOSH_NS).setAttribute( BodyQName.createWithPrefix(XMPPBOSHConnection.XMPP_BOSH_NS, "restart", "xmpp"), "true").setAttribute( - BodyQName.create(XMPPBOSHConnection.BOSH_URI, "to"), getServiceName().toString()).build()); + BodyQName.create(XMPPBOSHConnection.BOSH_URI, "to"), getXMPPServiceDomain().toString()).build()); Success success = new Success(parser.nextText()); getSASLAuthentication().authenticated(success); break; diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java index 278e45198..299e0b7df 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java @@ -193,7 +193,7 @@ public class MessageTest extends SmackTestCase { public void testHighestPriority() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); @@ -242,7 +242,7 @@ public class MessageTest extends SmackTestCase { public void testHighestShow() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); @@ -291,7 +291,7 @@ public class MessageTest extends SmackTestCase { public void testMostRecentActive() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); @@ -307,7 +307,7 @@ public class MessageTest extends SmackTestCase { getConnection(0).sendStanza(presence); connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(0), getPassword(0), "Home2"); @@ -326,7 +326,7 @@ public class MessageTest extends SmackTestCase { PacketCollector coll4 = conn4.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); // Send a message from this resource to indicate most recent activity - conn3.sendStanza(new Message("admin@" + getServiceName())); + conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain())); // User1 sends a message to the bare JID of User0 Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null); diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java index f7c2a6792..1f9330284 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java @@ -168,7 +168,7 @@ public class PresenceTest extends SmackTestCase { public void testMultipleResources() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java index 7884e750b..72353377b 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java @@ -434,7 +434,7 @@ public class RosterSmackTest extends SmackTestCase { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); @@ -455,7 +455,7 @@ public class RosterSmackTest extends SmackTestCase { assertTrue("Returned a null Presence for an existing user", presence.isAvailable()); // Check that the right presence is returned for a user+resource - presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getServiceName() + "/Home"); + presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getXMPPServiceDomain() + "/Home"); assertEquals("Returned the wrong Presence", "Home", StringUtils.parseResource(presence.getFrom())); @@ -466,7 +466,7 @@ public class RosterSmackTest extends SmackTestCase { StringUtils.parseResource(presence.getFrom())); // Check the returned presence for a non-existent user+resource - presence = roster.getPresenceResource("noname@" + getServiceName() + "/Smack"); + presence = roster.getPresenceResource("noname@" + getXMPPServiceDomain() + "/Smack"); assertFalse("Available presence was returned for a non-existing user", presence.isAvailable()); assertEquals("Returned Presence for a non-existing user has the incorrect type", Presence.Type.unavailable, presence.getType()); @@ -501,7 +501,7 @@ public class RosterSmackTest extends SmackTestCase { public void testMultipleResources() throws Exception { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); @@ -566,7 +566,7 @@ public class RosterSmackTest extends SmackTestCase { // Create another connection for the same user of connection 0 ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection conn2 = new XMPPConnection(connectionConfiguration); conn2.connect(); conn2.login(getUsername(0), getPassword(0), "Home"); diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java index 50f959e71..dd41af624 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java @@ -185,7 +185,7 @@ public abstract class SmackTestCase extends TestCase { * @return the bare XMPP address of the user (e.g. johndoe@jabber.org). */ protected String getBareJID(int index) { - return getUsername(index) + "@" + getConnection(index).getServiceName(); + return getUsername(index) + "@" + getConnection(index).getXMPPServiceDomain(); } /** @@ -207,7 +207,7 @@ public abstract class SmackTestCase extends TestCase { return port; } - protected String getServiceName() { + protected String getXMPPServiceDomain() { return serviceName; } @@ -259,7 +259,7 @@ public abstract class SmackTestCase extends TestCase { // cases, but could fail if the user set a hostname in their XMPP server // that will not resolve as a network connection. host = connections[0].getHost(); - serviceName = connections[0].getServiceName(); + serviceName = connections[0].getXMPPServiceDomain(); if (!createOfflineConnections()) { for (int i = 0; i < getMaxConnections(); i++) { diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java index df9509e9e..b1bbc89c0 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java @@ -111,7 +111,7 @@ public class DNSUtilTest { } private void xmppClientDomainTest() { - List hostAddresses = DNSUtil.resolveXMPPDomain(igniterealtimeDomain); + List hostAddresses = DNSUtil.resolveXMPPServiceDomain(igniterealtimeDomain); HostAddress ha = hostAddresses.get(0); assertEquals(ha.getFQDN(), igniterealtimeXMPPServer); assertEquals(ha.getPort(), igniterealtimeClientPort); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 07bd364de..6bc5d012e 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -303,12 +303,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return config; } + @SuppressWarnings("deprecation") @Override public DomainBareJid getServiceName() { - if (serviceName != null) { - return serviceName; + return getXMPPServiceDomain(); + } + + @Override + public DomainBareJid getXMPPServiceDomain() { + if (xmppServiceDomain != null) { + return xmppServiceDomain; } - return config.getServiceName(); + return config.getXMPPServiceDomain(); } @Override @@ -506,7 +512,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { // from the login() arguments and the configurations service name, as, for example, when SASL External is used, // the username is not given to login but taken from the 'external' certificate. user = response.getJid(); - serviceName = user.asDomainBareJid(); + xmppServiceDomain = user.asDomainBareJid(); Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE); // Only bind the session if it's announced as stream feature by the server, is not optional and not disabled @@ -549,7 +555,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { && !config.allowNullOrEmptyUsername; } - private DomainBareJid serviceName; + private DomainBareJid xmppServiceDomain; protected List hostAddresses; @@ -567,7 +573,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { hostAddress = new HostAddress(config.host, config.port); hostAddresses.add(hostAddress); } else { - hostAddresses = DNSUtil.resolveXMPPDomain(config.serviceName.toString(), failedAddresses); + hostAddresses = DNSUtil.resolveXMPPServiceDomain(config.getXMPPServiceDomain().toString(), failedAddresses); } // If we reach this, then hostAddresses *must not* be empty, i.e. there is at least one host added, either the // config.host one or the host representing the service name by DNSUtil diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index 2341f380f..ba594f940 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -22,8 +22,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import org.jivesoftware.smack.packet.Session; import org.jivesoftware.smack.proxy.ProxyInfo; @@ -54,14 +52,13 @@ public abstract class ConnectionConfiguration { SmackConfiguration.getVersion(); } - private static final Logger LOGGER = Logger.getLogger(ConnectionConfiguration.class.getName()); - /** - * Hostname of the XMPP server. Usually servers use the same service name as the name + * The XMPP domain of the XMPP Service. Usually servers use the same service name as the name * of the server. However, there are some servers like google where host would be * talk.google.com and the serviceName would be gmail.com. */ - protected final DomainBareJid serviceName; + protected final DomainBareJid xmppServiceDomain; + protected final String host; protected final int port; @@ -120,9 +117,9 @@ public abstract class ConnectionConfiguration { // Resource can be null, this means that the server must provide one resource = builder.resource; - serviceName = builder.serviceName; - if (serviceName == null) { - throw new IllegalArgumentException("Must provide XMPP service name"); + xmppServiceDomain = builder.xmppServiceDomain; + if (xmppServiceDomain == null) { + throw new IllegalArgumentException("Must define the XMPP domain"); } host = builder.host; port = builder.port; @@ -159,9 +156,20 @@ public abstract class ConnectionConfiguration { * Returns the server name of the target server. * * @return the server name of the target server. + * @deprecated use {@link #getXMPPServiceDomain()} instead. */ + @Deprecated public DomainBareJid getServiceName() { - return serviceName; + return xmppServiceDomain; + } + + /** + * Returns the XMPP domain used by this configuration. + * + * @return the XMPP domain. + */ + public DomainBareJid getXMPPServiceDomain() { + return xmppServiceDomain; } /** @@ -407,19 +415,6 @@ public abstract class ConnectionConfiguration { * @param the resulting connection configuration type parameter. */ public static abstract class Builder, C extends ConnectionConfiguration> { - private static final Resourcepart DEFAULT_RESOURCE; - - static { - Resourcepart resourcepart = null; - try { - resourcepart = Resourcepart.from("Smack"); - } - catch (XmppStringprepException e) { - LOGGER.log(Level.WARNING, "Could not create default resourcepart", e); - } - DEFAULT_RESOURCE = resourcepart; - } - private SecurityMode securityMode = SecurityMode.ifpossible; private String keystorePath = System.getProperty("javax.net.ssl.keyStore"); private String keystoreType = "jks"; @@ -430,14 +425,14 @@ public abstract class ConnectionConfiguration { private HostnameVerifier hostnameVerifier; private CharSequence username; private String password; - private Resourcepart resource = DEFAULT_RESOURCE; + private Resourcepart resource; private boolean sendPresence = true; private boolean legacySessionDisabled = false; private ProxyInfo proxy; private CallbackHandler callbackHandler; private boolean debuggerEnabled = SmackConfiguration.DEBUG; private SocketFactory socketFactory; - private DomainBareJid serviceName; + private DomainBareJid xmppServiceDomain; private String host; private int port = 5222; private boolean allowEmptyOrNullUsername = false; @@ -471,7 +466,7 @@ public abstract class ConnectionConfiguration { * @return a reference to this builder. */ public B setServiceName(DomainBareJid serviceName) { - this.serviceName = serviceName; + this.xmppServiceDomain = serviceName; return getThis(); } @@ -496,7 +491,7 @@ public abstract class ConnectionConfiguration { * @param resource the non-null CharSequence to use a resource. * @return a reference ot this builder. * @throws XmppStringprepException if the CharSequence is not a valid resourcepart. - * @see setResource(Resourcepart) + * @see #setResource(Resourcepart) */ public B setResource(CharSequence resource) throws XmppStringprepException { Objects.requireNonNull(resource, "resource must not be null"); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java index d23b6661f..be98d93e6 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java @@ -183,14 +183,14 @@ public class SASLAuthentication { currentMechanism = selectMechanism(); final CallbackHandler callbackHandler = configuration.getCallbackHandler(); final String host = connection.getHost(); - final DomainBareJid xmppDomain = connection.getServiceName(); + final DomainBareJid xmppServiceDomain = connection.getXMPPServiceDomain(); synchronized (this) { if (callbackHandler != null) { - currentMechanism.authenticate(host, xmppDomain, callbackHandler); + currentMechanism.authenticate(host, xmppServiceDomain, callbackHandler); } else { - currentMechanism.authenticate(username, host, xmppDomain, password); + currentMechanism.authenticate(username, host, xmppServiceDomain, password); } // Wait until SASL negotiation finishes wait(connection.getPacketReplyTimeout()); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 451f140e7..872c81e3b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -78,9 +78,20 @@ public interface XMPPConnection { * authenticating with the server the returned value may be different. * * @return the name of the service provided by the XMPP server. + // TODO remove this once the java bugs are fixed, causing a warning +// * @deprecated use {@link #getXMPPServiceDomain()} instead. */ +// @Deprecated public DomainBareJid getServiceName(); + /** + * Returns the XMPP Domain of the service provided by the XMPP server and used for this connection. After + * authenticating with the server the returned value may be different. + * + * @return the XMPP domain of this XMPP session. + */ + public DomainBareJid getXMPPServiceDomain(); + /** * Returns the host name of the server where the XMPP server is running. This would be the * IP address of the server or a name that may be resolved by a DNS server. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java index 0bfd66d6b..b6d689da5 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java @@ -149,7 +149,7 @@ public abstract class AbstractDebugger implements SmackDebugger { "User logged (" + connection.getConnectionCounter() + "): " + (isAnonymous ? "" : localpart) + "@" - + connection.getServiceName() + + connection.getXMPPServiceDomain() + ":" + connection.getPort(); title += "/" + user.getResourcepart(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java index 231217161..ff4af234a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java @@ -91,7 +91,7 @@ public class IQReplyFilter implements StanzaFilter { throw new IllegalArgumentException("Must have a local (user) JID set. Either you didn't configure one or you where not connected at least once"); } - server = conn.getServiceName(); + server = conn.getXMPPServiceDomain(); packetId = iqPacket.getStanzaId(); StanzaFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java index ce6f08d33..54520b4c9 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java @@ -109,7 +109,7 @@ public class DNSUtil { * @return List of HostAddress, which encompasses the hostname and port that the * XMPP server can be reached at for the specified domain. */ - public static List resolveXMPPDomain(String domain, List failedAddresses) { + public static List resolveXMPPServiceDomain(String domain, List failedAddresses) { domain = idnaTransformer.transform(domain); if (dnsResolver == null) { LOGGER.warning("No DNS Resolver active in Smack, will be unable to perform DNS SRV lookups"); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java index 4d7970304..63532bdc6 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java @@ -69,7 +69,7 @@ public class DummyConnection extends AbstractXMPPConnection { try { return JidCreate.fullFrom(config.getUsername() + "@" - + config.getServiceName() + + config.getXMPPServiceDomain() + "/" + (config.getResource() != null ? config.getResource() : "Test")); } diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java index de48f947c..80f8da3ac 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java @@ -621,7 +621,7 @@ public class EnhancedDebugger implements SmackDebugger { connPanel.add( label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0)); - JFormattedTextField field = new JFormattedTextField(connection.getServiceName()); + JFormattedTextField field = new JFormattedTextField(connection.getXMPPServiceDomain()); field.setMinimumSize(new java.awt.Dimension(150, 20)); field.setMaximumSize(new java.awt.Dimension(150, 20)); field.setEditable(false); diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java index c7aee544a..9404c72a1 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java @@ -81,7 +81,7 @@ public class LiteDebugger implements SmackDebugger { * Creates the debug process, which is a GUI window that displays XML traffic. */ private void createDebug() { - frame = new JFrame("Smack Debug Window -- " + connection.getServiceName() + ":" + + frame = new JFrame("Smack Debug Window -- " + connection.getXMPPServiceDomain() + ":" + connection.getPort()); // Add listener for window closing event diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java index c7d045bcd..6eb40cdbc 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java @@ -56,7 +56,7 @@ public class CompressionTest extends SmackTestCase { // Request the version of the server Version version = new Version(); version.setType(IQ.Type.get); - version.setTo(getServiceName()); + version.setTo(getXMPPServiceDomain()); // Create a packet collector to listen for a response. PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getStanzaId())); @@ -84,7 +84,7 @@ public class CompressionTest extends SmackTestCase { */ protected void setUp() throws Exception { super.setUp(); - XMPPTCPConnection setupConnection = new XMPPConnection(getServiceName()); + XMPPTCPConnection setupConnection = new XMPPConnection(getXMPPServiceDomain()); setupConnection.connect(); if (!setupConnection.getAccountManager().supportsAccountCreation()) fail("Server does not support account creation"); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java index 230afcd17..1dc257ccb 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java @@ -114,7 +114,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { public void testDiscoverPublishItemsSupport() { try { boolean canPublish = ServiceDiscoveryManager.getInstanceFor(getConnection(0)) - .canPublishItems(getServiceName()); + .canPublishItems(getXMPPServiceDomain()); assertFalse("Wildfire does not support publishing...so far!!", canPublish); } catch (Exception e) { @@ -135,7 +135,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { itemsToPublish.addItem(itemToPublish); try { - ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getServiceName(), + ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getXMPPServiceDomain(), itemsToPublish); } catch (Exception e) { diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java index cdc36a3d6..c74778d45 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java @@ -224,7 +224,7 @@ public class MultiUserChatTest extends SmackTestCase { try { // Anonymous user joins the new room ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); XMPPTCPConnection anonConnection = new XMPPConnection(connectionConfiguration); anonConnection.connect(); anonConnection.loginAnonymously(); @@ -405,7 +405,7 @@ public class MultiUserChatTest extends SmackTestCase { public void testDiscoverMUCService() { try { - Collection services = MultiUserChat.getServiceNames(getConnection(1)); + Collection services = MultiUserChat.getXMPPServiceDomains(getConnection(1)); assertFalse("No MUC service was found", services.isEmpty()); // Discover the hosted rooms by the chat service. @@ -1736,7 +1736,7 @@ public class MultiUserChatTest extends SmackTestCase { XMPPTCPConnection[] conns = new XMPPConnection[5]; for (int i = 0; i < conns.length; i++) { ConnectionConfiguration connectionConfiguration = - new ConnectionConfiguration(getHost(), getPort(), getServiceName()); + new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain()); connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled); conns[i] = new XMPPTCPConnection(connectionConfiguration); conns[i].connect(); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java index e0eabfbf8..98fe64dcf 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java @@ -52,7 +52,7 @@ public class TestEvents extends SmackTestCase private String getService() { - return "pubsub." + getServiceName(); + return "pubsub." + getXMPPServiceDomain(); } public void testCreateAndGetNode() throws Exception diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java index 743ca7ac4..6cb4286fb 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java @@ -87,6 +87,6 @@ abstract public class PubSubTestCase extends SmackTestCase protected String getService() { - return "pubsub." + getServiceName(); + return "pubsub." + getXMPPServiceDomain(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java index 3cd1be7ca..20d8c887d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java @@ -74,7 +74,7 @@ public class AMPManager { * @return a boolean indicating if the AMP support is enabled for the given connection */ public static boolean isServiceEnabled(XMPPConnection connection) { - connection.getServiceName(); + connection.getXMPPServiceDomain(); return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java index 043d5f09f..8f17befa7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java @@ -552,7 +552,7 @@ public final class Socks5BytestreamManager implements BytestreamManager { List proxies = new ArrayList<>(); // get all items from XMPP server - DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getServiceName()); + DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getXMPPServiceDomain()); // query all items if they are SOCKS5 proxies for (Item item : discoverItems.getItems()) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index 154c6c791..267c3efb4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -302,7 +302,7 @@ public final class EntityCapsManager extends Manager { if (capsExtension == null) { return; } - DomainBareJid from = connection.getServiceName(); + DomainBareJid from = connection.getXMPPServiceDomain(); addCapsExtensionInfo(from, capsExtension); } }); @@ -456,7 +456,7 @@ public final class EntityCapsManager extends Manager { * @throws InterruptedException */ public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { - return areEntityCapsSupported(connection().getServiceName()); + return areEntityCapsSupported(connection().getXMPPServiceDomain()); } /** diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java index 68d96b523..84311b6d2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java @@ -661,7 +661,7 @@ public final class ServiceDiscoveryManager extends Manager { */ public boolean serverSupportsFeature(String feature) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { - return supportsFeature(connection().getServiceName(), feature); + return supportsFeature(connection().getXMPPServiceDomain(), feature); } /** @@ -702,7 +702,7 @@ public final class ServiceDiscoveryManager extends Manager { public List findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List serviceDiscoInfo = null; - DomainBareJid serviceName = connection().getServiceName(); + DomainBareJid serviceName = connection().getXMPPServiceDomain(); if (useCache) { serviceDiscoInfo = services.get(feature); if (serviceDiscoInfo != null) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java index 7da106910..96270e0ed 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java @@ -273,7 +273,7 @@ public final class AccountManager extends Manager { attributes.put("password", password); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); - reg.setTo(connection().getServiceName()); + reg.setTo(connection().getXMPPServiceDomain()); createPacketCollectorAndSend(reg).nextResultOrThrow(); } @@ -299,7 +299,7 @@ public final class AccountManager extends Manager { map.put("password",newPassword); Registration reg = new Registration(map); reg.setType(IQ.Type.set); - reg.setTo(connection().getServiceName()); + reg.setTo(connection().getXMPPServiceDomain()); createPacketCollectorAndSend(reg).nextResultOrThrow(); } @@ -320,7 +320,7 @@ public final class AccountManager extends Manager { attributes.put("remove", ""); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); - reg.setTo(connection().getServiceName()); + reg.setTo(connection().getXMPPServiceDomain()); createPacketCollectorAndSend(reg).nextResultOrThrow(); } @@ -336,7 +336,7 @@ public final class AccountManager extends Manager { */ private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Registration reg = new Registration(); - reg.setTo(connection().getServiceName()); + reg.setTo(connection().getXMPPServiceDomain()); info = createPacketCollectorAndSend(reg).nextResultOrThrow(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatException.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatException.java index 055e5c38c..2e1502a3e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatException.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatException.java @@ -86,7 +86,7 @@ public abstract class MultiUserChatException extends SmackException { /** * Thrown when trying to enter a MUC room that is not hosted a domain providing a MUC service. - * Try {@link MultiUserChatManager#getServiceNames()} for a list of client-local domains + * Try {@link MultiUserChatManager#getXMPPServiceDomains()} for a list of client-local domains * providing a MUC service. */ public static class NotAMucServiceException extends MultiUserChatException { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index 8224399f3..60dba6c21 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -256,7 +256,7 @@ public final class MultiUserChatManager extends Manager { * @throws NotConnectedException * @throws InterruptedException */ - public List getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { + public List getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java index 99a2d576d..fe4a7b860 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java @@ -170,7 +170,7 @@ public final class PingManager extends Manager { connection.createPacketCollectorAndSend(ping).nextResultOrThrow(pingTimeout); } catch (XMPPException exc) { - return jid.equals(connection.getServiceName()); + return jid.equals(connection.getXMPPServiceDomain()); } return true; } @@ -250,7 +250,7 @@ public final class PingManager extends Manager { public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException, InterruptedException { boolean res; try { - res = ping(connection().getServiceName(), pingTimeout); + res = ping(connection().getXMPPServiceDomain(), pingTimeout); } catch (NoResponseException e) { res = false; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java index 0a5f2d572..6aca72e53 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java @@ -96,7 +96,7 @@ public final class PubSubManager extends Manager { if (pubSubService == null) { try { // Perform an educated guess about what the PubSub service's domain bare JID may be - pubSubService = JidCreate.domainBareFrom("pubsub." + connection.getServiceName()); + pubSubService = JidCreate.domainBareFrom("pubsub." + connection.getXMPPServiceDomain()); } catch (XmppStringprepException e) { throw new RuntimeException(e); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java index 8ffe06e36..de8a68101 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java @@ -160,7 +160,7 @@ public class PingTest extends InitExtensions { ThreadedDummyConnection con = getAuthentiactedDummyConnection(); //@formatter:off String reply = - "" + + "" + "" + "" + "" + diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java index 62f25eff5..ef5b94362 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java +++ b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java @@ -74,7 +74,7 @@ public class ConnectionUtils { // mock XMPP connection XMPPConnection connection = mock(XMPPConnection.class); when(connection.getUser()).thenReturn(initiatorJID); - when(connection.getServiceName()).thenReturn(xmppServer); + when(connection.getXMPPServiceDomain()).thenReturn(xmppServer); // mock packet collector final PacketCollector collector = mock(PacketCollector.class); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index 1f848dea5..5673f5012 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -915,7 +915,7 @@ public final class Roster extends Manager { * @since 4.1 */ public boolean isSubscribedToMyPresence(Jid jid) { - if (connection().getServiceName().equals(jid)) { + if (connection().getXMPPServiceDomain().equals(jid)) { return true; } RosterEntry entry = getEntry(jid); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java index 39c0acae3..0cd4c1c18 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java @@ -52,7 +52,7 @@ public class MultiUserChatIntegrationTest extends AbstractSmackIntegrationTest { mucManagerOne = MultiUserChatManager.getInstanceFor(conOne); mucManagerTwo = MultiUserChatManager.getInstanceFor(conTwo); - List services = mucManagerOne.getServiceNames(); + List services = mucManagerOne.getXMPPServiceDomains(); if (services.isEmpty()) { throw new TestNotPossibleException("No MUC (XEP-45) service found"); } diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java index 95b1ba867..62fbe8e7b 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java @@ -44,7 +44,7 @@ public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelI performCheck(new ConnectionCallback() { @Override public void connectionCallback(XMPPTCPConnection connection) throws Exception { - if (MultiUserChatManager.getInstanceFor(connection).getServiceNames().isEmpty()) { + if (MultiUserChatManager.getInstanceFor(connection).getXMPPServiceDomains().isEmpty()) { throw new TestNotPossibleException("MUC component not offered by service"); } } @@ -61,7 +61,7 @@ public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelI final MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection); final Resourcepart mucNickname = Resourcepart.from("Nick-" + StringUtils.randomString(6)); final String randomMucName = StringUtils.randomString(6); - final DomainBareJid mucComponent = multiUserChatManager.getServiceNames().get(0); + final DomainBareJid mucComponent = multiUserChatManager.getXMPPServiceDomains().get(0); final MultiUserChat muc = multiUserChatManager.getMultiUserChat(JidCreate.bareFrom( Localpart.from(randomMucName), mucComponent)); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java index b536130dd..423c82344 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java @@ -400,7 +400,7 @@ public class RTPBridge extends IQ { } RTPBridge rtpPacket = new RTPBridge(sessionID); - rtpPacket.setTo(RTPBridge.NAME + "." + connection.getServiceName()); + rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain()); PacketCollector collector = connection.createPacketCollectorAndSend(rtpPacket); @@ -433,7 +433,7 @@ public class RTPBridge extends IQ { ServiceDiscoveryManager disco = ServiceDiscoveryManager .getInstanceFor(connection); -// DiscoverItems items = disco.discoverItems(connection.getServiceName()); +// DiscoverItems items = disco.discoverItems(connection.getXMPPServiceDomain()); // Iterator iter = items.getItems(); // while (iter.hasNext()) { // DiscoverItems.Item item = (DiscoverItems.Item) iter.next(); @@ -442,7 +442,7 @@ public class RTPBridge extends IQ { // } // } - DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName()); + DiscoverInfo discoInfo = disco.discoverInfo(connection.getXMPPServiceDomain()); for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) { if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) { return true; @@ -468,7 +468,7 @@ public class RTPBridge extends IQ { } RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change); - rtpPacket.setTo(RTPBridge.NAME + "." + connection.getServiceName()); + rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain()); rtpPacket.setType(Type.set); rtpPacket.setPass(pass); @@ -505,7 +505,7 @@ public class RTPBridge extends IQ { } RTPBridge rtpPacket = new RTPBridge(RTPBridge.BridgeAction.publicip); - rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getServiceName()); + rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getXMPPServiceDomain()); rtpPacket.setType(Type.set); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java index 6bbac0aa3..dab8501f0 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java @@ -183,7 +183,7 @@ public class STUN extends SimpleIQ { } STUN stunPacket = new STUN(); - stunPacket.setTo(DOMAIN + "." + connection.getServiceName()); + stunPacket.setTo(DOMAIN + "." + connection.getXMPPServiceDomain()); PacketCollector collector = connection.createPacketCollectorAndSend(stunPacket); @@ -213,7 +213,7 @@ public class STUN extends SimpleIQ { LOGGER.fine("Service listing"); ServiceDiscoveryManager disco = ServiceDiscoveryManager.getInstanceFor(connection); - DiscoverItems items = disco.discoverItems(connection.getServiceName()); + DiscoverItems items = disco.discoverItems(connection.getXMPPServiceDomain()); for (DiscoverItems.Item item : items.getItems()) { DiscoverInfo info = disco.discoverInfo(item.getEntityID()); diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index d56e574aa..4d5971ffb 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -711,8 +711,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { final HostnameVerifier verifier = getConfiguration().getHostnameVerifier(); if (verifier == null) { throw new IllegalStateException("No HostnameVerifier set. Use connectionConfiguration.setHostnameVerifier() to configure."); - } else if (!verifier.verify(getServiceName().toString(), sslSocket.getSession())) { - throw new CertificateException("Hostname verification of certificate failed. Certificate does not authenticate " + getServiceName()); + } else if (!verifier.verify(getXMPPServiceDomain().toString(), sslSocket.getSession())) { + throw new CertificateException("Hostname verification of certificate failed. Certificate does not authenticate " + getXMPPServiceDomain()); } // Set that TLS was successful @@ -875,7 +875,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { // possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external // mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first // response from the server (see e.g. RFC 6120 ยง 9.1.1 Step 2.) - CharSequence to = getServiceName(); + CharSequence to = getXMPPServiceDomain(); CharSequence from = null; CharSequence localpart = config.getUsername(); if (localpart != null) { @@ -945,8 +945,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { // We found an opening stream. if ("jabber:client".equals(parser.getNamespace(null))) { streamId = parser.getAttributeValue("", "id"); - String reportedServiceName = parser.getAttributeValue("", "from"); - assert(config.getServiceName().equals(reportedServiceName)); + String reportedServerDomain = parser.getAttributeValue("", "from"); + assert(config.getXMPPServiceDomain().equals(reportedServerDomain)); } break; case "error":