1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

s/processPacket/processStanza/ s/PacketCollector/StanzaCollector/

This commit is contained in:
Florian Schmaus 2017-01-03 11:12:34 +01:00
parent 9328182912
commit 90a5e289f8
100 changed files with 406 additions and 406 deletions

View file

@ -181,7 +181,7 @@ public final class CarbonManager extends Manager {
try {
connection().sendIqWithResponseCallback(setIQ, new StanzaListener() {
public void processPacket(Stanza packet) {
public void processStanza(Stanza packet) {
enabled_state = use;
}
}, exceptionCallback);
@ -214,7 +214,7 @@ public final class CarbonManager extends Manager {
IQ setIQ = carbonsEnabledIQ(new_state);
connection().createPacketCollectorAndSend(setIQ).nextResultOrThrow();
connection().createStanzaCollectorAndSend(setIQ).nextResultOrThrow();
enabled_state = new_state;
}

View file

@ -126,7 +126,7 @@ public final class IoTControlManager extends IoTManager {
public IoTSetResponse setUsingIq(FullJid jid, Collection<? extends SetData> data) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
IoTSetRequest request = new IoTSetRequest(data);
request.setTo(jid);
IoTSetResponse response = connection().createPacketCollectorAndSend(request).nextResultOrThrow();
IoTSetResponse response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}

View file

@ -26,7 +26,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
@ -177,14 +177,14 @@ public final class IoTDataManager extends IoTManager {
StanzaFilter dataFilter = new IoTFieldsExtensionFilter(seqNr, false);
// Setup the IoTFieldsExtension message collectors before sending the IQ to avoid a data race.
PacketCollector doneCollector = connection.createPacketCollector(doneFilter);
StanzaCollector doneCollector = connection.createStanzaCollector(doneFilter);
PacketCollector.Configuration dataCollectorConfiguration = PacketCollector.newConfiguration().setStanzaFilter(
StanzaCollector.Configuration dataCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter(
dataFilter).setCollectorToReset(doneCollector);
PacketCollector dataCollector = connection.createPacketCollector(dataCollectorConfiguration);
StanzaCollector dataCollector = connection.createStanzaCollector(dataCollectorConfiguration);
try {
connection.createPacketCollectorAndSend(iotDataRequest).nextResultOrThrow();
connection.createStanzaCollectorAndSend(iotDataRequest).nextResultOrThrow();
// Wait until a message with an IoTFieldsExtension and the done flag comes in.
doneCollector.nextResult();
}

View file

@ -241,7 +241,7 @@ public final class IoTDiscoveryManager extends Manager {
final XMPPConnection connection = connection();
IoTRegister iotRegister = new IoTRegister(thing.getMetaTags(), thing.getNodeInfo(), thing.isSelfOwened());
iotRegister.setTo(registry);
IQ result = connection.createPacketCollectorAndSend(iotRegister).nextResultOrThrow();
IQ result = connection.createStanzaCollectorAndSend(iotRegister).nextResultOrThrow();
if (result instanceof IoTClaimed) {
IoTClaimed iotClaimedResult = (IoTClaimed) result;
throw new IoTClaimedException(iotClaimedResult);
@ -288,7 +288,7 @@ public final class IoTDiscoveryManager extends Manager {
IoTMine iotMine = new IoTMine(metaTags, publicThing);
iotMine.setTo(registry);
IoTClaimed iotClaimed = connection().createPacketCollectorAndSend(iotMine).nextResultOrThrow();
IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow();
// The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed.
Jid thing = iotClaimed.getJid();
@ -317,7 +317,7 @@ public final class IoTDiscoveryManager extends Manager {
IoTRemove iotRemove = new IoTRemove(thing, nodeInfo);
iotRemove.setTo(registry);
connection().createPacketCollectorAndSend(iotRemove).nextResultOrThrow();
connection().createStanzaCollectorAndSend(iotRemove).nextResultOrThrow();
// We no not update the ThingState here, as this is done in the <removed/> IQ handler above.;
}
@ -341,7 +341,7 @@ public final class IoTDiscoveryManager extends Manager {
IoTUnregister iotUnregister = new IoTUnregister(nodeInfo);
iotUnregister.setTo(registry);
connection().createPacketCollectorAndSend(iotUnregister).nextResultOrThrow();
connection().createStanzaCollectorAndSend(iotUnregister).nextResultOrThrow();
ThingState state = getStateFor(nodeInfo);
state.setUnregistered();
@ -370,7 +370,7 @@ public final class IoTDiscoveryManager extends Manager {
IoTDisown iotDisown = new IoTDisown(thing, nodeInfo);
iotDisown.setTo(registry);
connection().createPacketCollectorAndSend(iotDisown).nextResultOrThrow();
connection().createStanzaCollectorAndSend(iotDisown).nextResultOrThrow();
}
// Registry utility methods

View file

@ -122,7 +122,7 @@ public final class IoTProvisioningManager extends Manager {
// Stanza listener for XEP-0324 § 3.2.3.
connection.addAsyncStanzaListener(new StanzaListener() {
@Override
public void processPacket(Stanza stanza) throws NotConnectedException, InterruptedException {
public void processStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
if (!isFromProvisioningService(stanza, true)) {
return;
}
@ -148,7 +148,7 @@ public final class IoTProvisioningManager extends Manager {
// (yet) part of the XEP.
connection.addAsyncStanzaListener(new StanzaListener() {
@Override
public void processPacket(final Stanza stanza) throws NotConnectedException, InterruptedException {
public void processStanza(final Stanza stanza) throws NotConnectedException, InterruptedException {
final Message friendMessage = (Message) stanza;
final Friend friend = Friend.from(friendMessage);
final BareJid friendJid = friend.getFriend();
@ -337,7 +337,7 @@ public final class IoTProvisioningManager extends Manager {
IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion);
iotIsFriend.setTo(provisioningServer);
IoTIsFriendResponse response = connection().createPacketCollectorAndSend(iotIsFriend).nextResultOrThrow();
IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow();
assert (response.getJid().equals(friendInQuestion));
boolean isFriend = response.getIsFriendResult();
if (!isFriend) {

View file

@ -25,7 +25,7 @@ import java.util.WeakHashMap;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.NotLoggedInException;
@ -413,7 +413,7 @@ public final class MamManager extends Manager {
String queryId = UUID.randomUUID().toString();
MamQueryIQ mamQueryIq = new MamQueryIQ(queryId);
MamQueryIQ mamResponseQueryIq = connection().createPacketCollectorAndSend(mamQueryIq).nextResultOrThrow();
MamQueryIQ mamResponseQueryIq = connection().createStanzaCollectorAndSend(mamQueryIq).nextResultOrThrow();
return mamResponseQueryIq.getDataForm().getFields();
}
@ -423,11 +423,11 @@ public final class MamManager extends Manager {
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
MamFinIQ mamFinIQ = null;
PacketCollector mamFinIQCollector = connection.createPacketCollector(new IQReplyFilter(mamQueryIq, connection));
StanzaCollector mamFinIQCollector = connection.createStanzaCollector(new IQReplyFilter(mamQueryIq, connection));
PacketCollector.Configuration resultCollectorConfiguration = PacketCollector.newConfiguration()
StanzaCollector.Configuration resultCollectorConfiguration = StanzaCollector.newConfiguration()
.setStanzaFilter(new MamResultFilter(mamQueryIq)).setCollectorToReset(mamFinIQCollector);
PacketCollector resultCollector = connection.createPacketCollector(resultCollectorConfiguration);
StanzaCollector resultCollector = connection.createStanzaCollector(resultCollectorConfiguration);
try {
connection.sendStanza(mamQueryIq);
@ -547,7 +547,7 @@ public final class MamManager extends Manager {
NotConnectedException, InterruptedException, NotLoggedInException {
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
MamPrefsIQ mamPrefsResultIQ = connection.createPacketCollectorAndSend(mamPrefsIQ).nextResultOrThrow();
MamPrefsIQ mamPrefsResultIQ = connection.createStanzaCollectorAndSend(mamPrefsIQ).nextResultOrThrow();
return new MamPrefsResult(mamPrefsResultIQ, DataForm.from(mamPrefsIQ));
}

View file

@ -22,7 +22,7 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.StanzaListener;
@ -86,7 +86,7 @@ public class MultiUserChatLight {
private final StanzaListener messageListener;
private PacketCollector messageCollector;
private StanzaCollector messageCollector;
MultiUserChatLight(XMPPConnection connection, EntityJid room) {
this.connection = connection;
@ -97,7 +97,7 @@ public class MultiUserChatLight {
messageListener = new StanzaListener() {
@Override
public void processPacket(Stanza packet) throws NotConnectedException {
public void processStanza(Stanza packet) throws NotConnectedException {
Message message = (Message) packet;
for (MessageListener listener : messageListeners) {
listener.processMessage(message);
@ -263,10 +263,10 @@ public class MultiUserChatLight {
throws Exception {
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter);
messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
try {
connection.createPacketCollectorAndSend(createMUCLightIQ).nextResultOrThrow();
connection.createStanzaCollectorAndSend(createMUCLightIQ).nextResultOrThrow();
} catch (InterruptedException | NoResponseException | XMPPErrorException e) {
removeConnectionCallbacks();
throw e;
@ -297,7 +297,7 @@ public class MultiUserChatLight {
affiliations.put(connection.getUser(), MUCLightAffiliation.none);
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
IQ responseIq = connection.createPacketCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
IQ responseIq = connection.createStanzaCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
boolean roomLeft = responseIq.getType().equals(IQ.Type.result);
if (roomLeft) {
@ -319,7 +319,7 @@ public class MultiUserChatLight {
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetInfoIQ mucLightGetInfoIQ = new MUCLightGetInfoIQ(room, version);
IQ responseIq = connection.createPacketCollectorAndSend(mucLightGetInfoIQ).nextResultOrThrow();
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetInfoIQ).nextResultOrThrow();
MUCLightInfoIQ mucLightInfoResponseIQ = (MUCLightInfoIQ) responseIq;
return new MUCLightRoomInfo(mucLightInfoResponseIQ.getVersion(), room,
@ -353,7 +353,7 @@ public class MultiUserChatLight {
public MUCLightRoomConfiguration getConfiguration(String version)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(room, version);
IQ responseIq = connection.createPacketCollectorAndSend(mucLightGetConfigsIQ).nextResultOrThrow();
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetConfigsIQ).nextResultOrThrow();
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) responseIq;
return mucLightConfigurationIQ.getConfiguration();
}
@ -386,7 +386,7 @@ public class MultiUserChatLight {
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
IQ responseIq = connection.createPacketCollectorAndSend(mucLightGetAffiliationsIQ).nextResultOrThrow();
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetAffiliationsIQ).nextResultOrThrow();
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) responseIq;
return mucLightAffiliationsIQ.getAffiliations();
@ -418,7 +418,7 @@ public class MultiUserChatLight {
public void changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
connection.createPacketCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
connection.createStanzaCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
}
/**
@ -431,7 +431,7 @@ public class MultiUserChatLight {
*/
public void destroy() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(room);
IQ responseIq = connection.createPacketCollectorAndSend(mucLightDestroyIQ).nextResultOrThrow();
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightDestroyIQ).nextResultOrThrow();
boolean roomDestroyed = responseIq.getType().equals(IQ.Type.result);
if (roomDestroyed) {
@ -451,7 +451,7 @@ public class MultiUserChatLight {
public void changeSubject(String subject)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, null, subject, null);
connection.createPacketCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
}
/**
@ -466,7 +466,7 @@ public class MultiUserChatLight {
public void changeRoomName(String roomName)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, null);
connection.createPacketCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
}
/**
@ -496,7 +496,7 @@ public class MultiUserChatLight {
public void setRoomConfigs(String roomName, HashMap<String, String> customConfigs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs);
connection.createPacketCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
}
}

View file

@ -230,7 +230,7 @@ public final class MultiUserChatLightManager extends Manager {
mucLightBlockingIQ.setTo(mucLightService);
StanzaFilter responseFilter = new IQReplyFilter(mucLightBlockingIQ, connection());
IQ responseIq = connection().createPacketCollectorAndSend(responseFilter, mucLightBlockingIQ)
IQ responseIq = connection().createStanzaCollectorAndSend(responseFilter, mucLightBlockingIQ)
.nextResultOrThrow();
MUCLightBlockingIQ muclIghtBlockingIQResult = (MUCLightBlockingIQ) responseIq;
@ -278,7 +278,7 @@ public final class MultiUserChatLightManager extends Manager {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService);
connection().createPacketCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
}
/**
@ -322,7 +322,7 @@ public final class MultiUserChatLightManager extends Manager {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService);
connection().createPacketCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
}
/**
@ -366,7 +366,7 @@ public final class MultiUserChatLightManager extends Manager {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService);
connection().createPacketCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
}
/**
@ -410,7 +410,7 @@ public final class MultiUserChatLightManager extends Manager {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService);
connection().createPacketCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
}
}

View file

@ -162,7 +162,7 @@ public final class PushNotificationsManager extends Manager {
private boolean changePushNotificationsStatus(IQ iq)
throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
final XMPPConnection connection = connection();
IQ responseIQ = connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
IQ responseIQ = connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
return responseIQ.getType() != Type.error;
}