CryptoMessage v1.3.2版本的 MD5 值为:66c611ce56a11450659dc23697562928
以下内容为反编译后的 UserTuneManager.java 源代码,内容仅作参考
package org.jivesoftware.smackx.usertune;
import java.util.Map;
import java.util.WeakHashMap;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.pep.PepEventListener;
import org.jivesoftware.smackx.pep.PepManager;
import org.jivesoftware.smackx.pubsub.PayloadItem;
import org.jivesoftware.smackx.pubsub.PubSubException;
import org.jivesoftware.smackx.usertune.element.UserTuneElement;
public final class UserTuneManager extends Manager {
private static final Map<XMPPConnection, UserTuneManager> INSTANCES = new WeakHashMap();
public static final String USERTUNE_NODE = "http://jabber.org/protocol/tune";
private final PepManager pepManager;
public static synchronized UserTuneManager getInstanceFor(XMPPConnection xMPPConnection) throws SmackException.NotLoggedInException {
UserTuneManager userTuneManager;
synchronized (UserTuneManager.class) {
Map<XMPPConnection, UserTuneManager> map = INSTANCES;
userTuneManager = map.get(xMPPConnection);
if (userTuneManager == null) {
userTuneManager = new UserTuneManager(xMPPConnection);
map.put(xMPPConnection, userTuneManager);
}
}
return userTuneManager;
}
private UserTuneManager(XMPPConnection xMPPConnection) {
super(xMPPConnection);
this.pepManager = PepManager.getInstanceFor(xMPPConnection);
}
public void clearUserTune() throws SmackException.NotLoggedInException, PubSubException.NotALeafNodeException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, InterruptedException {
publishUserTune(UserTuneElement.EMPTY_USER_TUNE);
}
public void publishUserTune(UserTuneElement userTuneElement) throws SmackException.NotLoggedInException, PubSubException.NotALeafNodeException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, InterruptedException {
this.pepManager.publish("http://jabber.org/protocol/tune", new PayloadItem(userTuneElement));
}
public boolean addUserTuneListener(PepEventListener<UserTuneElement> pepEventListener) {
return this.pepManager.addPepEventListener("http://jabber.org/protocol/tune", UserTuneElement.class, pepEventListener);
}
public boolean removeUserTuneListener(PepEventListener<UserTuneElement> pepEventListener) {
return this.pepManager.removePepEventListener(pepEventListener);
}
}