mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 02:27:58 +01:00
s/processPacket/processStanza/ s/PacketCollector/StanzaCollector/
This commit is contained in:
parent
9328182912
commit
90a5e289f8
100 changed files with 406 additions and 406 deletions
|
@ -89,7 +89,7 @@ req.setTo("juliet@capulet.com/balcony");
|
|||
|
||||
// send it
|
||||
connection.sendIqWithResponseCallback(req, new PacketListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza iq) {
|
||||
HttpOverXmppResp resp = (HttpOverXmppResp) iq;
|
||||
// check HTTP response code
|
||||
if (resp.getStatusCode() == 200) {
|
||||
|
|
|
@ -143,8 +143,8 @@ XHTML bodies of any received message.
|
|||
```
|
||||
// Create a listener for the chat and display any XHTML content
|
||||
PacketListener packetListener = new PacketListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
public void processStanza(Stanza stanza) {
|
||||
Message message = (Message) stanza;
|
||||
// Obtain the XHTML bodies of the message
|
||||
List<CharSequence> bodies = XHTMLManager.getBodies(message);
|
||||
if (bodies != null) {
|
||||
|
|
|
@ -29,13 +29,13 @@ PacketCollector myCollector = connection.createPacketCollector(filter);
|
|||
// Normally, you'd do something with the collector, like wait for new packets.
|
||||
|
||||
// Next, create a packet listener. We use an anonymous inner class for brevity.
|
||||
PacketListener myListener = new PacketListener() {
|
||||
**public** **void** processPacket(Packet packet) {
|
||||
// Do something with the incoming packet here._
|
||||
StanzaListener myListener = new StanzaListener() {
|
||||
**public** **void** processStanza(Stanza stanza) {
|
||||
// Do something with the incoming stanza here._
|
||||
}
|
||||
};
|
||||
// Register the listener._
|
||||
connection.addPacketListener(myListener, filter);
|
||||
connection.addStanzaListener(myListener, filter);
|
||||
```
|
||||
|
||||
Standard Stanza Filters
|
||||
|
|
|
@ -34,15 +34,15 @@ public class FloodTest extends SmackTestCase {
|
|||
public void testMessageFlood() {
|
||||
try {
|
||||
Chat chat11 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
PacketCollector chat12 = getConnection(1).createPacketCollector(
|
||||
StanzaCollector chat12 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat11.getThreadID()));
|
||||
|
||||
Chat chat21 = getConnection(0).getChatManager().createChat(getBareJID(2), null);
|
||||
PacketCollector chat22 = getConnection(2).createPacketCollector(
|
||||
StanzaCollector chat22 = getConnection(2).createStanzaCollector(
|
||||
new ThreadFilter(chat21.getThreadID()));
|
||||
|
||||
Chat chat31 = getConnection(0).getChatManager().createChat(getBareJID(3), null);
|
||||
PacketCollector chat32 = getConnection(3).createPacketCollector(
|
||||
StanzaCollector chat32 = getConnection(3).createStanzaCollector(
|
||||
new ThreadFilter(chat31.getThreadID()));
|
||||
|
||||
for (int i=0; i<500; i++) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class IQTest extends SmackTestCase {
|
|||
|
||||
PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getStanzaId()),
|
||||
new StanzaTypeFilter(IQ.class));
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(filter);
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(filter);
|
||||
// Send the iq packet with an invalid namespace
|
||||
getConnection(0).sendStanza(iq);
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class IQTest extends SmackTestCase {
|
|||
versionRequest.setTo(getBareJID(0) + "/Something");
|
||||
|
||||
// Create a packet collector to listen for a response.
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(
|
||||
new PacketIDFilter(versionRequest.getStanzaId()));
|
||||
|
||||
getConnection(0).sendStanza(versionRequest);
|
||||
|
|
|
@ -48,8 +48,8 @@ public class MessageTest extends SmackTestCase {
|
|||
presence.setTo(getBareJID(1));
|
||||
getConnection(0).sendStanza(presence);
|
||||
|
||||
PacketCollector collector = getConnection(0)
|
||||
.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector collector = getConnection(0)
|
||||
.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
try {
|
||||
getConnection(1).getChatManager().createChat(getBareJID(0), null).sendMessage("Test 1");
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class MessageTest extends SmackTestCase {
|
|||
|
||||
// User1 sends some messages to User2 which is not available at the moment
|
||||
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(1).createStanzaCollector(
|
||||
new MessageTypeFilter(Message.Type.chat));
|
||||
chat.sendMessage("Test 1");
|
||||
chat.sendMessage("Test 2");
|
||||
|
@ -119,7 +119,7 @@ public class MessageTest extends SmackTestCase {
|
|||
|
||||
// User1 sends some messages to User2 which is not available at the moment
|
||||
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(1).createStanzaCollector(
|
||||
new MessageTypeFilter(Message.Type.chat));
|
||||
chat.sendMessage("Test \f 1");
|
||||
chat.sendMessage("Test \r 1");
|
||||
|
@ -153,7 +153,7 @@ public class MessageTest extends SmackTestCase {
|
|||
getConnection(0).sendStanza(new Presence(Presence.Type.available));
|
||||
getConnection(1).sendStanza(new Presence(Presence.Type.available));
|
||||
// User2 becomes available again
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(1).createStanzaCollector(
|
||||
new MessageTypeFilter(Message.Type.chat));
|
||||
|
||||
// Create message with a body of 4K characters
|
||||
|
@ -210,8 +210,8 @@ public class MessageTest extends SmackTestCase {
|
|||
Thread.sleep(200);
|
||||
|
||||
// User0 listen in both connected clients
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
|
||||
// User1 sends a message to the bare JID of User0
|
||||
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
|
||||
|
@ -259,8 +259,8 @@ public class MessageTest extends SmackTestCase {
|
|||
Thread.sleep(200);
|
||||
|
||||
// User0 listen in both connected clients
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
|
||||
// User1 sends a message to the bare JID of User0
|
||||
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
|
||||
|
@ -321,9 +321,9 @@ public class MessageTest extends SmackTestCase {
|
|||
Thread.sleep(200);
|
||||
|
||||
// User0 listen in both connected clients
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
PacketCollector coll4 = conn4.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector coll4 = conn4.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
|
||||
// Send a message from this resource to indicate most recent activity
|
||||
conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain()));
|
||||
|
@ -368,7 +368,7 @@ public class MessageTest extends SmackTestCase {
|
|||
Thread.sleep(200);
|
||||
|
||||
// User0 listen for incoming traffic
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||
|
||||
// User1 sends a message to the bare JID of User0
|
||||
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
iqPacket.setType(IQ.Type.get);
|
||||
|
||||
// Send the IQ and wait for the answer
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(
|
||||
new PacketIDFilter(iqPacket.getStanzaId()));
|
||||
getConnection(0).sendStanza(iqPacket);
|
||||
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||
|
@ -100,7 +100,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
public void testRemoveListener() {
|
||||
|
||||
PacketListener listener = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
|
@ -135,7 +135,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
|
||||
// User1 will always reply to user0 when a message is received
|
||||
getConnection(1).addAsyncPacketListener(new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
System.out.println(new Date() + " " + packet);
|
||||
|
||||
Message message = new Message(packet.getFrom());
|
||||
|
@ -146,7 +146,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
}, new StanzaTypeFilter(Message.class));
|
||||
|
||||
// User0 listen for replies from user1
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(
|
||||
new FromMatchesFilter(getFullJID(1)));
|
||||
// User0 sends the regular message to user1
|
||||
getConnection(0).sendStanza(packet);
|
||||
|
@ -176,7 +176,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
for (int j = 0; j < repeat; j++) {
|
||||
|
||||
PacketListener listener0 = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
System.out.println("Packet Captured");
|
||||
incCounter();
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
};
|
||||
|
||||
PacketListener listener1 = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
System.out.println("Packet Captured");
|
||||
incCounter();
|
||||
}
|
||||
|
|
|
@ -111,17 +111,17 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
new CopyOnWriteArraySet<ConnectionListener>();
|
||||
|
||||
/**
|
||||
* A collection of PacketCollectors which collects packets for a specified filter
|
||||
* A collection of StanzaCollectors which collects packets for a specified filter
|
||||
* and perform blocking and polling operations on the result queue.
|
||||
* <p>
|
||||
* We use a ConcurrentLinkedQueue here, because its Iterator is weakly
|
||||
* consistent and we want {@link #invokePacketCollectors(Stanza)} for-each
|
||||
* loop to be lock free. As drawback, removing a PacketCollector is O(n).
|
||||
* consistent and we want {@link #invokeStanzaCollectorsAndNotifyRecvListeners(Stanza)} for-each
|
||||
* loop to be lock free. As drawback, removing a StanzaCollector is O(n).
|
||||
* The alternative would be a synchronized HashSet, but this would mean a
|
||||
* synchronized block around every usage of <code>collectors</code>.
|
||||
* </p>
|
||||
*/
|
||||
private final Collection<PacketCollector> collectors = new ConcurrentLinkedQueue<PacketCollector>();
|
||||
private final Collection<StanzaCollector> collectors = new ConcurrentLinkedQueue<>();
|
||||
|
||||
/**
|
||||
* List of PacketListeners that will be notified synchronously when a new stanza(/packet) was received.
|
||||
|
@ -531,7 +531,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
// Note that we can not use IQReplyFilter here, since the users full JID is not yet
|
||||
// available. It will become available right after the resource has been successfully bound.
|
||||
Bind bindResource = Bind.newSet(resource);
|
||||
PacketCollector packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(bindResource), bindResource);
|
||||
StanzaCollector packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(bindResource), bindResource);
|
||||
Bind response = packetCollector.nextResultOrThrow();
|
||||
// Set the connections user to the result of resource binding. It is important that we don't infer the user
|
||||
// from the login() arguments and the configurations service name, as, for example, when SASL External is used,
|
||||
|
@ -547,7 +547,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
boolean legacySessionDisabled = getConfiguration().isLegacySessionDisabled();
|
||||
if (sessionFeature != null && !sessionFeature.isOptional() && !legacySessionDisabled) {
|
||||
Session session = new Session();
|
||||
packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(session), session);
|
||||
packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(session), session);
|
||||
packetCollector.nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
|
@ -743,18 +743,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException {
|
||||
public StanzaCollector createStanzaCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException {
|
||||
StanzaFilter packetFilter = new IQReplyFilter(packet, this);
|
||||
// Create the packet collector before sending the packet
|
||||
PacketCollector packetCollector = createPacketCollectorAndSend(packetFilter, packet);
|
||||
StanzaCollector packetCollector = createStanzaCollectorAndSend(packetFilter, packet);
|
||||
return packetCollector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
|
||||
public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
|
||||
throws NotConnectedException, InterruptedException {
|
||||
// Create the packet collector before sending the packet
|
||||
PacketCollector packetCollector = createPacketCollector(packetFilter);
|
||||
StanzaCollector packetCollector = createStanzaCollector(packetFilter);
|
||||
try {
|
||||
// Now we can send the packet as the collector has been created
|
||||
sendStanza(packet);
|
||||
|
@ -767,21 +767,21 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PacketCollector createPacketCollector(StanzaFilter packetFilter) {
|
||||
PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setStanzaFilter(packetFilter);
|
||||
return createPacketCollector(configuration);
|
||||
public StanzaCollector createStanzaCollector(StanzaFilter packetFilter) {
|
||||
StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration().setStanzaFilter(packetFilter);
|
||||
return createStanzaCollector(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketCollector createPacketCollector(PacketCollector.Configuration configuration) {
|
||||
PacketCollector collector = new PacketCollector(this, configuration);
|
||||
public StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration) {
|
||||
StanzaCollector collector = new StanzaCollector(this, configuration);
|
||||
// Add the collector to the list of active collectors.
|
||||
collectors.add(collector);
|
||||
return collector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePacketCollector(PacketCollector collector) {
|
||||
public void removeStanzaCollector(StanzaCollector collector) {
|
||||
collectors.remove(collector);
|
||||
}
|
||||
|
||||
|
@ -878,7 +878,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
public void run() {
|
||||
for (StanzaListener listener : listenersToNotify) {
|
||||
try {
|
||||
listener.processPacket(packet);
|
||||
listener.processStanza(packet);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Sending listener threw exception", e);
|
||||
|
@ -926,7 +926,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
for (StanzaListener interceptor : interceptorsToInvoke) {
|
||||
try {
|
||||
interceptor.processPacket(packet);
|
||||
interceptor.processStanza(packet);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.SEVERE, "Packet interceptor threw exception", e);
|
||||
}
|
||||
|
@ -1033,18 +1033,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
executorService.executeBlocking(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
invokePacketCollectorsAndNotifyRecvListeners(stanza);
|
||||
invokeStanzaCollectorsAndNotifyRecvListeners(stanza);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link PacketCollector#processPacket(Stanza)} for every
|
||||
* PacketCollector with the given packet. Also notify the receive listeners with a matching stanza(/packet) filter about the packet.
|
||||
* Invoke {@link StanzaCollector#processStanza(Stanza)} for every
|
||||
* StanzaCollector with the given packet. Also notify the receive listeners with a matching stanza(/packet) filter about the packet.
|
||||
*
|
||||
* @param packet the stanza(/packet) to notify the PacketCollectors and receive listeners about.
|
||||
* @param packet the stanza(/packet) to notify the StanzaCollectors and receive listeners about.
|
||||
*/
|
||||
protected void invokePacketCollectorsAndNotifyRecvListeners(final Stanza packet) {
|
||||
protected void invokeStanzaCollectorsAndNotifyRecvListeners(final Stanza packet) {
|
||||
if (packet instanceof IQ) {
|
||||
final IQ iq = (IQ) packet;
|
||||
final IQ.Type type = iq.getType();
|
||||
|
@ -1140,7 +1140,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
listener.processPacket(packet);
|
||||
listener.processStanza(packet);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.SEVERE, "Exception in async packet listener", e);
|
||||
}
|
||||
|
@ -1149,8 +1149,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
// Loop through all collectors and notify the appropriate ones.
|
||||
for (PacketCollector collector: collectors) {
|
||||
collector.processPacket(packet);
|
||||
for (StanzaCollector collector: collectors) {
|
||||
collector.processStanza(packet);
|
||||
}
|
||||
|
||||
// Notify the receive listeners interested in the packet
|
||||
|
@ -1170,7 +1170,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
public void run() {
|
||||
for (StanzaListener listener : listenersToNotify) {
|
||||
try {
|
||||
listener.processPacket(packet);
|
||||
listener.processStanza(packet);
|
||||
} catch(NotConnectedException e) {
|
||||
LOGGER.log(Level.WARNING, "Got not connected exception, aborting", e);
|
||||
break;
|
||||
|
@ -1471,10 +1471,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
|
||||
final StanzaListener packetListener = new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
try {
|
||||
XMPPErrorException.ifHasErrorThenThrow(packet);
|
||||
callback.processPacket(packet);
|
||||
callback.processStanza(packet);
|
||||
}
|
||||
catch (XMPPErrorException e) {
|
||||
if (exceptionCallback != null) {
|
||||
|
@ -1532,9 +1532,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
public void addOneTimeSyncCallback(final StanzaListener callback, final StanzaFilter packetFilter) {
|
||||
final StanzaListener packetListener = new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
try {
|
||||
callback.processPacket(packet);
|
||||
callback.processStanza(packet);
|
||||
} finally {
|
||||
removeSyncStanzaListener(this);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public final class SmackConfiguration {
|
|||
*
|
||||
* @return The number of packets to queue before deleting older packets.
|
||||
*/
|
||||
public static int getPacketCollectorSize() {
|
||||
public static int getStanzaCollectorSize() {
|
||||
return packetCollectorSize;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public final class SmackConfiguration {
|
|||
*
|
||||
* @param collectorSize the number of packets to queue before deleting older packets.
|
||||
*/
|
||||
public static void setPacketCollectorSize(int collectorSize) {
|
||||
public static void setStanzaCollectorSize(int collectorSize) {
|
||||
packetCollectorSize = collectorSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class SmackException extends Exception {
|
|||
}
|
||||
|
||||
public static NoResponseException newWith(XMPPConnection connection,
|
||||
PacketCollector collector) {
|
||||
StanzaCollector collector) {
|
||||
return newWith(connection, collector.getStanzaFilter());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2003-2007 Jive Software.
|
||||
* Copyright 2003-2007 Jive Software, 2016-2017 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,20 +27,20 @@ import org.jivesoftware.smack.filter.StanzaFilter;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* Provides a mechanism to collect packets into a result queue that pass a
|
||||
* specified filter. The collector lets you perform blocking and polling
|
||||
* operations on the result queue. So, a PacketCollector is more suitable to
|
||||
* Provides a mechanism to collect Stanzas into a result queue that pass a
|
||||
* specified filter/matcher. The collector lets you perform blocking and polling
|
||||
* operations on the result queue. So, a StanzaCollector is more suitable to
|
||||
* use than a {@link StanzaListener} when you need to wait for a specific
|
||||
* result.<p>
|
||||
*
|
||||
* Each stanza(/packet) collector will queue up a configured number of packets for processing before
|
||||
* older packets are automatically dropped. The default number is retrieved by
|
||||
* {@link SmackConfiguration#getPacketCollectorSize()}.
|
||||
* {@link SmackConfiguration#getStanzaCollectorSize()}.
|
||||
*
|
||||
* @see XMPPConnection#createPacketCollector(StanzaFilter)
|
||||
* @see XMPPConnection#createStanzaCollector(StanzaFilter)
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
public class PacketCollector {
|
||||
public class StanzaCollector {
|
||||
|
||||
private final StanzaFilter packetFilter;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class PacketCollector {
|
|||
/**
|
||||
* The stanza(/packet) collector which timeout for the next result will get reset once this collector collects a stanza.
|
||||
*/
|
||||
private final PacketCollector collectorToReset;
|
||||
private final StanzaCollector collectorToReset;
|
||||
|
||||
private final XMPPConnection connection;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class PacketCollector {
|
|||
* @param connection the connection the collector is tied to.
|
||||
* @param configuration the configuration used to construct this collector
|
||||
*/
|
||||
protected PacketCollector(XMPPConnection connection, Configuration configuration) {
|
||||
protected StanzaCollector(XMPPConnection connection, Configuration configuration) {
|
||||
this.connection = connection;
|
||||
this.packetFilter = configuration.packetFilter;
|
||||
this.resultQueue = new ArrayBlockingQueue<>(configuration.size);
|
||||
|
@ -78,7 +78,7 @@ public class PacketCollector {
|
|||
// If the packet collector has already been cancelled, do nothing.
|
||||
if (!cancelled) {
|
||||
cancelled = true;
|
||||
connection.removePacketCollector(this);
|
||||
connection.removeStanzaCollector(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class PacketCollector {
|
|||
*
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
protected void processPacket(Stanza packet) {
|
||||
protected void processStanza(Stanza packet) {
|
||||
if (packetFilter == null || packetFilter.accept(packet)) {
|
||||
// CHECKSTYLE:OFF
|
||||
while (!resultQueue.offer(packet)) {
|
||||
|
@ -305,8 +305,8 @@ public class PacketCollector {
|
|||
|
||||
public static final class Configuration {
|
||||
private StanzaFilter packetFilter;
|
||||
private int size = SmackConfiguration.getPacketCollectorSize();
|
||||
private PacketCollector collectorToReset;
|
||||
private int size = SmackConfiguration.getStanzaCollectorSize();
|
||||
private StanzaCollector collectorToReset;
|
||||
|
||||
private Configuration() {
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public class PacketCollector {
|
|||
* @param collector
|
||||
* @return a reference to this configuration.
|
||||
*/
|
||||
public Configuration setCollectorToReset(PacketCollector collector) {
|
||||
public Configuration setCollectorToReset(StanzaCollector collector) {
|
||||
this.collectorToReset = collector;
|
||||
return this;
|
||||
}
|
|
@ -23,8 +23,8 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
/**
|
||||
* Provides a mechanism to listen for packets that pass a specified filter.
|
||||
* This allows event-style programming -- every time a new stanza(/packet) is found,
|
||||
* the {@link #processPacket(Stanza)} method will be called. This is the
|
||||
* opposite approach to the functionality provided by a {@link PacketCollector}
|
||||
* the {@link #processStanza(Stanza)} method will be called. This is the
|
||||
* opposite approach to the functionality provided by a {@link StanzaCollector}
|
||||
* which lets you block while waiting for results.
|
||||
* <p>
|
||||
* Additionally you are able to intercept Packets that are going to be send and
|
||||
|
@ -50,6 +50,6 @@ public interface StanzaListener {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException;
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException;
|
||||
|
||||
}
|
||||
|
|
|
@ -225,11 +225,11 @@ public interface XMPPConnection {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException;
|
||||
public StanzaCollector createStanzaCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter determines
|
||||
* which packets will be accumulated by the collector. A PacketCollector is
|
||||
* which packets will be accumulated by the collector. A StanzaCollector is
|
||||
* more suitable to use than a {@link StanzaListener} when you need to wait for
|
||||
* a specific result.
|
||||
*
|
||||
|
@ -239,46 +239,46 @@ public interface XMPPConnection {
|
|||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
|
||||
public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
|
||||
throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter
|
||||
* determines which packets will be accumulated by the collector. A
|
||||
* PacketCollector is more suitable to use than a {@link StanzaListener}
|
||||
* StanzaCollector is more suitable to use than a {@link StanzaListener}
|
||||
* when you need to wait for a specific result.
|
||||
* <p>
|
||||
* <b>Note:</b> If you send a Stanza(/Packet) right after using this method, then
|
||||
* consider using
|
||||
* {@link #createPacketCollectorAndSend(StanzaFilter, Stanza)} instead.
|
||||
* Otherwise make sure cancel the PacketCollector in every case, e.g. even
|
||||
* if an exception is thrown, or otherwise you may leak the PacketCollector.
|
||||
* {@link #createStanzaCollectorAndSend(StanzaFilter, Stanza)} instead.
|
||||
* Otherwise make sure cancel the StanzaCollector in every case, e.g. even
|
||||
* if an exception is thrown, or otherwise you may leak the StanzaCollector.
|
||||
* </p>
|
||||
*
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @return a new stanza(/packet) collector.
|
||||
*/
|
||||
public PacketCollector createPacketCollector(StanzaFilter packetFilter);
|
||||
public StanzaCollector createStanzaCollector(StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Create a new stanza(/packet) collector with the given stanza(/packet) collector configuration.
|
||||
* <p>
|
||||
* Please make sure to cancel the collector when it is no longer required. See also
|
||||
* {@link #createPacketCollector(StanzaFilter)}.
|
||||
* {@link #createStanzaCollector(StanzaFilter)}.
|
||||
* </p>
|
||||
*
|
||||
* @param configuration the stanza(/packet) collector configuration.
|
||||
* @return a new stanza(/packet) collector.
|
||||
* @since 4.1
|
||||
*/
|
||||
public PacketCollector createPacketCollector(PacketCollector.Configuration configuration);
|
||||
public StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration);
|
||||
|
||||
/**
|
||||
* Remove a stanza(/packet) collector of this connection.
|
||||
*
|
||||
* @param collector a stanza(/packet) collectors which was created for this connection.
|
||||
*/
|
||||
public void removePacketCollector(PacketCollector collector);
|
||||
public void removeStanzaCollector(StanzaCollector collector);
|
||||
|
||||
/**
|
||||
* Registers a stanza(/packet) listener with this connection.
|
||||
|
@ -316,7 +316,7 @@ public interface XMPPConnection {
|
|||
* incoming stanzas. Only use this kind of stanza(/packet) filter if it does not perform any XMPP activity that waits for a
|
||||
* response. Consider using {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} when possible, i.e. when
|
||||
* the invocation order doesn't have to be the same as the order of the arriving packets. If the order of the
|
||||
* arriving packets, consider using a {@link PacketCollector} when possible.
|
||||
* arriving packets, consider using a {@link StanzaCollector} when possible.
|
||||
* </p>
|
||||
*
|
||||
* @param packetListener the stanza(/packet) listener to notify of new received packets.
|
||||
|
|
|
@ -68,7 +68,7 @@ public abstract class AbstractDebugger implements SmackDebugger {
|
|||
// the GUI. This is what we call "interpreted" packet data, since it's the packet
|
||||
// data as Smack sees it and not as it's coming in as raw XML.
|
||||
listener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
if (printInterpreted) {
|
||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + packet.toXML());
|
||||
}
|
||||
|
|
|
@ -37,10 +37,10 @@ package org.jivesoftware.smack.filter;
|
|||
* }
|
||||
* };
|
||||
* // Create a new stanza(/packet) collector using the filter we created.
|
||||
* PacketCollector myCollector = packetReader.createPacketCollector(myFilter);
|
||||
* StanzaCollector myCollector = packetReader.createStanzaCollector(myFilter);
|
||||
* </pre>
|
||||
*
|
||||
* @see org.jivesoftware.smack.PacketCollector
|
||||
* @see org.jivesoftware.smack.StanzaCollector
|
||||
* @see org.jivesoftware.smack.StanzaListener
|
||||
* @author Matt Tucker
|
||||
* @deprecated use {@link StanzaFilter}
|
||||
|
|
|
@ -39,10 +39,10 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
* }
|
||||
* };
|
||||
* // Create a new stanza collector using the filter we created.
|
||||
* PacketCollector myCollector = connection.createPacketCollector(myFilter);
|
||||
* StanzaCollector myCollector = connection.createStanzaCollector(myFilter);
|
||||
* </pre>
|
||||
*
|
||||
* @see org.jivesoftware.smack.PacketCollector
|
||||
* @see org.jivesoftware.smack.StanzaCollector
|
||||
* @see org.jivesoftware.smack.StanzaListener
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Allows {@link org.jivesoftware.smack.PacketCollector} and {@link org.jivesoftware.smack.StanzaListener} instances to filter for stanzas with particular attributes.
|
||||
* Allows {@link org.jivesoftware.smack.StanzaCollector} and {@link org.jivesoftware.smack.StanzaListener} instances to filter for stanzas with particular attributes.
|
||||
*/
|
||||
package org.jivesoftware.smack.filter;
|
||||
|
|
|
@ -180,7 +180,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
|||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
public void processStanza(Stanza packet) {
|
||||
invokePacketCollectorsAndNotifyRecvListeners(packet);
|
||||
invokeStanzaCollectorsAndNotifyRecvListeners(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,18 +23,18 @@ import org.jivesoftware.smack.filter.StanzaFilter;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PacketCollectorTest
|
||||
public class StanzaCollectorTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void verifyRollover() throws InterruptedException
|
||||
{
|
||||
TestPacketCollector collector = new TestPacketCollector(null, new OKEverything(), 5);
|
||||
TestStanzaCollector collector = new TestStanzaCollector(null, new OKEverything(), 5);
|
||||
|
||||
for (int i=0; i<6; i++)
|
||||
{
|
||||
Stanza testPacket = new TestPacket(i);
|
||||
collector.processPacket(testPacket);
|
||||
collector.processStanza(testPacket);
|
||||
}
|
||||
|
||||
// Assert that '0' has rolled off
|
||||
|
@ -48,7 +48,7 @@ public class PacketCollectorTest
|
|||
for (int i=10; i<15; i++)
|
||||
{
|
||||
Stanza testPacket = new TestPacket(i);
|
||||
collector.processPacket(testPacket);
|
||||
collector.processStanza(testPacket);
|
||||
}
|
||||
|
||||
assertEquals("10", collector.nextResultBlockForever().getStanzaId());
|
||||
|
@ -69,7 +69,7 @@ public class PacketCollectorTest
|
|||
public void verifyThreadSafety()
|
||||
{
|
||||
int insertCount = 500;
|
||||
final TestPacketCollector collector = new TestPacketCollector(null, new OKEverything(), insertCount);
|
||||
final TestStanzaCollector collector = new TestStanzaCollector(null, new OKEverything(), insertCount);
|
||||
|
||||
Thread consumer1 = new Thread(new Runnable()
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ public class PacketCollectorTest
|
|||
|
||||
for(int i=0; i<insertCount; i++)
|
||||
{
|
||||
collector.processPacket(new TestPacket(i));
|
||||
collector.processStanza(new TestPacket(i));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -186,11 +186,11 @@ public class PacketCollectorTest
|
|||
|
||||
}
|
||||
|
||||
class TestPacketCollector extends PacketCollector
|
||||
class TestStanzaCollector extends StanzaCollector
|
||||
{
|
||||
protected TestPacketCollector(XMPPConnection conection, StanzaFilter packetFilter, int size)
|
||||
protected TestStanzaCollector(XMPPConnection conection, StanzaFilter packetFilter, int size)
|
||||
{
|
||||
super(conection, PacketCollector.newConfiguration().setStanzaFilter(packetFilter).setSize(size));
|
||||
super(conection, StanzaCollector.newConfiguration().setStanzaFilter(packetFilter).setSize(size));
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ public class WaitForPacketListener implements StanzaListener {
|
|||
private CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
reportInvoked();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class SLF4JLoggingPacketListener implements StanzaListener {
|
|||
this.prefix = Validate.notNull(prefix);
|
||||
}
|
||||
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||
logger.debug("{}: PKT [{}] '{}'", prefix, packet.getClass().getName(), packet.toXML());
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
packetReaderListener = new StanzaListener() {
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");
|
||||
|
||||
public void processPacket(final Stanza packet) {
|
||||
public void processStanza(final Stanza packet) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
addReadPacketToTable(dateFormatter, packet);
|
||||
|
@ -223,7 +223,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
packetWriterListener = new StanzaListener() {
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");
|
||||
|
||||
public void processPacket(final Stanza packet) {
|
||||
public void processStanza(final Stanza packet) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
addSentPacketToTable(dateFormatter, packet);
|
||||
|
|
|
@ -262,7 +262,7 @@ public class LiteDebugger implements SmackDebugger {
|
|||
// the GUI. This is what we call "interpreted" packet data, since it's the packet
|
||||
// data as Smack sees it and not as it's coming in as raw XML.
|
||||
listener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
interpretedText1.append(packet.toXML().toString());
|
||||
interpretedText2.append(packet.toXML().toString());
|
||||
interpretedText1.append(NEWLINE);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CompressionTest extends SmackTestCase {
|
|||
version.setTo(getXMPPServiceDomain());
|
||||
|
||||
// Create a packet collector to listen for a response.
|
||||
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getStanzaId()));
|
||||
StanzaCollector collector = connection.createStanzaCollector(new PacketIDFilter(version.getStanzaId()));
|
||||
|
||||
connection.sendStanza(version);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.ThreadFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
@ -77,9 +77,9 @@ public class FormTest extends SmackTestCase {
|
|||
|
||||
// Create the chats between the two participants
|
||||
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(
|
||||
new ThreadFilter(chat.getThreadID()));
|
||||
PacketCollector collector2 = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat.getThreadID()));
|
||||
|
||||
Message msg = new Message();
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
|||
*/
|
||||
public class GroupChatInvitationTest extends SmackTestCase {
|
||||
|
||||
private PacketCollector collector = null;
|
||||
private StanzaCollector collector = null;
|
||||
|
||||
/**
|
||||
* Constructor for GroupChatInvitationTest.
|
||||
|
@ -68,7 +68,7 @@ public class GroupChatInvitationTest extends SmackTestCase {
|
|||
super.setUp();
|
||||
// Register listener for groupchat invitations.
|
||||
PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference");
|
||||
collector = getConnection(1).createPacketCollector(filter);
|
||||
collector = getConnection(1).createStanzaCollector(filter);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
||||
|
@ -45,12 +45,12 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
|
|||
*/
|
||||
public void testSending() throws XMPPException {
|
||||
|
||||
PacketCollector collector1 =
|
||||
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector2 =
|
||||
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector3 =
|
||||
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector1 =
|
||||
getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector2 =
|
||||
getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector3 =
|
||||
getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
|
||||
Message message = new Message();
|
||||
message.setBody("Hola");
|
||||
|
@ -110,14 +110,14 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
|
|||
* Ensures that replying to packets is ok.
|
||||
*/
|
||||
public void testReplying() throws XMPPException {
|
||||
PacketCollector collector0 =
|
||||
getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector1 =
|
||||
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector2 =
|
||||
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector3 =
|
||||
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector0 =
|
||||
getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector1 =
|
||||
getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector2 =
|
||||
getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector3 =
|
||||
getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
|
||||
// Send the intial message with multiple recipients
|
||||
Message message = new Message();
|
||||
|
@ -192,12 +192,12 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
|
|||
* Ensures that replying is not allowed when disabled.
|
||||
*/
|
||||
public void testNoReply() throws XMPPException {
|
||||
PacketCollector collector1 =
|
||||
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector2 =
|
||||
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
PacketCollector collector3 =
|
||||
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector1 =
|
||||
getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector2 =
|
||||
getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
StanzaCollector collector3 =
|
||||
getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
|
||||
|
||||
// Send the intial message with multiple recipients
|
||||
Message message = new Message();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.jivesoftware.smackx;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
@ -98,7 +98,7 @@ public class OfflineMessageManagerTest extends SmackTestCase {
|
|||
assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount());
|
||||
|
||||
// User2 becomes available again
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(1).createStanzaCollector(
|
||||
new MessageTypeFilter(Message.Type.chat));
|
||||
getConnection(1).sendStanza(new Presence(Presence.Type.available));
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class OfflineMessageManagerTest extends SmackTestCase {
|
|||
assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount());
|
||||
|
||||
// User2 becomes available again
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(
|
||||
StanzaCollector collector = getConnection(1).createStanzaCollector(
|
||||
new MessageTypeFilter(Message.Type.chat));
|
||||
getConnection(1).sendStanza(new Presence(Presence.Type.available));
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class XHTMLManagerTest extends SmackTestCase {
|
|||
public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// User1 creates a message to send to user2
|
||||
|
@ -150,7 +150,7 @@ public class XHTMLManagerTest extends SmackTestCase {
|
|||
public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// User1 creates a message to send to user2
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Random;
|
|||
import java.util.concurrent.SynchronousQueue;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
@ -61,7 +61,7 @@ public class InBandBytestreamTest extends SmackTestCase {
|
|||
open.setFrom(initiatorConnection.getUser());
|
||||
open.setTo(targetConnection.getUser());
|
||||
|
||||
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
||||
StanzaCollector collector = initiatorConnection.createStanzaCollector(new PacketIDFilter(
|
||||
open.getStanzaId()));
|
||||
initiatorConnection.sendStanza(open);
|
||||
Packet result = collector.nextResult();
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
|
@ -82,7 +82,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
|
|||
initiatorConnection.getUser(), targetConnection.getUser(), "session_id");
|
||||
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
|
||||
|
||||
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
||||
StanzaCollector collector = initiatorConnection.createStanzaCollector(new PacketIDFilter(
|
||||
bytestreamInitiation.getStanzaId()));
|
||||
initiatorConnection.sendStanza(bytestreamInitiation);
|
||||
Packet result = collector.nextResult();
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.Chat;
|
|||
import org.jivesoftware.smack.ChatManagerListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.TCPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
@ -453,7 +453,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
|||
|
||||
// Start a private chat with another participant
|
||||
Chat chat = muc2.createPrivateChat(room + "/testbot", null);
|
||||
PacketCollector collector = chat.createCollector();
|
||||
StanzaCollector collector = chat.createCollector();
|
||||
chat.sendMessage("Hello there");
|
||||
|
||||
Message response = (Message) collector.nextResult(2000);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MessageEventTest extends SmackTestCase {
|
|||
// This listener will listen on the conn2 and answer an ACK if everything is ok
|
||||
PacketFilter packetFilter = new StanzaExtensionFilter("x", "jabber:x:event");
|
||||
PacketListener packetListener = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
Message message = (Message) packet;
|
||||
try {
|
||||
MessageEvent messageEvent =
|
||||
|
|
|
@ -71,7 +71,7 @@ public class RosterExchangeTest extends SmackTestCase {
|
|||
public void testSendAndReceiveRosterEntries() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// Create the message to send with the roster
|
||||
|
@ -115,7 +115,7 @@ public class RosterExchangeTest extends SmackTestCase {
|
|||
public void testSendAndAcceptRosterEntries() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// Create the message to send with the roster
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smackx.packet;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
@ -83,7 +83,7 @@ public class XHTMLExtensionTest extends SmackTestCase {
|
|||
public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// User1 creates a message to send to user2
|
||||
|
@ -136,7 +136,7 @@ public class XHTMLExtensionTest extends SmackTestCase {
|
|||
public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() {
|
||||
// Create a chat for each connection
|
||||
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
|
||||
final PacketCollector chat2 = getConnection(1).createPacketCollector(
|
||||
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
|
||||
new ThreadFilter(chat1.getThreadID()));
|
||||
|
||||
// Create a Listener that listens for Messages with the extension
|
||||
|
@ -146,7 +146,7 @@ public class XHTMLExtensionTest extends SmackTestCase {
|
|||
new StanzaExtensionFilter("html", "http://jabber.org/protocol/xhtml-im");
|
||||
PacketListener packetListener = new PacketListener() {
|
||||
@Override
|
||||
public void processPacket(Packet packet) {
|
||||
public void processStanza(Packet packet) {
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -165,7 +165,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
|
||||
if (blockListCached == null) {
|
||||
BlockListIQ blockListIQ = new BlockListIQ();
|
||||
BlockListIQ blockListIQResult = connection().createPacketCollectorAndSend(blockListIQ).nextResultOrThrow();
|
||||
BlockListIQ blockListIQResult = connection().createStanzaCollectorAndSend(blockListIQ).nextResultOrThrow();
|
||||
blockListCached = blockListIQResult.getBlockedJidsCopy();
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void blockContacts(List<Jid> jids)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids);
|
||||
connection().createPacketCollectorAndSend(blockContactIQ).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(blockContactIQ).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,7 +199,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void unblockContacts(List<Jid> jids)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(jids);
|
||||
connection().createPacketCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,7 +213,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void unblockAll()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ();
|
||||
connection().createPacketCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public final class BoBManager extends Manager {
|
|||
requestBoBIQ.setTo(to);
|
||||
|
||||
XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||
BoBIQ responseBoBIQ = connection.createPacketCollectorAndSend(requestBoBIQ).nextResultOrThrow();
|
||||
BoBIQ responseBoBIQ = connection.createStanzaCollectorAndSend(requestBoBIQ).nextResultOrThrow();
|
||||
|
||||
bobData = responseBoBIQ.getBoBData();
|
||||
BOB_CACHE.put(bobHash, bobData);
|
||||
|
|
|
@ -426,7 +426,7 @@ public final class InBandBytestreamManager implements BytestreamManager {
|
|||
byteStreamRequest.setTo(targetJID);
|
||||
|
||||
// sending packet will throw exception on timeout or error reply
|
||||
connection.createPacketCollectorAndSend(byteStreamRequest).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(byteStreamRequest).nextResultOrThrow();
|
||||
|
||||
InBandBytestreamSession inBandBytestreamSession = new InBandBytestreamSession(
|
||||
this.connection, byteStreamRequest, targetJID);
|
||||
|
|
|
@ -211,7 +211,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
Close close = new Close(this.byteStreamRequest.getSessionID());
|
||||
close.setTo(this.remoteJID);
|
||||
try {
|
||||
connection.createPacketCollectorAndSend(close).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(close).nextResultOrThrow();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Sadly we are unable to use the IOException(Throwable) constructor because this
|
||||
|
@ -449,7 +449,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
private long lastSequence = -1;
|
||||
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
// get data packet extension
|
||||
DataPacketExtension data = ((Data) packet).getDataPacketExtension();
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
protected StanzaListener getDataPacketListener() {
|
||||
return new StanzaListener() {
|
||||
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
// get data packet extension
|
||||
DataPacketExtension data = (DataPacketExtension) packet.getExtension(
|
||||
DataPacketExtension.ELEMENT,
|
||||
|
@ -781,7 +781,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
iq.setTo(remoteJID);
|
||||
|
||||
try {
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// close session unless it is already closed
|
||||
|
@ -824,7 +824,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
public void processIQPacket(Data data) throws NotConnectedException, InterruptedException {
|
||||
inputStream.dataPacketListener.processPacket(data);
|
||||
inputStream.dataPacketListener.processStanza(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -464,7 +464,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts);
|
||||
|
||||
// send initiation packet
|
||||
Stanza response = connection.createPacketCollectorAndSend(initiation).nextResultOrThrow(
|
||||
Stanza response = connection.createStanzaCollectorAndSend(initiation).nextResultOrThrow(
|
||||
getTargetResponseTimeout());
|
||||
|
||||
// extract used stream host from response
|
||||
|
@ -590,7 +590,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
for (Jid proxy : proxies) {
|
||||
Bytestream streamHostRequest = createStreamHostRequest(proxy);
|
||||
try {
|
||||
Bytestream response = (Bytestream) connection.createPacketCollectorAndSend(
|
||||
Bytestream response = (Bytestream) connection.createStanzaCollectorAndSend(
|
||||
streamHostRequest).nextResultOrThrow();
|
||||
streamHosts.addAll(response.getStreamHosts());
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class Socks5ClientForInitiator extends Socks5Client {
|
|||
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Bytestream activate = createStreamHostActivation();
|
||||
// if activation fails #nextResultOrThrow() throws an exception
|
||||
connection.get().createPacketCollectorAndSend(activate).nextResultOrThrow();
|
||||
connection.get().createStanzaCollectorAndSend(activate).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -317,7 +317,7 @@ public final class EntityCapsManager extends Manager {
|
|||
// Listen for remote presence stanzas with the caps extension
|
||||
// If we receive such a stanza, record the JID and nodeVer
|
||||
@Override
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
if (!entityCapsEnabled())
|
||||
return;
|
||||
|
||||
|
@ -337,7 +337,7 @@ public final class EntityCapsManager extends Manager {
|
|||
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
presenceSend = (Presence) packet;
|
||||
}
|
||||
}, PresenceTypeFilter.OUTGOING_PRESENCE_BROADCAST);
|
||||
|
@ -346,7 +346,7 @@ public final class EntityCapsManager extends Manager {
|
|||
// XEP-0115 specifies that a client SHOULD include entity capabilities
|
||||
// with every presence notification it sends.
|
||||
StanzaListener packetInterceptor = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
if (!entityCapsEnabled) {
|
||||
// Be sure to not send stanzas with the caps extension if it's not enabled
|
||||
packet.removeExtension(CapsExtension.ELEMENT, CapsExtension.NAMESPACE);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
|
||||
AdHocCommandData responseData = null;
|
||||
try {
|
||||
responseData = connection.createPacketCollectorAndSend(data).nextResultOrThrow();
|
||||
responseData = connection.createStanzaCollectorAndSend(data).nextResultOrThrow();
|
||||
}
|
||||
finally {
|
||||
// We set the response data in a 'finally' block, so that it also gets set even if an error IQ was returned.
|
||||
|
|
|
@ -536,7 +536,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
disco.setTo(entityID);
|
||||
disco.setNode(node);
|
||||
|
||||
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
||||
Stanza result = connection().createStanzaCollectorAndSend(disco).nextResultOrThrow();
|
||||
|
||||
return (DiscoverInfo) result;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
disco.setTo(entityID);
|
||||
disco.setNode(node);
|
||||
|
||||
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
||||
Stanza result = connection().createStanzaCollectorAndSend(disco).nextResultOrThrow();
|
||||
return (DiscoverItems) result;
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
discoverItems.setTo(entityID);
|
||||
discoverItems.setNode(node);
|
||||
|
||||
connection().createPacketCollectorAndSend(discoverItems).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(discoverItems).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -315,7 +315,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
si.setTo(userID);
|
||||
si.setType(IQ.Type.set);
|
||||
|
||||
Stanza siResponse = connection().createPacketCollectorAndSend(si).nextResultOrThrow(
|
||||
Stanza siResponse = connection().createStanzaCollectorAndSend(si).nextResultOrThrow(
|
||||
responseTimeout);
|
||||
|
||||
if (siResponse instanceof IQ) {
|
||||
|
|
|
@ -135,7 +135,7 @@ public final class LastActivityManager extends Manager {
|
|||
|
||||
// Listen to all the sent messages to reset the idle time on each one
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Presence presence = (Presence) packet;
|
||||
Presence.Mode mode = presence.getMode();
|
||||
if (mode == null) return;
|
||||
|
@ -154,7 +154,7 @@ public final class LastActivityManager extends Manager {
|
|||
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
// if it's not an error message, reset the idle time
|
||||
if (message.getType() == Message.Type.error) return;
|
||||
|
@ -237,7 +237,7 @@ public final class LastActivityManager extends Manager {
|
|||
public LastActivity getLastActivity(Jid jid) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, InterruptedException {
|
||||
LastActivity activity = new LastActivity(jid);
|
||||
return (LastActivity) connection().createPacketCollectorAndSend(activity).nextResultOrThrow();
|
||||
return (LastActivity) connection().createStanzaCollectorAndSend(activity).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -162,7 +162,7 @@ public final class PrivateDataManager extends Manager {
|
|||
// Create an IQ packet to get the private data.
|
||||
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
|
||||
|
||||
PrivateDataIQ response = connection().createPacketCollectorAndSend(
|
||||
PrivateDataIQ response = connection().createStanzaCollectorAndSend(
|
||||
privateDataGet).nextResultOrThrow();
|
||||
return response.getPrivateData();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public final class PrivateDataManager extends Manager {
|
|||
// Create an IQ packet to set the private data.
|
||||
IQ privateDataSet = new PrivateDataIQ(privateData);
|
||||
|
||||
connection().createPacketCollectorAndSend(privateDataSet).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(privateDataSet).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private static final PrivateData DUMMY_PRIVATE_DATA = new PrivateData() {
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Set;
|
|||
import java.util.WeakHashMap;
|
||||
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
@ -283,7 +283,7 @@ public final class AccountManager extends Manager {
|
|||
Registration reg = new Registration(attributes);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,7 +307,7 @@ public final class AccountManager extends Manager {
|
|||
Registration reg = new Registration(map);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +328,7 @@ public final class AccountManager extends Manager {
|
|||
Registration reg = new Registration(attributes);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
public boolean isSupported()
|
||||
|
@ -356,11 +356,11 @@ public final class AccountManager extends Manager {
|
|||
private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
info = createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
info = createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException {
|
||||
PacketCollector collector = connection().createPacketCollectorAndSend(new StanzaIdFilter(req.getStanzaId()), req);
|
||||
private StanzaCollector createStanzaCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException {
|
||||
StanzaCollector collector = connection().createStanzaCollectorAndSend(new StanzaIdFilter(req.getStanzaId()), req);
|
||||
return collector;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public final class VersionManager extends Manager {
|
|||
if (!isSupported(jid)) {
|
||||
return null;
|
||||
}
|
||||
return connection().createPacketCollectorAndSend(new Version(jid)).nextResultOrThrow();
|
||||
return connection().createStanzaCollectorAndSend(new Version(jid)).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private static Version generateVersionFrom(String name, String version, String os) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.MessageListener;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
import org.jivesoftware.smack.PresenceListener;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
@ -143,7 +143,7 @@ public class MultiUserChat {
|
|||
private String subject;
|
||||
private Resourcepart nickname;
|
||||
private boolean joined = false;
|
||||
private PacketCollector messageCollector;
|
||||
private StanzaCollector messageCollector;
|
||||
|
||||
MultiUserChat(XMPPConnection connection, EntityBareJid room, MultiUserChatManager multiUserChatManager) {
|
||||
this.connection = connection;
|
||||
|
@ -155,7 +155,7 @@ public class MultiUserChat {
|
|||
|
||||
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);
|
||||
|
@ -165,7 +165,7 @@ public class MultiUserChat {
|
|||
|
||||
// Create a listener for subject updates.
|
||||
subjectListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message msg = (Message) packet;
|
||||
EntityFullJid from = msg.getFrom().asEntityFullJidIfPossible();
|
||||
if (from == null) {
|
||||
|
@ -183,7 +183,7 @@ public class MultiUserChat {
|
|||
|
||||
// Create a listener for all presence updates.
|
||||
presenceListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Presence presence = (Presence) packet;
|
||||
final EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible();
|
||||
if (from == null) {
|
||||
|
@ -253,7 +253,7 @@ public class MultiUserChat {
|
|||
// Listens for all messages that include a MUCUser extension and fire the invitation
|
||||
// rejection listeners if the message includes an invitation rejection.
|
||||
declinesListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
// Get the MUC User extension
|
||||
MUCUser mucUser = MUCUser.from(packet);
|
||||
|
@ -269,7 +269,7 @@ public class MultiUserChat {
|
|||
|
||||
presenceInterceptor = new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Presence presence = (Presence) packet;
|
||||
for (PresenceListener interceptor : presenceInterceptors) {
|
||||
interceptor.processPresence(presence);
|
||||
|
@ -323,7 +323,7 @@ public class MultiUserChat {
|
|||
connection.addSyncStanzaListener(declinesListener, DECLINE_FILTER);
|
||||
connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room),
|
||||
StanzaTypeFilter.PRESENCE));
|
||||
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter);
|
||||
messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
|
||||
|
||||
// Wait for a presence packet back from the server.
|
||||
// Use a bare JID filter, since the room may rewrite the nickname.
|
||||
|
@ -331,7 +331,7 @@ public class MultiUserChat {
|
|||
Presence.class), MUCUserStatusCodeFilter.STATUS_110_PRESENCE_TO_SELF);
|
||||
Presence presence;
|
||||
try {
|
||||
presence = connection.createPacketCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(conf.getTimeout());
|
||||
presence = connection.createStanzaCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(conf.getTimeout());
|
||||
}
|
||||
catch (InterruptedException | NoResponseException | XMPPErrorException e) {
|
||||
// Ensure that all callbacks are removed if there is an exception
|
||||
|
@ -758,7 +758,7 @@ public class MultiUserChat {
|
|||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.get);
|
||||
|
||||
IQ answer = connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
IQ answer = connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
return Form.getFormFrom(answer);
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ public class MultiUserChat {
|
|||
iq.setType(IQ.Type.set);
|
||||
iq.addExtension(form.getDataFormToSend());
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -803,7 +803,7 @@ public class MultiUserChat {
|
|||
reg.setType(IQ.Type.get);
|
||||
reg.setTo(room);
|
||||
|
||||
IQ result = connection.createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
IQ result = connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
return Form.getFormFrom(result);
|
||||
}
|
||||
|
||||
|
@ -830,7 +830,7 @@ public class MultiUserChat {
|
|||
reg.setTo(room);
|
||||
reg.addExtension(form.getDataFormToSend());
|
||||
|
||||
connection.createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -857,7 +857,7 @@ public class MultiUserChat {
|
|||
Destroy destroy = new Destroy(alternateJID, reason);
|
||||
iq.setDestroy(destroy);
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
|
||||
// Reset occupant information.
|
||||
occupantsMap.clear();
|
||||
|
@ -1082,7 +1082,7 @@ public class MultiUserChat {
|
|||
new AndFilter(
|
||||
FromMatchesFilter.createFull(jid),
|
||||
new StanzaTypeFilter(Presence.class));
|
||||
PacketCollector response = connection.createPacketCollectorAndSend(responseFilter, joinPresence);
|
||||
StanzaCollector response = connection.createStanzaCollectorAndSend(responseFilter, joinPresence);
|
||||
// Wait up to a certain number of seconds for a reply. If there is a negative reply, an
|
||||
// exception will be thrown
|
||||
response.nextResultOrThrow();
|
||||
|
@ -1563,7 +1563,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(affiliation, jid, reason);
|
||||
iq.addItem(item);
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private void changeAffiliationByAdmin(Collection<? extends Jid> jids, MUCAffiliation affiliation)
|
||||
|
@ -1577,7 +1577,7 @@ public class MultiUserChat {
|
|||
iq.addItem(item);
|
||||
}
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private void changeRole(Resourcepart nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
@ -1588,7 +1588,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(role, nickname, reason);
|
||||
iq.addItem(item);
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private void changeRole(Collection<Resourcepart> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
@ -1601,7 +1601,7 @@ public class MultiUserChat {
|
|||
iq.addItem(item);
|
||||
}
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1759,7 +1759,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(affiliation);
|
||||
iq.addItem(item);
|
||||
|
||||
MUCAdmin answer = (MUCAdmin) connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
|
||||
// Get the list of affiliates from the server's answer
|
||||
List<Affiliate> affiliates = new ArrayList<Affiliate>();
|
||||
|
@ -1814,7 +1814,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(role);
|
||||
iq.addItem(item);
|
||||
|
||||
MUCAdmin answer = (MUCAdmin) connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
// Get the list of participants from the server's answer
|
||||
List<Occupant> participants = new ArrayList<Occupant>();
|
||||
for (MUCItem mucadminItem : answer.getItems()) {
|
||||
|
@ -1975,13 +1975,13 @@ public class MultiUserChat {
|
|||
return subject.equals(msg.getSubject());
|
||||
}
|
||||
});
|
||||
PacketCollector response = connection.createPacketCollectorAndSend(responseFilter, message);
|
||||
StanzaCollector response = connection.createStanzaCollectorAndSend(responseFilter, message);
|
||||
// Wait up to a certain number of seconds for a reply.
|
||||
response.nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the connection callbacks (PacketListener, PacketInterceptor, PacketCollector) used by this MUC from the
|
||||
* Remove the connection callbacks (PacketListener, PacketInterceptor, StanzaCollector) used by this MUC from the
|
||||
* connection.
|
||||
*/
|
||||
private void removeConnectionCallbacks() {
|
||||
|
|
|
@ -150,7 +150,7 @@ public final class MultiUserChatManager extends Manager {
|
|||
// Listens for all messages that include a MUCUser extension and fire the invitation
|
||||
// listeners if the message includes an invitation.
|
||||
StanzaListener invitationPacketListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
final Message message = (Message) packet;
|
||||
// Get the MUCUser extension
|
||||
final MUCUser mucUser = MUCUser.from(message);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.offline;
|
||||
|
||||
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;
|
||||
|
@ -158,9 +158,9 @@ public class OfflineMessageManager {
|
|||
return nodes.contains(info.getNode());
|
||||
}
|
||||
});
|
||||
PacketCollector messageCollector = connection.createPacketCollector(messageFilter);
|
||||
StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter);
|
||||
try {
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
// Collect the received offline messages
|
||||
Message message = messageCollector.nextResult();
|
||||
while (message != null) {
|
||||
|
@ -191,9 +191,9 @@ public class OfflineMessageManager {
|
|||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
request.setFetch(true);
|
||||
|
||||
PacketCollector resultCollector = connection.createPacketCollectorAndSend(request);
|
||||
PacketCollector.Configuration messageCollectorConfiguration = PacketCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector);
|
||||
PacketCollector messageCollector = connection.createPacketCollector(messageCollectorConfiguration);
|
||||
StanzaCollector resultCollector = connection.createStanzaCollectorAndSend(request);
|
||||
StanzaCollector.Configuration messageCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector);
|
||||
StanzaCollector messageCollector = connection.createStanzaCollector(messageCollectorConfiguration);
|
||||
|
||||
List<Message> messages = null;
|
||||
try {
|
||||
|
@ -235,7 +235,7 @@ public class OfflineMessageManager {
|
|||
item.setAction("remove");
|
||||
request.addItem(item);
|
||||
}
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,6 +251,6 @@ public class OfflineMessageManager {
|
|||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
request.setType(IQ.Type.set);
|
||||
request.setPurge(true);
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public final class PEPManager extends Manager {
|
|||
private PEPManager(XMPPConnection connection) {
|
||||
super(connection);
|
||||
StanzaListener packetListener = new StanzaListener() {
|
||||
public void processPacket(Stanza stanza) {
|
||||
public void processStanza(Stanza stanza) {
|
||||
Message message = (Message) stanza;
|
||||
EventElement event = EventElement.from(stanza);
|
||||
assert(event != null);
|
||||
|
|
|
@ -167,7 +167,7 @@ public final class PingManager extends Manager {
|
|||
}
|
||||
Ping ping = new Ping(jid);
|
||||
try {
|
||||
connection.createPacketCollectorAndSend(ping).nextResultOrThrow(pingTimeout);
|
||||
connection.createStanzaCollectorAndSend(ping).nextResultOrThrow(pingTimeout);
|
||||
}
|
||||
catch (XMPPException exc) {
|
||||
return jid.equals(connection.getXMPPServiceDomain());
|
||||
|
|
|
@ -126,7 +126,7 @@ public final class PrivacyListManager extends Manager {
|
|||
// cached(Active|Default)ListName handling
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
XMPPConnection connection = connection();
|
||||
Privacy privacy = (Privacy) packet;
|
||||
StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
||||
|
@ -134,7 +134,7 @@ public final class PrivacyListManager extends Manager {
|
|||
final boolean declinceActiveList = privacy.isDeclineActiveList();
|
||||
connection.addOneTimeSyncCallback(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
if (declinceActiveList) {
|
||||
cachedActiveListName = null;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public final class PrivacyListManager extends Manager {
|
|||
}, SetActiveListFilter.INSTANCE);
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
XMPPConnection connection = connection();
|
||||
Privacy privacy = (Privacy) packet;
|
||||
StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
||||
|
@ -156,7 +156,7 @@ public final class PrivacyListManager extends Manager {
|
|||
final boolean declinceDefaultList = privacy.isDeclineDefaultList();
|
||||
connection.addOneTimeSyncCallback(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
if (declinceDefaultList) {
|
||||
cachedDefaultListName = null;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ public final class PrivacyListManager extends Manager {
|
|||
}, SetDefaultListFilter.INSTANCE);
|
||||
connection.addSyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
Privacy privacy = (Privacy) packet;
|
||||
// If a privacy IQ result stanza has an active or default list name set, then we use that
|
||||
// as cached list name.
|
||||
|
@ -231,7 +231,7 @@ public final class PrivacyListManager extends Manager {
|
|||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.get);
|
||||
|
||||
return connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
return connection().createStanzaCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,7 +250,7 @@ public final class PrivacyListManager extends Manager {
|
|||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.set);
|
||||
|
||||
return connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
return connection().createStanzaCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ public class LeafNode extends Node
|
|||
DiscoverItems items = new DiscoverItems();
|
||||
items.setTo(pubSubManager.getServiceJid());
|
||||
items.setNode(getId());
|
||||
return pubSubManager.getConnection().createPacketCollectorAndSend(items).nextResultOrThrow();
|
||||
return pubSubManager.getConnection().createStanzaCollectorAndSend(items).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,7 +192,7 @@ public class LeafNode extends Node
|
|||
private <T extends Item> List<T> getItems(PubSub request,
|
||||
List<ExtensionElement> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub result = pubSubManager.getConnection().createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
PubSub result = pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
||||
if (returnedExtensions != null) {
|
||||
returnedExtensions.addAll(result.getExtensions());
|
||||
|
@ -289,7 +289,7 @@ public class LeafNode extends Node
|
|||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
|
||||
|
||||
pubSubManager.getConnection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,7 +346,7 @@ public class LeafNode extends Node
|
|||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
|
||||
|
||||
pubSubManager.getConnection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -363,7 +363,7 @@ public class LeafNode extends Node
|
|||
{
|
||||
PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace());
|
||||
|
||||
pubSubManager.getConnection().createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,6 +400,6 @@ public class LeafNode extends Node
|
|||
items.add(new Item(id));
|
||||
}
|
||||
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
|
||||
pubSubManager.getConnection().createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ abstract public class Node
|
|||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
|
||||
getId(), submitForm), PubSubNamespace.OWNER);
|
||||
pubSubManager.getConnection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ abstract public class Node
|
|||
DiscoverInfo info = new DiscoverInfo();
|
||||
info.setTo(pubSubManager.getServiceJid());
|
||||
info.setNode(getId());
|
||||
return pubSubManager.getConnection().createPacketCollectorAndSend(info).nextResultOrThrow();
|
||||
return pubSubManager.getConnection().createStanzaCollectorAndSend(info).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -609,7 +609,7 @@ abstract public class Node
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void processPacket(Stanza packet)
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
|
@ -635,7 +635,7 @@ abstract public class Node
|
|||
listener = eventListener;
|
||||
}
|
||||
|
||||
public void processPacket(Stanza packet)
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
|
@ -680,7 +680,7 @@ abstract public class Node
|
|||
listener = eventListener;
|
||||
}
|
||||
|
||||
public void processPacket(Stanza packet)
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
|
|
|
@ -234,7 +234,7 @@ public final class PubSubManager extends Manager {
|
|||
info.setTo(pubSubService);
|
||||
info.setNode(id);
|
||||
|
||||
DiscoverInfo infoReply = connection().createPacketCollectorAndSend(info).nextResultOrThrow();
|
||||
DiscoverInfo infoReply = connection().createStanzaCollectorAndSend(info).nextResultOrThrow();
|
||||
|
||||
if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) {
|
||||
node = new LeafNode(this, id);
|
||||
|
@ -283,7 +283,7 @@ public final class PubSubManager extends Manager {
|
|||
if (nodeId != null)
|
||||
items.setNode(nodeId);
|
||||
items.setTo(pubSubService);
|
||||
DiscoverItems nodeItems = connection().createPacketCollectorAndSend(items).nextResultOrThrow();
|
||||
DiscoverItems nodeItems = connection().createStanzaCollectorAndSend(items).nextResultOrThrow();
|
||||
return nodeItems;
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ public final class PubSubManager extends Manager {
|
|||
|
||||
PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, InterruptedException {
|
||||
IQ resultIQ = connection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
IQ resultIQ = connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
if (resultIQ instanceof EmptyResultIQ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ public final class DeliveryReceiptManager extends Manager {
|
|||
// Add the packet listener to handling incoming delivery receipts
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
DeliveryReceipt dr = DeliveryReceipt.from((Message) packet);
|
||||
// notify listeners of incoming receipt
|
||||
for (ReceiptReceivedListener l : receiptReceivedListeners) {
|
||||
|
@ -148,7 +148,7 @@ public final class DeliveryReceiptManager extends Manager {
|
|||
// Add the packet listener to handle incoming delivery receipt requests
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
final Jid from = packet.getFrom();
|
||||
final XMPPConnection connection = connection();
|
||||
switch (autoReceiptMode) {
|
||||
|
@ -261,7 +261,7 @@ public final class DeliveryReceiptManager extends Manager {
|
|||
|
||||
private static final StanzaListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException {
|
||||
Message message = (Message) packet;
|
||||
DeliveryReceiptRequest.addTo(message);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setType(IQ.Type.get);
|
||||
search.setTo(searchService);
|
||||
|
||||
IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow();
|
||||
IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
return Form.getFormFrom(response);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setTo(searchService);
|
||||
search.addExtension(searchForm.getDataFormToSend());
|
||||
|
||||
IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow();
|
||||
IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
return ReportedData.getReportedDataFrom(response);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setType(IQ.Type.set);
|
||||
search.setTo(searchService);
|
||||
|
||||
SimpleUserSearch response = (SimpleUserSearch) con.createPacketCollectorAndSend(search).nextResultOrThrow();
|
||||
SimpleUserSearch response = (SimpleUserSearch) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
return response.getReportedData();
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class SharedGroupManager {
|
|||
SharedGroupsInfo info = new SharedGroupsInfo();
|
||||
info.setType(IQ.Type.get);
|
||||
|
||||
SharedGroupsInfo result = (SharedGroupsInfo) connection.createPacketCollectorAndSend(info).nextResultOrThrow();
|
||||
SharedGroupsInfo result = (SharedGroupsInfo) connection.createStanzaCollectorAndSend(info).nextResultOrThrow();
|
||||
return result.getGroups();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public final class EntityTimeManager extends Manager {
|
|||
Time request = new Time();
|
||||
// TODO Add Time(Jid) constructor and use this constructor instead
|
||||
request.setTo(jid);
|
||||
Time response = (Time) connection().createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
Time response = (Time) connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public final class VCardManager extends Manager {
|
|||
// Also make sure to generate a new stanza id (the given vcard could be a vcard result), in which case we don't
|
||||
// want to use the same stanza id again (although it wouldn't break if we did)
|
||||
vcard.setStanzaId(StanzaIdUtil.newStanzaId());
|
||||
connection().createPacketCollectorAndSend(vcard).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(vcard).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +128,7 @@ public final class VCardManager extends Manager {
|
|||
public VCard loadVCard(EntityBareJid bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
VCard vcardRequest = new VCard();
|
||||
vcardRequest.setTo(bareJid);
|
||||
VCard result = connection().createPacketCollectorAndSend(vcardRequest).nextResultOrThrow();
|
||||
VCard result = connection().createStanzaCollectorAndSend(vcardRequest).nextResultOrThrow();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
dataMessage.addExtension(dpe);
|
||||
|
||||
// add data packets
|
||||
listener.processPacket(dataMessage);
|
||||
listener.processStanza(dataMessage);
|
||||
|
||||
// read until exception is thrown
|
||||
try {
|
||||
|
@ -313,7 +313,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Message dataMessage = new Message();
|
||||
dataMessage.addExtension(dpe);
|
||||
listener.processPacket(dataMessage);
|
||||
listener.processStanza(dataMessage);
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
|
@ -358,7 +358,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Message dataMessage = new Message();
|
||||
dataMessage.addExtension(dpe);
|
||||
listener.processPacket(dataMessage);
|
||||
listener.processStanza(dataMessage);
|
||||
}
|
||||
|
||||
// read data
|
||||
|
|
|
@ -316,7 +316,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
String base64Data = Base64.encode("Data");
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
// verify no packet send
|
||||
protocol.verifyAll();
|
||||
|
@ -352,7 +352,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
protocol.verifyAll();
|
||||
|
||||
|
@ -392,8 +392,8 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
Data data2 = new Data(dpe);
|
||||
|
||||
// notify listener
|
||||
listener.processPacket(data1);
|
||||
listener.processPacket(data2);
|
||||
listener.processStanza(data1);
|
||||
listener.processStanza(data2);
|
||||
|
||||
protocol.verifyAll();
|
||||
|
||||
|
@ -428,7 +428,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
Data data = new Data(dpe);
|
||||
|
||||
// notify listener
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
protocol.verifyAll();
|
||||
|
||||
|
@ -463,7 +463,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
Data data = new Data(dpe);
|
||||
|
||||
// add data packets
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
// read until exception is thrown
|
||||
try {
|
||||
|
@ -504,7 +504,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
|
@ -551,7 +551,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
}
|
||||
|
||||
// read data
|
||||
|
@ -592,7 +592,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
Data data = new Data(dpe);
|
||||
|
||||
// add data packets
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
inputStream.close();
|
||||
|
||||
|
@ -635,7 +635,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
Data data = new Data(dpe);
|
||||
|
||||
// add data packets
|
||||
listener.processPacket(data);
|
||||
listener.processStanza(data);
|
||||
|
||||
Thread closer = new Thread(new Runnable() {
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import static org.mockito.Mockito.doAnswer;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
|
@ -49,11 +49,11 @@ public class ConnectionUtils {
|
|||
* form the protocol instance.
|
||||
* <p>
|
||||
* This mocked connection can used to collect packets that require a reply using a
|
||||
* PacketCollector.
|
||||
* StanzaCollector.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* PacketCollector collector = connection.createPacketCollector(new PacketFilter());
|
||||
* StanzaCollector collector = connection.createStanzaCollector(new PacketFilter());
|
||||
* connection.sendStanza(packet);
|
||||
* Stanza(/Packet) reply = collector.nextResult();
|
||||
* </code>
|
||||
|
@ -76,19 +76,19 @@ public class ConnectionUtils {
|
|||
when(connection.getXMPPServiceDomain()).thenReturn(xmppServer);
|
||||
|
||||
// mock packet collector
|
||||
final PacketCollector collector = mock(PacketCollector.class);
|
||||
when(connection.createPacketCollector(isA(StanzaFilter.class))).thenReturn(
|
||||
final StanzaCollector collector = mock(StanzaCollector.class);
|
||||
when(connection.createStanzaCollector(isA(StanzaFilter.class))).thenReturn(
|
||||
collector);
|
||||
Answer<PacketCollector> collectorAndSend = new Answer<PacketCollector>() {
|
||||
Answer<StanzaCollector> collectorAndSend = new Answer<StanzaCollector>() {
|
||||
@Override
|
||||
public PacketCollector answer(InvocationOnMock invocation) throws Throwable {
|
||||
public StanzaCollector answer(InvocationOnMock invocation) throws Throwable {
|
||||
Stanza packet = (Stanza) invocation.getArguments()[0];
|
||||
protocol.getRequests().add(packet);
|
||||
return collector;
|
||||
}
|
||||
|
||||
};
|
||||
when(connection.createPacketCollectorAndSend(isA(IQ.class))).thenAnswer(collectorAndSend);
|
||||
when(connection.createStanzaCollectorAndSend(isA(IQ.class))).thenAnswer(collectorAndSend);
|
||||
|
||||
// mock send method
|
||||
Answer<Object> addIncoming = new Answer<Object>() {
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
* <code>
|
||||
* public void methodToTest() {
|
||||
* Stanza(/Packet) stanza(/packet) = new Packet(); // create an XMPP packet
|
||||
* PacketCollector collector = connection.createPacketCollector(new StanzaIdFilter());
|
||||
* StanzaCollector collector = connection.createStanzaCollector(new StanzaIdFilter());
|
||||
* connection.sendStanza(packet);
|
||||
* Stanza(/Packet) reply = collector.nextResult();
|
||||
* }
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smack.chat;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
@ -155,14 +155,14 @@ public class Chat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link org.jivesoftware.smack.PacketCollector} which will accumulate the Messages
|
||||
* for this chat. Always cancel PacketCollectors when finished with them as they will accumulate
|
||||
* Creates a {@link org.jivesoftware.smack.StanzaCollector} which will accumulate the Messages
|
||||
* for this chat. Always cancel StanzaCollectors when finished with them as they will accumulate
|
||||
* messages indefinitely.
|
||||
*
|
||||
* @return the PacketCollector which returns Messages for this chat.
|
||||
* @return the StanzaCollector which returns Messages for this chat.
|
||||
*/
|
||||
public PacketCollector createCollector() {
|
||||
return chatManager.createPacketCollector(this);
|
||||
public StanzaCollector createCollector() {
|
||||
return chatManager.createStanzaCollector(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.logging.Logger;
|
|||
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.MessageListener;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
|
@ -149,7 +149,7 @@ public final class ChatManager extends Manager{
|
|||
// Add a listener for all message packets so that we can deliver
|
||||
// messages to the best Chat instance available.
|
||||
connection.addSyncStanzaListener(new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
Chat chat;
|
||||
if (message.getThread() == null) {
|
||||
|
@ -378,8 +378,8 @@ public final class ChatManager extends Manager{
|
|||
connection().sendStanza(message);
|
||||
}
|
||||
|
||||
PacketCollector createPacketCollector(Chat chat) {
|
||||
return connection().createPacketCollector(new AndFilter(new ThreadFilter(chat.getThreadID()),
|
||||
StanzaCollector createStanzaCollector(Chat chat) {
|
||||
return connection().createStanzaCollector(new AndFilter(new ThreadFilter(chat.getThreadID()),
|
||||
FromMatchesFilter.create(chat.getParticipant())));
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ public final class Roster extends Manager {
|
|||
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza stanza) throws NotConnectedException,
|
||||
public void processStanza(Stanza stanza) throws NotConnectedException,
|
||||
InterruptedException {
|
||||
Presence presence = (Presence) stanza;
|
||||
Jid from = presence.getFrom();
|
||||
|
@ -318,7 +318,7 @@ public final class Roster extends Manager {
|
|||
|
||||
connection.addPacketSendingListener(new StanzaListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza stanzav) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza stanzav) throws NotConnectedException, InterruptedException {
|
||||
// Once we send an unavailable presence, the server is allowed to suppress sending presence status
|
||||
// information to us as optimization (RFC 6121 § 4.4.2). Thus XMPP clients which are unavailable, should
|
||||
// consider the presence information of their contacts as not up-to-date. We make the user obvious of
|
||||
|
@ -614,7 +614,7 @@ public final class Roster extends Manager {
|
|||
}
|
||||
}
|
||||
rosterPacket.addRosterItem(item);
|
||||
connection.createPacketCollectorAndSend(rosterPacket).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
|
||||
|
||||
sendSubscriptionRequest(user);
|
||||
}
|
||||
|
@ -744,7 +744,7 @@ public final class Roster extends Manager {
|
|||
// Set the item type as REMOVE so that the server will delete the entry
|
||||
item.setItemType(RosterPacket.ItemType.remove);
|
||||
packet.addRosterItem(item);
|
||||
connection.createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1189,11 +1189,11 @@ public final class Roster extends Manager {
|
|||
}
|
||||
packetUnavailable.setFrom(JidCreate.fullFrom(bareUserJid, resource));
|
||||
try {
|
||||
presencePacketListener.processPacket(packetUnavailable);
|
||||
presencePacketListener.processStanza(packetUnavailable);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
throw new IllegalStateException(
|
||||
"presencePakcetListener should never throw a NotConnectedException when processPacket is called with a presence of type unavailable",
|
||||
"presencePakcetListener should never throw a NotConnectedException when processStanza is called with a presence of type unavailable",
|
||||
e);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
|
@ -1422,7 +1422,7 @@ public final class Roster extends Manager {
|
|||
private class PresencePacketListener implements StanzaListener {
|
||||
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
// Try to ensure that the roster is loaded when processing presence stanzas. While the
|
||||
// presence listener is synchronous, the roster result listener is not, which means that
|
||||
// the presence listener may be invoked with a not yet loaded roster.
|
||||
|
@ -1562,7 +1562,7 @@ public final class Roster extends Manager {
|
|||
private class RosterResultListener implements StanzaListener {
|
||||
|
||||
@Override
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
final XMPPConnection connection = connection();
|
||||
LOGGER.fine("RosterResultListener received stanza");
|
||||
Collection<Jid> addedEntries = new ArrayList<>();
|
||||
|
|
|
@ -109,7 +109,7 @@ public final class RosterEntry extends Manager {
|
|||
// Create a new roster item with the current RosterEntry and the *new* name. Note that we can't set the name of
|
||||
// RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
|
||||
packet.addRosterItem(toRosterItem(this, name));
|
||||
connection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
|
||||
// We have received a result response to the IQ set, the name was successfully changed
|
||||
item.setName(name);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class RosterGroup extends Manager {
|
|||
item.removeGroupName(this.name);
|
||||
item.addGroupName(name);
|
||||
packet.addRosterItem(item);
|
||||
connection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class RosterGroup extends Manager {
|
|||
item.addGroupName(getName());
|
||||
packet.addRosterItem(item);
|
||||
// Wait up to a certain number of seconds for a reply from the server.
|
||||
connection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class RosterGroup extends Manager {
|
|||
item.removeGroupName(this.getName());
|
||||
packet.addRosterItem(item);
|
||||
// Wait up to a certain number of seconds for a reply from the server.
|
||||
connection().createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Random;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
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;
|
||||
|
@ -44,9 +44,9 @@ public abstract class AbstractSmackIntTest {
|
|||
|
||||
protected void performActionAndWaitUntilStanzaReceived(Runnable action, XMPPConnection connection, StanzaFilter filter)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setStanzaFilter(
|
||||
StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration().setStanzaFilter(
|
||||
filter).setSize(1);
|
||||
PacketCollector collector = connection.createPacketCollector(configuration);
|
||||
StanzaCollector collector = connection.createStanzaCollector(configuration);
|
||||
|
||||
try {
|
||||
action.run();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
|
|||
@SmackIntegrationTest
|
||||
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception {
|
||||
Chat newChat = chatManagerOne.createChat(conTwo.getUser());
|
||||
PacketCollector collector = conTwo.createPacketCollector(new ThreadFilter(newChat.getThreadID()));
|
||||
StanzaCollector collector = conTwo.createStanzaCollector(new ThreadFilter(newChat.getThreadID()));
|
||||
|
||||
Message msg = new Message();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class StreamManagementTest extends AbstractSmackLowLevelIntegrationTest {
|
|||
final String body2 = "Hi, what's up? I've been just instantly shutdown" + testRunId;
|
||||
final String body3 = "Hi, what's up? I've been just resumed" + testRunId;
|
||||
|
||||
final PacketCollector collector = conTwo.createPacketCollector(new AndFilter(
|
||||
final StanzaCollector collector = conTwo.createStanzaCollector(new AndFilter(
|
||||
MessageWithBodiesFilter.INSTANCE,
|
||||
FromMatchesFilter.createFull(conOne.getUser())));
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class StreamManagementTest extends AbstractSmackLowLevelIntegrationTest {
|
|||
from.sendStanza(message);
|
||||
}
|
||||
|
||||
private static void assertMessageWithBodyReceived(String body, PacketCollector collector) throws InterruptedException {
|
||||
private static void assertMessageWithBodyReceived(String body, StanzaCollector collector) throws InterruptedException {
|
||||
Message message = collector.nextResult();
|
||||
assertNotNull(message);
|
||||
assertEquals(body, message.getBody());
|
||||
|
|
|
@ -134,7 +134,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
|||
conOne.addPacketSendingListener(new StanzaListener() {
|
||||
|
||||
@Override
|
||||
public void processPacket(Stanza stanza) {
|
||||
public void processStanza(Stanza stanza) {
|
||||
discoInfoSend = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
// Start a packet listener for session initiation requests
|
||||
getConnection(0).addAsyncPacketListener(new PacketListener() {
|
||||
public void processPacket(final Packet packet) {
|
||||
public void processStanza(final Packet packet) {
|
||||
System.out.println("Packet detected... ");
|
||||
incCounter();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingle.provider;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.StanzaTypeFilter;
|
||||
|
@ -70,7 +70,7 @@ public class JingleProviderTest extends SmackTestCase {
|
|||
|
||||
// Create a filter and a collector...
|
||||
PacketFilter filter = new StanzaTypeFilter(IQ.class);
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(filter);
|
||||
StanzaCollector collector = getConnection(0).createStanzaCollector(filter);
|
||||
|
||||
System.out.println("Testing if a Jingle IQ can be sent and received...");
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
|
||||
// Start a packet listener for session initiation requests
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
triggerSessionRequested((Jingle) packet);
|
||||
}
|
||||
}, initRequestFilter);
|
||||
|
|
|
@ -678,7 +678,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
LOGGER.fine("UpdatePacketListener");
|
||||
|
||||
packetListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
try {
|
||||
receivePacketAndRespond((IQ) packet);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
@ -402,7 +402,7 @@ public class RTPBridge extends IQ {
|
|||
RTPBridge rtpPacket = new RTPBridge(sessionID);
|
||||
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
|
||||
|
||||
PacketCollector collector = connection.createPacketCollectorAndSend(rtpPacket);
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
|
@ -479,7 +479,7 @@ public class RTPBridge extends IQ {
|
|||
|
||||
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
|
||||
|
||||
PacketCollector collector = connection.createPacketCollectorAndSend(rtpPacket);
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class RTPBridge extends IQ {
|
|||
|
||||
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
|
||||
|
||||
PacketCollector collector = xmppConnection.createPacketCollectorAndSend(rtpPacket);
|
||||
StanzaCollector collector = xmppConnection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
|||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
@ -185,7 +185,7 @@ public class STUN extends SimpleIQ {
|
|||
STUN stunPacket = new STUN();
|
||||
stunPacket.setTo(DOMAIN + "." + connection.getXMPPServiceDomain());
|
||||
|
||||
PacketCollector collector = connection.createPacketCollectorAndSend(stunPacket);
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(stunPacket);
|
||||
|
||||
STUN response = collector.nextResult();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class Agent {
|
|||
public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
AgentWorkgroups request = new AgentWorkgroups(agentJID);
|
||||
request.setTo(serviceJID);
|
||||
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
AgentWorkgroups response = (AgentWorkgroups) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response.getWorkgroups();
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class Agent {
|
|||
agentInfo.setType(IQ.Type.get);
|
||||
agentInfo.setTo(workgroupJID);
|
||||
agentInfo.setFrom(getUser());
|
||||
AgentInfo response = (AgentInfo) connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
AgentInfo response = (AgentInfo) connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
return response.getName();
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,6 @@ public class Agent {
|
|||
agentInfo.setTo(workgroupJID);
|
||||
agentInfo.setFrom(getUser());
|
||||
agentInfo.setName(newName);
|
||||
connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ public class AgentRoster {
|
|||
* Listens for all presence packets and processes them.
|
||||
*/
|
||||
private class PresencePacketListener implements StanzaListener {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Presence presence = (Presence)packet;
|
||||
EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible();
|
||||
if (from == null) {
|
||||
|
@ -359,7 +359,7 @@ public class AgentRoster {
|
|||
*/
|
||||
private class AgentStatusListener implements StanzaListener {
|
||||
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
if (packet instanceof AgentStatusRequest) {
|
||||
AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
|
||||
for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Set;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
|
@ -147,7 +147,7 @@ public class AgentSession {
|
|||
new StanzaTypeFilter(Message.class));
|
||||
|
||||
packetListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
try {
|
||||
handlePacket(packet);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ public class AgentSession {
|
|||
presence.addExtension(new StandardExtensionElement(AgentStatus.ELEMENT_NAME,
|
||||
AgentStatus.NAMESPACE));
|
||||
|
||||
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(
|
||||
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
|
||||
new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence);
|
||||
|
||||
presence = (Presence)collector.nextResultOrThrow();
|
||||
|
@ -437,7 +437,7 @@ public class AgentSession {
|
|||
presence.addExtension(builder.build());
|
||||
presence.addExtension(new MetaData(this.metaData));
|
||||
|
||||
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(
|
||||
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
|
||||
new StanzaTypeFilter(Presence.class),
|
||||
FromMatchesFilter.create(workgroupJID)), presence);
|
||||
|
||||
|
@ -482,7 +482,7 @@ public class AgentSession {
|
|||
}
|
||||
presence.addExtension(new MetaData(this.metaData));
|
||||
|
||||
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class),
|
||||
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class),
|
||||
FromMatchesFilter.create(workgroupJID)), presence);
|
||||
|
||||
collector.nextResultOrThrow();
|
||||
|
@ -581,7 +581,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
OccupantsInfo response = (OccupantsInfo) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
OccupantsInfo response = (OccupantsInfo) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ public class AgentSession {
|
|||
notes.setTo(workgroupJID);
|
||||
notes.setSessionID(sessionID);
|
||||
notes.setNotes(note);
|
||||
connection.createPacketCollectorAndSend(notes).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(notes).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -856,7 +856,7 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
ChatNotes response = (ChatNotes) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
ChatNotes response = (ChatNotes) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -882,7 +882,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
AgentChatHistory response = connection.createPacketCollectorAndSend(
|
||||
AgentChatHistory response = connection.createStanzaCollectorAndSend(
|
||||
request).nextResult();
|
||||
|
||||
return response;
|
||||
|
@ -902,7 +902,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
SearchSettings response = (SearchSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
SearchSettings response = (SearchSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -922,7 +922,7 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setPersonal(!global);
|
||||
|
||||
Macros response = (Macros) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
Macros response = (Macros) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response.getRootGroup();
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ public class AgentSession {
|
|||
request.setPersonal(true);
|
||||
request.setPersonalMacroGroup(group);
|
||||
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -960,7 +960,7 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
ChatMetadata response = connection.createPacketCollectorAndSend(request).nextResult();
|
||||
ChatMetadata response = connection.createStanzaCollectorAndSend(request).nextResult();
|
||||
|
||||
return response.getMetadata();
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ public class AgentSession {
|
|||
iq.setTo(workgroupJID);
|
||||
iq.setFrom(connection.getUser());
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1040,7 +1040,7 @@ public class AgentSession {
|
|||
iq.setTo(workgroupJID);
|
||||
iq.setFrom(connection.getUser());
|
||||
|
||||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1059,7 +1059,7 @@ public class AgentSession {
|
|||
setting.setType(IQ.Type.get);
|
||||
setting.setTo(workgroupJID);
|
||||
|
||||
GenericSettings response = (GenericSettings) connection.createPacketCollectorAndSend(
|
||||
GenericSettings response = (GenericSettings) connection.createStanzaCollectorAndSend(
|
||||
setting).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
MonitorPacket response = (MonitorPacket) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
MonitorPacket response = (MonitorPacket) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response.isMonitor();
|
||||
}
|
||||
|
||||
|
@ -1079,6 +1079,6 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TranscriptManager {
|
|||
public Transcript getTranscript(Jid workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Transcript request = new Transcript(sessionID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcript response = (Transcript) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
Transcript response = (Transcript) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class TranscriptManager {
|
|||
public Transcripts getTranscripts(Jid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Transcripts request = new Transcripts(userID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcripts response = (Transcripts) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
Transcripts response = (Transcripts) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TranscriptSearchManager {
|
|||
search.setType(IQ.Type.get);
|
||||
search.setTo(serviceJID);
|
||||
|
||||
TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend(
|
||||
TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
|
||||
search).nextResultOrThrow();
|
||||
return Form.getFormFrom(response);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class TranscriptSearchManager {
|
|||
search.setTo(serviceJID);
|
||||
search.addExtension(completedForm.getDataFormToSend());
|
||||
|
||||
TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend(
|
||||
TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
|
||||
search).nextResultOrThrow();
|
||||
return ReportedData.getReportedDataFrom(response);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
|
@ -145,7 +145,7 @@ public class Workgroup {
|
|||
StanzaFilter typeFilter = new StanzaTypeFilter(Message.class);
|
||||
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
handlePacket(packet);
|
||||
}
|
||||
}, typeFilter);
|
||||
|
@ -184,7 +184,7 @@ public class Workgroup {
|
|||
directedPresence.setTo(workgroupJID);
|
||||
StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class);
|
||||
StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID);
|
||||
PacketCollector collector = connection.createPacketCollectorAndSend(new AndFilter(fromFilter,
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(new AndFilter(fromFilter,
|
||||
typeFilter), directedPresence);
|
||||
|
||||
Presence response = (Presence)collector.nextResultOrThrow();
|
||||
|
@ -342,7 +342,7 @@ public class Workgroup {
|
|||
|
||||
JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID);
|
||||
|
||||
connection.createPacketCollectorAndSend(joinPacket).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(joinPacket).nextResultOrThrow();
|
||||
// Notify listeners that we've joined the queue.
|
||||
fireQueueJoinedEvent();
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ public class Workgroup {
|
|||
}
|
||||
|
||||
DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID);
|
||||
connection.createPacketCollectorAndSend(departPacket).nextResultOrThrow();
|
||||
connection.createStanzaCollectorAndSend(departPacket).nextResultOrThrow();
|
||||
|
||||
// Notify listeners that we're no longer in the queue.
|
||||
fireQueueDepartedEvent();
|
||||
|
@ -649,7 +649,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
ChatSettings response = (ChatSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
ChatSettings response = (ChatSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
OfflineSettings response = (OfflineSettings) connection.createPacketCollectorAndSend(
|
||||
OfflineSettings response = (OfflineSettings) connection.createStanzaCollectorAndSend(
|
||||
request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
SoundSettings response = (SoundSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
SoundSettings response = (SoundSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -726,7 +726,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend(
|
||||
WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
|
||||
request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend(
|
||||
WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
|
||||
request).nextResultOrThrow();
|
||||
return response;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ public class Workgroup {
|
|||
workgroupForm.setType(IQ.Type.get);
|
||||
workgroupForm.setTo(workgroupJID);
|
||||
|
||||
WorkgroupForm response = (WorkgroupForm) connection.createPacketCollectorAndSend(
|
||||
WorkgroupForm response = (WorkgroupForm) connection.createStanzaCollectorAndSend(
|
||||
workgroupForm).nextResultOrThrow();
|
||||
return Form.getFormFrom(response);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public final class MessageEventManager extends Manager {
|
|||
super(connection);
|
||||
// Listens for all message event packets and fire the proper message event listeners.
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
MessageEvent messageEvent =
|
||||
(MessageEvent) message.getExtension("x", "jabber:x:event");
|
||||
|
|
|
@ -78,7 +78,7 @@ public class RosterExchangeManager {
|
|||
weakRefConnection = new WeakReference<XMPPConnection>(connection);
|
||||
// Listens for all roster exchange packets and fire the roster exchange listeners.
|
||||
packetListener = new StanzaListener() {
|
||||
public void processPacket(Stanza packet) {
|
||||
public void processStanza(Stanza packet) {
|
||||
Message message = (Message) packet;
|
||||
RosterExchange rosterExchange =
|
||||
(RosterExchange) message.getExtension(ELEMENT, NAMESPACE);
|
||||
|
|
|
@ -1857,7 +1857,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
for (Stanza ackedStanza : ackedStanzas) {
|
||||
for (StanzaListener listener : stanzaAcknowledgedListeners) {
|
||||
try {
|
||||
listener.processPacket(ackedStanza);
|
||||
listener.processStanza(ackedStanza);
|
||||
}
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
LOGGER.log(Level.FINER, "Received exception", e);
|
||||
|
@ -1870,7 +1870,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
StanzaListener listener = stanzaIdAcknowledgedListeners.remove(id);
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.processPacket(ackedStanza);
|
||||
listener.processStanza(ackedStanza);
|
||||
}
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
LOGGER.log(Level.FINER, "Received exception", e);
|
||||
|
|
Loading…
Reference in a new issue