From 4fb34a6952c19205152d670517141f4872217e7a Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 18 Apr 2018 09:11:04 +0200 Subject: [PATCH] Add MultiUserChatManager.getMucServiceDomains() and deprecate getXMPPServiceDomains(). --- .../smackx/muc/MultiUserChatManager.java | 20 +++++++++++++++++-- .../muc/MultiUserChatIntegrationTest.java | 4 ++-- .../MultiUserChatLowLevelIntegrationTest.java | 6 +++--- 3 files changed, 23 insertions(+), 7 deletions(-) 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 af4302394..50e6b0bf6 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 @@ -1,6 +1,6 @@ /** * - * Copyright © 2014-2017 Florian Schmaus + * Copyright © 2014-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -338,11 +338,27 @@ public final class MultiUserChatManager extends Manager { * @throws NotConnectedException * @throws InterruptedException */ - public List getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { + public List getMucServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false); } + /** + * Returns a collection with the XMPP addresses of the Multi-User Chat services. + * + * @return a collection with the XMPP addresses of the Multi-User Chat services. + * @throws XMPPErrorException + * @throws NoResponseException + * @throws NotConnectedException + * @throws InterruptedException + * @deprecated use {@link #getMucServiceDomains()} instead. + */ + // TODO: Remove in Smack 4.5 + @Deprecated + public List getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { + return getMucServiceDomains(); + } + /** * Check if the provided domain bare JID provides a MUC service. * 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 99ad08aff..d4898bf16 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 @@ -1,6 +1,6 @@ /** * - * Copyright 2015 Florian Schmaus + * Copyright 2015-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ public class MultiUserChatIntegrationTest extends AbstractSmackIntegrationTest { mucManagerOne = MultiUserChatManager.getInstanceFor(conOne); mucManagerTwo = MultiUserChatManager.getInstanceFor(conTwo); - List services = mucManagerOne.getXMPPServiceDomains(); + List services = mucManagerOne.getMucServiceDomains(); 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 f294351b2..48d093d87 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 @@ -1,6 +1,6 @@ /** * - * Copyright 2015 Florian Schmaus + * Copyright 2015-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelI performCheck(new ConnectionCallback() { @Override public void connectionCallback(XMPPTCPConnection connection) throws Exception { - if (MultiUserChatManager.getInstanceFor(connection).getXMPPServiceDomains().isEmpty()) { + if (MultiUserChatManager.getInstanceFor(connection).getMucServiceDomains().isEmpty()) { throw new TestNotPossibleException("MUC component not offered by service"); } } @@ -62,7 +62,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.getXMPPServiceDomains().get(0); + final DomainBareJid mucComponent = multiUserChatManager.getMucServiceDomains().get(0); final MultiUserChat muc = multiUserChatManager.getMultiUserChat(JidCreate.entityBareFrom( Localpart.from(randomMucName), mucComponent));