1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-24 03:27:59 +01:00

Rename PEP to Pep

This commit is contained in:
Florian Schmaus 2018-08-15 20:15:57 +02:00
parent 4b3f757ed9
commit 4d4f92ba86
6 changed files with 44 additions and 44 deletions

View file

@ -31,7 +31,7 @@ import org.jxmpp.jid.EntityBareJid;
* @author Jeff Williams
* @author Florian Schmaus
*/
public interface PEPListener {
public interface PepListener {
/**
* Called when PEP events are received as part of a presence subscribe or message filter.

View file

@ -57,8 +57,8 @@ import org.jxmpp.jid.EntityBareJid;
* Use example:
*
* <pre>
* PEPManager pepManager = PEPManager.getInstanceFor(smackConnection);
* pepManager.addPEPListener(new PEPListener() {
* PepManager pepManager = PepManager.getInstanceFor(smackConnection);
* pepManager.addPepListener(new PepListener() {
* public void eventReceived(EntityBareJid from, EventElement event, Message message) {
* LOGGER.debug("Event received: " + event);
* }
@ -68,14 +68,14 @@ import org.jxmpp.jid.EntityBareJid;
* @author Jeff Williams
* @author Florian Schmaus
*/
public final class PEPManager extends Manager {
public final class PepManager extends Manager {
private static final Map<XMPPConnection, PEPManager> INSTANCES = new WeakHashMap<>();
private static final Map<XMPPConnection, PepManager> INSTANCES = new WeakHashMap<>();
public static synchronized PEPManager getInstanceFor(XMPPConnection connection) {
PEPManager pepManager = INSTANCES.get(connection);
public static synchronized PepManager getInstanceFor(XMPPConnection connection) {
PepManager pepManager = INSTANCES.get(connection);
if (pepManager == null) {
pepManager = new PEPManager(connection);
pepManager = new PepManager(connection);
INSTANCES.put(connection, pepManager);
}
return pepManager;
@ -85,7 +85,7 @@ public final class PEPManager extends Manager {
new FromJidTypeFilter(JidType.BareJid),
EventExtensionFilter.INSTANCE);
private final Set<PEPListener> pepListeners = new CopyOnWriteArraySet<>();
private final Set<PepListener> pepListeners = new CopyOnWriteArraySet<>();
private final AsyncButOrdered<EntityBareJid> asyncButOrdered = new AsyncButOrdered<>();
@ -96,7 +96,7 @@ public final class PEPManager extends Manager {
*
* @param connection an XMPPConnection which is used to send and receive messages.
*/
private PEPManager(XMPPConnection connection) {
private PepManager(XMPPConnection connection) {
super(connection);
StanzaListener packetListener = new StanzaListener() {
@Override
@ -109,7 +109,7 @@ public final class PEPManager extends Manager {
asyncButOrdered.performAsyncButOrdered(from, new Runnable() {
@Override
public void run() {
for (PEPListener listener : pepListeners) {
for (PepListener listener : pepListeners) {
listener.eventReceived(from, event, message);
}
}
@ -133,7 +133,7 @@ public final class PEPManager extends Manager {
* @param pepListener a roster exchange listener.
* @return true if pepListener was added.
*/
public boolean addPEPListener(PEPListener pepListener) {
public boolean addPepListener(PepListener pepListener) {
return pepListeners.add(pepListener);
}
@ -143,7 +143,7 @@ public final class PEPManager extends Manager {
* @param pepListener a roster exchange listener.
* @return true, if pepListener was removed.
*/
public boolean removePEPListener(PEPListener pepListener) {
public boolean removePepListener(PepListener pepListener) {
return pepListeners.remove(pepListener);
}

View file

@ -20,7 +20,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.jivesoftware.smackx.pep.PEPManager;
import org.jivesoftware.smackx.pep.PepManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
@ -37,9 +37,9 @@ public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegr
protected final BareJid bob;
protected final BareJid chloe;
protected final PEPManager alicePepManager;
protected final PEPManager bobPepManager;
protected final PEPManager chloePepManager;
protected final PepManager alicePepManager;
protected final PepManager bobPepManager;
protected final PepManager chloePepManager;
protected AbstractOpenPgpIntegrationTest(SmackIntegrationTestEnvironment environment)
throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
@ -58,9 +58,9 @@ public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegr
this.bob = bobConnection.getUser().asBareJid();
this.chloe = chloeConnection.getUser().asBareJid();
this.alicePepManager = PEPManager.getInstanceFor(aliceConnection);
this.bobPepManager = PEPManager.getInstanceFor(bobConnection);
this.chloePepManager = PEPManager.getInstanceFor(chloeConnection);
this.alicePepManager = PepManager.getInstanceFor(aliceConnection);
this.bobPepManager = PepManager.getInstanceFor(bobConnection);
this.chloePepManager = PepManager.getInstanceFor(chloeConnection);
OpenPgpPubSubUtil.deletePubkeysListNode(alicePepManager);
OpenPgpPubSubUtil.deletePubkeysListNode(bobPepManager);
@ -70,7 +70,7 @@ public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegr
private static void throwIfPubSubNotSupported(XMPPConnection connection)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, TestNotPossibleException {
if (!PEPManager.getInstanceFor(connection).isSupported()) {
if (!PepManager.getInstanceFor(connection).isSupported()) {
throw new TestNotPossibleException("Server " + connection.getXMPPServiceDomain().toString() +
" does not support PEP.");
}

View file

@ -71,8 +71,8 @@ import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
import org.jivesoftware.smackx.omemo.trust.OmemoTrustCallback;
import org.jivesoftware.smackx.omemo.trust.TrustState;
import org.jivesoftware.smackx.omemo.util.MessageOrOmemoMessage;
import org.jivesoftware.smackx.pep.PEPListener;
import org.jivesoftware.smackx.pep.PEPManager;
import org.jivesoftware.smackx.pep.PepListener;
import org.jivesoftware.smackx.pep.PepManager;
import org.jivesoftware.smackx.pubsub.EventElement;
import org.jivesoftware.smackx.pubsub.ItemsExtension;
import org.jivesoftware.smackx.pubsub.PayloadItem;
@ -877,16 +877,16 @@ public final class OmemoManager extends Manager {
* after {@link #stopStanzaAndPEPListeners()} was called.
*/
public void resumeStanzaAndPEPListeners() {
PEPManager pepManager = PEPManager.getInstanceFor(connection());
PepManager pepManager = PepManager.getInstanceFor(connection());
CarbonManager carbonManager = CarbonManager.getInstanceFor(connection());
// Remove listeners to avoid them getting added twice
connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
carbonManager.removeCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
pepManager.removePEPListener(deviceListUpdateListener);
pepManager.removePepListener(deviceListUpdateListener);
// Add listeners
pepManager.addPEPListener(deviceListUpdateListener);
pepManager.addPepListener(deviceListUpdateListener);
connection().addAsyncStanzaListener(internalOmemoMessageStanzaListener, omemoMessageStanzaFilter);
carbonManager.addCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
}
@ -895,7 +895,7 @@ public final class OmemoManager extends Manager {
* Remove active stanza listeners needed for OMEMO.
*/
public void stopStanzaAndPEPListeners() {
PEPManager.getInstanceFor(connection()).removePEPListener(deviceListUpdateListener);
PepManager.getInstanceFor(connection()).removePepListener(deviceListUpdateListener);
connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
CarbonManager.getInstanceFor(connection()).removeCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
}
@ -990,7 +990,7 @@ public final class OmemoManager extends Manager {
/**
* PEPListener that listens for OMEMO deviceList updates.
*/
private final PEPListener deviceListUpdateListener = new PEPListener() {
private final PepListener deviceListUpdateListener = new PepListener() {
@Override
public void eventReceived(EntityBareJid from, EventElement event, Message message) {

View file

@ -67,8 +67,8 @@ import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
import org.jivesoftware.smackx.ox.store.definition.OpenPgpTrustStore;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.jivesoftware.smackx.ox.util.SecretKeyBackupHelper;
import org.jivesoftware.smackx.pep.PEPListener;
import org.jivesoftware.smackx.pep.PEPManager;
import org.jivesoftware.smackx.pep.PepListener;
import org.jivesoftware.smackx.pep.PepManager;
import org.jivesoftware.smackx.pubsub.EventElement;
import org.jivesoftware.smackx.pubsub.ItemsExtension;
import org.jivesoftware.smackx.pubsub.LeafNode;
@ -166,7 +166,7 @@ public final class OpenPgpManager extends Manager {
*/
private OpenPgpProvider provider;
private final PEPManager pepManager;
private final PepManager pepManager;
private final Set<SigncryptElementReceivedListener> signcryptElementReceivedListeners = new HashSet<>();
private final Set<SignElementReceivedListener> signElementReceivedListeners = new HashSet<>();
@ -180,7 +180,7 @@ public final class OpenPgpManager extends Manager {
private OpenPgpManager(XMPPConnection connection) {
super(connection);
ChatManager.getInstanceFor(connection).addIncomingListener(incomingOpenPgpMessageListener);
pepManager = PEPManager.getInstanceFor(connection);
pepManager = PepManager.getInstanceFor(connection);
}
/**
@ -238,7 +238,7 @@ public final class OpenPgpManager extends Manager {
/**
* Generate a fresh OpenPGP key pair, given we don't have one already.
* Publish the public key to the Public Key Node and update the Public Key Metadata Node with our keys fingerprint.
* Lastly register a {@link PEPListener} which listens for updates to Public Key Metadata Nodes.
* Lastly register a {@link PepListener} which listens for updates to Public Key Metadata Nodes.
*
* @throws NoSuchAlgorithmException if we are missing an algorithm to generate a fresh key pair.
* @throws NoSuchProviderException if we are missing a suitable {@link java.security.Provider}.
@ -278,7 +278,7 @@ public final class OpenPgpManager extends Manager {
publishPublicKey(pepManager, pubkeyElement, primaryFingerprint);
// Subscribe to public key changes
PEPManager.getInstanceFor(connection()).addPEPListener(metadataListener);
PepManager.getInstanceFor(connection()).addPepListener(metadataListener);
ServiceDiscoveryManager.getInstanceFor(connection())
.addFeature(PEP_NODE_PUBLIC_KEYS_NOTIFY);
}
@ -380,7 +380,7 @@ public final class OpenPgpManager extends Manager {
* Remove the metadata listener. This method is mainly used in tests.
*/
public void stopMetadataListener() {
PEPManager.getInstanceFor(connection()).removePEPListener(metadataListener);
PepManager.getInstanceFor(connection()).removePepListener(metadataListener);
}
/**
@ -497,11 +497,11 @@ public final class OpenPgpManager extends Manager {
*/
/**
* {@link PEPListener} that listens for changes to the OX public keys metadata node.
* {@link PepListener} that listens for changes to the OX public keys metadata node.
*
* @see <a href="https://xmpp.org/extensions/xep-0373.html#pubsub-notifications">XEP-0373 §4.4</a>
*/
private final PEPListener metadataListener = new PEPListener() {
private final PepListener metadataListener = new PepListener() {
@Override
public void eventReceived(final EntityBareJid from, final EventElement event, final Message message) {
if (PEP_NODE_PUBLIC_KEYS.equals(event.getEvent().getNode())) {

View file

@ -34,7 +34,7 @@ import org.jivesoftware.smackx.ox.OpenPgpManager;
import org.jivesoftware.smackx.ox.element.PubkeyElement;
import org.jivesoftware.smackx.ox.element.PublicKeysListElement;
import org.jivesoftware.smackx.ox.element.SecretkeyElement;
import org.jivesoftware.smackx.pep.PEPManager;
import org.jivesoftware.smackx.pep.PepManager;
import org.jivesoftware.smackx.pubsub.AccessModel;
import org.jivesoftware.smackx.pubsub.ConfigureForm;
import org.jivesoftware.smackx.pubsub.Item;
@ -123,7 +123,7 @@ public class OpenPgpPubSubUtil {
* @throws SmackException.NotConnectedException if we are not connected.
* @throws SmackException.NoResponseException if the server doesn't respond.
*/
public static void publishPublicKey(PEPManager pepManager, PubkeyElement pubkeyElement, OpenPgpV4Fingerprint fingerprint)
public static void publishPublicKey(PepManager pepManager, PubkeyElement pubkeyElement, OpenPgpV4Fingerprint fingerprint)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
@ -227,7 +227,7 @@ public class OpenPgpPubSubUtil {
* @throws SmackException.NoResponseException if the server doesn't respond.
* @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist.
*/
public static boolean deletePubkeysListNode(PEPManager pepManager)
public static boolean deletePubkeysListNode(PepManager pepManager)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
PubSubManager pm = pepManager.getPepPubSubManager();
@ -246,7 +246,7 @@ public class OpenPgpPubSubUtil {
* @throws SmackException.NoResponseException if the server doesn't respond.
* @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist.
*/
public static boolean deletePublicKeyNode(PEPManager pepManager, OpenPgpV4Fingerprint fingerprint)
public static boolean deletePublicKeyNode(PepManager pepManager, OpenPgpV4Fingerprint fingerprint)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
PubSubManager pm = pepManager.getPepPubSubManager();
@ -346,7 +346,7 @@ public class OpenPgpPubSubUtil {
if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection)) {
throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist");
}
PubSubManager pm = PEPManager.getInstanceFor(connection).getPepPubSubManager();
PubSubManager pm = PepManager.getInstanceFor(connection).getPepPubSubManager();
LeafNode secretKeyNode = pm.getOrCreateLeafNode(PEP_NODE_SECRET_KEY);
OpenPgpPubSubUtil.changeAccessModelIfNecessary(secretKeyNode, AccessModel.whitelist);
@ -368,7 +368,7 @@ public class OpenPgpPubSubUtil {
* @throws SmackException.NotConnectedException if we are not connected
* @throws SmackException.NoResponseException /watch?v=7U0FzQzJzyI
*/
public static SecretkeyElement fetchSecretKey(PEPManager pepManager)
public static SecretkeyElement fetchSecretKey(PepManager pepManager)
throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException {
PubSubManager pm = pepManager.getPepPubSubManager();
@ -393,7 +393,7 @@ public class OpenPgpPubSubUtil {
* @throws SmackException.NoResponseException if the server sends no response
* @return <code>true</code> if the node existed and was deleted, <code>false</code> if the node did not exist.
*/
public static boolean deleteSecretKeyNode(PEPManager pepManager)
public static boolean deleteSecretKeyNode(PepManager pepManager)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
PubSubManager pm = pepManager.getPepPubSubManager();