mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Add PubSubManager.getInstanceFor() just like all other Managers
and deprecate PubSubManager.getInstance().
This commit is contained in:
parent
99bf8316f5
commit
d97fb126a1
8 changed files with 40 additions and 14 deletions
|
@ -124,7 +124,7 @@ public final class GeoLocationManager extends Manager {
|
|||
|
||||
private LeafNode getNode()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
|
||||
return PubSubManager.getInstance(connection()).getOrCreateLeafNode(GeoLocation.NAMESPACE);
|
||||
return PubSubManager.getInstanceFor(connection()).getOrCreateLeafNode(GeoLocation.NAMESPACE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public final class MoodManager extends Manager {
|
|||
throws SmackException.NotLoggedInException, InterruptedException, PubSubException.NotALeafNodeException,
|
||||
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
if (pubSubManager == null) {
|
||||
pubSubManager = PubSubManager.getInstance(getAuthenticatedConnectionOrThrow(), connection().getUser().asBareJid());
|
||||
pubSubManager = PubSubManager.getInstanceFor(getAuthenticatedConnectionOrThrow(), connection().getUser().asBareJid());
|
||||
}
|
||||
|
||||
LeafNode node = pubSubManager.getOrCreateLeafNode(MOOD_NODE);
|
||||
|
|
|
@ -120,7 +120,7 @@ public final class PepManager extends Manager {
|
|||
// TODO Add filter to check if from supports PubSub as per xep163 2 2.4
|
||||
connection.addSyncStanzaListener(packetListener, FROM_BARE_JID_WITH_EVENT_EXTENSION_FILTER);
|
||||
|
||||
pepPubSubManager = PubSubManager.getInstance(connection, null);
|
||||
pepPubSubManager = PubSubManager.getInstanceFor(connection, null);
|
||||
}
|
||||
|
||||
public PubSubManager getPepPubSubManager() {
|
||||
|
|
|
@ -88,7 +88,9 @@ public final class PubSubManager extends Manager {
|
|||
* @param connection
|
||||
* @return the default PubSub manager.
|
||||
*/
|
||||
public static PubSubManager getInstance(XMPPConnection connection) {
|
||||
// CHECKSTYLE:OFF:RegexpSingleline
|
||||
public static PubSubManager getInstanceFor(XMPPConnection connection) {
|
||||
// CHECKSTYLE:ON:RegexpSingleline
|
||||
DomainBareJid pubSubService = null;
|
||||
if (connection.isAuthenticated()) {
|
||||
try {
|
||||
|
@ -110,7 +112,7 @@ public final class PubSubManager extends Manager {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return getInstance(connection, pubSubService);
|
||||
return getInstanceFor(connection, pubSubService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +123,9 @@ public final class PubSubManager extends Manager {
|
|||
* @param pubSubService the PubSub service, may be <code>null</code>.
|
||||
* @return a PubSub manager for the connection and service.
|
||||
*/
|
||||
public static PubSubManager getInstance(XMPPConnection connection, BareJid pubSubService) {
|
||||
// CHECKSTYLE:OFF:RegexpSingleline
|
||||
public static PubSubManager getInstanceFor(XMPPConnection connection, BareJid pubSubService) {
|
||||
// CHECKSTYLE:ON:RegexpSingleline
|
||||
if (pubSubService != null && connection.isAuthenticated() && connection.getUser().asBareJid().equals(pubSubService)) {
|
||||
// PEP service.
|
||||
pubSubService = null;
|
||||
|
@ -147,6 +151,28 @@ public final class PubSubManager extends Manager {
|
|||
return pubSubManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
* @deprecated use {@link #getInstanceFor(XMPPConnection)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
// TODO: Remove in Smack 4.5.
|
||||
public static PubSubManager getInstance(XMPPConnection connection) {
|
||||
return getInstanceFor(connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
* @deprecated use {@link #getInstanceFor(XMPPConnection, BareJid)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
// TODO: Remove in Smack 4.5.
|
||||
public static PubSubManager getInstance(XMPPConnection connection, BareJid pubSubService) {
|
||||
return getInstanceFor(connection, pubSubService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a pubsub manager associated to the specified connection where
|
||||
* the pubsub requests require a specific to address for packets.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue