1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

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

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

View file

@ -89,7 +89,7 @@ req.setTo("juliet@capulet.com/balcony");
// send it // send it
connection.sendIqWithResponseCallback(req, new PacketListener() { connection.sendIqWithResponseCallback(req, new PacketListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza iq) {
HttpOverXmppResp resp = (HttpOverXmppResp) iq; HttpOverXmppResp resp = (HttpOverXmppResp) iq;
// check HTTP response code // check HTTP response code
if (resp.getStatusCode() == 200) { if (resp.getStatusCode() == 200) {

View file

@ -143,8 +143,8 @@ XHTML bodies of any received message.
``` ```
// Create a listener for the chat and display any XHTML content // Create a listener for the chat and display any XHTML content
PacketListener packetListener = new PacketListener() { PacketListener packetListener = new PacketListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza stanza) {
Message message = (Message) packet; Message message = (Message) stanza;
// Obtain the XHTML bodies of the message // Obtain the XHTML bodies of the message
List<CharSequence> bodies = XHTMLManager.getBodies(message); List<CharSequence> bodies = XHTMLManager.getBodies(message);
if (bodies != null) { if (bodies != null) {

View file

@ -29,13 +29,13 @@ PacketCollector myCollector = connection.createPacketCollector(filter);
// Normally, you'd do something with the collector, like wait for new packets. // 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. // Next, create a packet listener. We use an anonymous inner class for brevity.
PacketListener myListener = new PacketListener() { StanzaListener myListener = new StanzaListener() {
**public** **void** processPacket(Packet packet) { **public** **void** processStanza(Stanza stanza) {
// Do something with the incoming packet here._ // Do something with the incoming stanza here._
} }
}; };
// Register the listener._ // Register the listener._
connection.addPacketListener(myListener, filter); connection.addStanzaListener(myListener, filter);
``` ```
Standard Stanza Filters Standard Stanza Filters

View file

@ -34,15 +34,15 @@ public class FloodTest extends SmackTestCase {
public void testMessageFlood() { public void testMessageFlood() {
try { try {
Chat chat11 = getConnection(0).getChatManager().createChat(getBareJID(1), null); Chat chat11 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
PacketCollector chat12 = getConnection(1).createPacketCollector( StanzaCollector chat12 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat11.getThreadID())); new ThreadFilter(chat11.getThreadID()));
Chat chat21 = getConnection(0).getChatManager().createChat(getBareJID(2), null); Chat chat21 = getConnection(0).getChatManager().createChat(getBareJID(2), null);
PacketCollector chat22 = getConnection(2).createPacketCollector( StanzaCollector chat22 = getConnection(2).createStanzaCollector(
new ThreadFilter(chat21.getThreadID())); new ThreadFilter(chat21.getThreadID()));
Chat chat31 = getConnection(0).getChatManager().createChat(getBareJID(3), null); Chat chat31 = getConnection(0).getChatManager().createChat(getBareJID(3), null);
PacketCollector chat32 = getConnection(3).createPacketCollector( StanzaCollector chat32 = getConnection(3).createStanzaCollector(
new ThreadFilter(chat31.getThreadID())); new ThreadFilter(chat31.getThreadID()));
for (int i=0; i<500; i++) { for (int i=0; i<500; i++) {

View file

@ -52,7 +52,7 @@ public class IQTest extends SmackTestCase {
PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getStanzaId()), PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getStanzaId()),
new StanzaTypeFilter(IQ.class)); new StanzaTypeFilter(IQ.class));
PacketCollector collector = getConnection(0).createPacketCollector(filter); StanzaCollector collector = getConnection(0).createStanzaCollector(filter);
// Send the iq packet with an invalid namespace // Send the iq packet with an invalid namespace
getConnection(0).sendStanza(iq); getConnection(0).sendStanza(iq);
@ -82,7 +82,7 @@ public class IQTest extends SmackTestCase {
versionRequest.setTo(getBareJID(0) + "/Something"); versionRequest.setTo(getBareJID(0) + "/Something");
// Create a packet collector to listen for a response. // Create a packet collector to listen for a response.
PacketCollector collector = getConnection(0).createPacketCollector( StanzaCollector collector = getConnection(0).createStanzaCollector(
new PacketIDFilter(versionRequest.getStanzaId())); new PacketIDFilter(versionRequest.getStanzaId()));
getConnection(0).sendStanza(versionRequest); getConnection(0).sendStanza(versionRequest);

View file

@ -48,8 +48,8 @@ public class MessageTest extends SmackTestCase {
presence.setTo(getBareJID(1)); presence.setTo(getBareJID(1));
getConnection(0).sendStanza(presence); getConnection(0).sendStanza(presence);
PacketCollector collector = getConnection(0) StanzaCollector collector = getConnection(0)
.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); .createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
try { try {
getConnection(1).getChatManager().createChat(getBareJID(0), null).sendMessage("Test 1"); 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 // User1 sends some messages to User2 which is not available at the moment
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null); Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
PacketCollector collector = getConnection(1).createPacketCollector( StanzaCollector collector = getConnection(1).createStanzaCollector(
new MessageTypeFilter(Message.Type.chat)); new MessageTypeFilter(Message.Type.chat));
chat.sendMessage("Test 1"); chat.sendMessage("Test 1");
chat.sendMessage("Test 2"); 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 // User1 sends some messages to User2 which is not available at the moment
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null); Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
PacketCollector collector = getConnection(1).createPacketCollector( StanzaCollector collector = getConnection(1).createStanzaCollector(
new MessageTypeFilter(Message.Type.chat)); new MessageTypeFilter(Message.Type.chat));
chat.sendMessage("Test \f 1"); chat.sendMessage("Test \f 1");
chat.sendMessage("Test \r 1"); chat.sendMessage("Test \r 1");
@ -153,7 +153,7 @@ public class MessageTest extends SmackTestCase {
getConnection(0).sendStanza(new Presence(Presence.Type.available)); getConnection(0).sendStanza(new Presence(Presence.Type.available));
getConnection(1).sendStanza(new Presence(Presence.Type.available)); getConnection(1).sendStanza(new Presence(Presence.Type.available));
// User2 becomes available again // User2 becomes available again
PacketCollector collector = getConnection(1).createPacketCollector( StanzaCollector collector = getConnection(1).createStanzaCollector(
new MessageTypeFilter(Message.Type.chat)); new MessageTypeFilter(Message.Type.chat));
// Create message with a body of 4K characters // Create message with a body of 4K characters
@ -210,8 +210,8 @@ public class MessageTest extends SmackTestCase {
Thread.sleep(200); Thread.sleep(200);
// User0 listen in both connected clients // User0 listen in both connected clients
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
// User1 sends a message to the bare JID of User0 // User1 sends a message to the bare JID of User0
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null); Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
@ -259,8 +259,8 @@ public class MessageTest extends SmackTestCase {
Thread.sleep(200); Thread.sleep(200);
// User0 listen in both connected clients // User0 listen in both connected clients
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
// User1 sends a message to the bare JID of User0 // User1 sends a message to the bare JID of User0
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null); Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
@ -321,9 +321,9 @@ public class MessageTest extends SmackTestCase {
Thread.sleep(200); Thread.sleep(200);
// User0 listen in both connected clients // User0 listen in both connected clients
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
PacketCollector coll4 = conn4.createPacketCollector(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 // Send a message from this resource to indicate most recent activity
conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain())); conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain()));
@ -368,7 +368,7 @@ public class MessageTest extends SmackTestCase {
Thread.sleep(200); Thread.sleep(200);
// User0 listen for incoming traffic // 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 // User1 sends a message to the bare JID of User0
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null); Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);

View file

@ -82,7 +82,7 @@ public class PacketReaderTest extends SmackTestCase {
iqPacket.setType(IQ.Type.get); iqPacket.setType(IQ.Type.get);
// Send the IQ and wait for the answer // Send the IQ and wait for the answer
PacketCollector collector = getConnection(0).createPacketCollector( StanzaCollector collector = getConnection(0).createStanzaCollector(
new PacketIDFilter(iqPacket.getStanzaId())); new PacketIDFilter(iqPacket.getStanzaId()));
getConnection(0).sendStanza(iqPacket); getConnection(0).sendStanza(iqPacket);
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
@ -100,7 +100,7 @@ public class PacketReaderTest extends SmackTestCase {
public void testRemoveListener() { public void testRemoveListener() {
PacketListener listener = new PacketListener() { PacketListener listener = new PacketListener() {
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
// Do nothing // Do nothing
} }
}; };
@ -135,7 +135,7 @@ public class PacketReaderTest extends SmackTestCase {
// User1 will always reply to user0 when a message is received // User1 will always reply to user0 when a message is received
getConnection(1).addAsyncPacketListener(new PacketListener() { getConnection(1).addAsyncPacketListener(new PacketListener() {
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
System.out.println(new Date() + " " + packet); System.out.println(new Date() + " " + packet);
Message message = new Message(packet.getFrom()); Message message = new Message(packet.getFrom());
@ -146,7 +146,7 @@ public class PacketReaderTest extends SmackTestCase {
}, new StanzaTypeFilter(Message.class)); }, new StanzaTypeFilter(Message.class));
// User0 listen for replies from user1 // User0 listen for replies from user1
PacketCollector collector = getConnection(0).createPacketCollector( StanzaCollector collector = getConnection(0).createStanzaCollector(
new FromMatchesFilter(getFullJID(1))); new FromMatchesFilter(getFullJID(1)));
// User0 sends the regular message to user1 // User0 sends the regular message to user1
getConnection(0).sendStanza(packet); getConnection(0).sendStanza(packet);
@ -176,7 +176,7 @@ public class PacketReaderTest extends SmackTestCase {
for (int j = 0; j < repeat; j++) { for (int j = 0; j < repeat; j++) {
PacketListener listener0 = new PacketListener() { PacketListener listener0 = new PacketListener() {
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
System.out.println("Packet Captured"); System.out.println("Packet Captured");
incCounter(); incCounter();
} }
@ -190,7 +190,7 @@ public class PacketReaderTest extends SmackTestCase {
}; };
PacketListener listener1 = new PacketListener() { PacketListener listener1 = new PacketListener() {
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
System.out.println("Packet Captured"); System.out.println("Packet Captured");
incCounter(); incCounter();
} }

View file

@ -111,17 +111,17 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
new CopyOnWriteArraySet<ConnectionListener>(); 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. * and perform blocking and polling operations on the result queue.
* <p> * <p>
* We use a ConcurrentLinkedQueue here, because its Iterator is weakly * We use a ConcurrentLinkedQueue here, because its Iterator is weakly
* consistent and we want {@link #invokePacketCollectors(Stanza)} for-each * consistent and we want {@link #invokeStanzaCollectorsAndNotifyRecvListeners(Stanza)} for-each
* loop to be lock free. As drawback, removing a PacketCollector is O(n). * 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 * The alternative would be a synchronized HashSet, but this would mean a
* synchronized block around every usage of <code>collectors</code>. * synchronized block around every usage of <code>collectors</code>.
* </p> * </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. * 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 // 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. // available. It will become available right after the resource has been successfully bound.
Bind bindResource = Bind.newSet(resource); Bind bindResource = Bind.newSet(resource);
PacketCollector packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(bindResource), bindResource); StanzaCollector packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(bindResource), bindResource);
Bind response = packetCollector.nextResultOrThrow(); Bind response = packetCollector.nextResultOrThrow();
// Set the connections user to the result of resource binding. It is important that we don't infer the user // 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, // 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(); boolean legacySessionDisabled = getConfiguration().isLegacySessionDisabled();
if (sessionFeature != null && !sessionFeature.isOptional() && !legacySessionDisabled) { if (sessionFeature != null && !sessionFeature.isOptional() && !legacySessionDisabled) {
Session session = new Session(); Session session = new Session();
packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(session), session); packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(session), session);
packetCollector.nextResultOrThrow(); packetCollector.nextResultOrThrow();
} }
} }
@ -743,18 +743,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
} }
@Override @Override
public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException { public StanzaCollector createStanzaCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException {
StanzaFilter packetFilter = new IQReplyFilter(packet, this); StanzaFilter packetFilter = new IQReplyFilter(packet, this);
// Create the packet collector before sending the packet // Create the packet collector before sending the packet
PacketCollector packetCollector = createPacketCollectorAndSend(packetFilter, packet); StanzaCollector packetCollector = createStanzaCollectorAndSend(packetFilter, packet);
return packetCollector; return packetCollector;
} }
@Override @Override
public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet) public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
throws NotConnectedException, InterruptedException { throws NotConnectedException, InterruptedException {
// Create the packet collector before sending the packet // Create the packet collector before sending the packet
PacketCollector packetCollector = createPacketCollector(packetFilter); StanzaCollector packetCollector = createStanzaCollector(packetFilter);
try { try {
// Now we can send the packet as the collector has been created // Now we can send the packet as the collector has been created
sendStanza(packet); sendStanza(packet);
@ -767,21 +767,21 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
} }
@Override @Override
public PacketCollector createPacketCollector(StanzaFilter packetFilter) { public StanzaCollector createStanzaCollector(StanzaFilter packetFilter) {
PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setStanzaFilter(packetFilter); StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration().setStanzaFilter(packetFilter);
return createPacketCollector(configuration); return createStanzaCollector(configuration);
} }
@Override @Override
public PacketCollector createPacketCollector(PacketCollector.Configuration configuration) { public StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration) {
PacketCollector collector = new PacketCollector(this, configuration); StanzaCollector collector = new StanzaCollector(this, configuration);
// Add the collector to the list of active collectors. // Add the collector to the list of active collectors.
collectors.add(collector); collectors.add(collector);
return collector; return collector;
} }
@Override @Override
public void removePacketCollector(PacketCollector collector) { public void removeStanzaCollector(StanzaCollector collector) {
collectors.remove(collector); collectors.remove(collector);
} }
@ -878,7 +878,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public void run() { public void run() {
for (StanzaListener listener : listenersToNotify) { for (StanzaListener listener : listenersToNotify) {
try { try {
listener.processPacket(packet); listener.processStanza(packet);
} }
catch (Exception e) { catch (Exception e) {
LOGGER.log(Level.WARNING, "Sending listener threw 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) { for (StanzaListener interceptor : interceptorsToInvoke) {
try { try {
interceptor.processPacket(packet); interceptor.processStanza(packet);
} catch (Exception e) { } catch (Exception e) {
LOGGER.log(Level.SEVERE, "Packet interceptor threw 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() { executorService.executeBlocking(new Runnable() {
@Override @Override
public void run() { public void run() {
invokePacketCollectorsAndNotifyRecvListeners(stanza); invokeStanzaCollectorsAndNotifyRecvListeners(stanza);
} }
}); });
} }
/** /**
* Invoke {@link PacketCollector#processPacket(Stanza)} for every * Invoke {@link StanzaCollector#processStanza(Stanza)} for every
* PacketCollector with the given packet. Also notify the receive listeners with a matching stanza(/packet) filter about the packet. * 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) { if (packet instanceof IQ) {
final IQ iq = (IQ) packet; final IQ iq = (IQ) packet;
final IQ.Type type = iq.getType(); final IQ.Type type = iq.getType();
@ -1140,7 +1140,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override @Override
public void run() { public void run() {
try { try {
listener.processPacket(packet); listener.processStanza(packet);
} catch (Exception e) { } catch (Exception e) {
LOGGER.log(Level.SEVERE, "Exception in async packet listener", 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. // Loop through all collectors and notify the appropriate ones.
for (PacketCollector collector: collectors) { for (StanzaCollector collector: collectors) {
collector.processPacket(packet); collector.processStanza(packet);
} }
// Notify the receive listeners interested in the packet // Notify the receive listeners interested in the packet
@ -1170,7 +1170,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public void run() { public void run() {
for (StanzaListener listener : listenersToNotify) { for (StanzaListener listener : listenersToNotify) {
try { try {
listener.processPacket(packet); listener.processStanza(packet);
} catch(NotConnectedException e) { } catch(NotConnectedException e) {
LOGGER.log(Level.WARNING, "Got not connected exception, aborting", e); LOGGER.log(Level.WARNING, "Got not connected exception, aborting", e);
break; break;
@ -1471,10 +1471,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
final StanzaListener packetListener = new StanzaListener() { final StanzaListener packetListener = new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException { public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
try { try {
XMPPErrorException.ifHasErrorThenThrow(packet); XMPPErrorException.ifHasErrorThenThrow(packet);
callback.processPacket(packet); callback.processStanza(packet);
} }
catch (XMPPErrorException e) { catch (XMPPErrorException e) {
if (exceptionCallback != null) { if (exceptionCallback != null) {
@ -1532,9 +1532,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public void addOneTimeSyncCallback(final StanzaListener callback, final StanzaFilter packetFilter) { public void addOneTimeSyncCallback(final StanzaListener callback, final StanzaFilter packetFilter) {
final StanzaListener packetListener = new StanzaListener() { final StanzaListener packetListener = new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException { public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
try { try {
callback.processPacket(packet); callback.processStanza(packet);
} finally { } finally {
removeSyncStanzaListener(this); removeSyncStanzaListener(this);
} }

View file

@ -129,7 +129,7 @@ public final class SmackConfiguration {
* *
* @return The number of packets to queue before deleting older packets. * @return The number of packets to queue before deleting older packets.
*/ */
public static int getPacketCollectorSize() { public static int getStanzaCollectorSize() {
return packetCollectorSize; return packetCollectorSize;
} }
@ -139,7 +139,7 @@ public final class SmackConfiguration {
* *
* @param collectorSize the number of packets to queue before deleting older packets. * @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; packetCollectorSize = collectorSize;
} }

View file

@ -93,7 +93,7 @@ public class SmackException extends Exception {
} }
public static NoResponseException newWith(XMPPConnection connection, public static NoResponseException newWith(XMPPConnection connection,
PacketCollector collector) { StanzaCollector collector) {
return newWith(connection, collector.getStanzaFilter()); return newWith(connection, collector.getStanzaFilter());
} }

View file

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; import org.jivesoftware.smack.packet.Stanza;
/** /**
* Provides a mechanism to collect packets into a result queue that pass a * Provides a mechanism to collect Stanzas into a result queue that pass a
* specified filter. The collector lets you perform blocking and polling * specified filter/matcher. The collector lets you perform blocking and polling
* operations on the result queue. So, a PacketCollector is more suitable to * 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 * use than a {@link StanzaListener} when you need to wait for a specific
* result.<p> * result.<p>
* *
* Each stanza(/packet) collector will queue up a configured number of packets for processing before * 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 * 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 * @author Matt Tucker
*/ */
public class PacketCollector { public class StanzaCollector {
private final StanzaFilter packetFilter; 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. * 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; private final XMPPConnection connection;
@ -62,7 +62,7 @@ public class PacketCollector {
* @param connection the connection the collector is tied to. * @param connection the connection the collector is tied to.
* @param configuration the configuration used to construct this collector * @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.connection = connection;
this.packetFilter = configuration.packetFilter; this.packetFilter = configuration.packetFilter;
this.resultQueue = new ArrayBlockingQueue<>(configuration.size); this.resultQueue = new ArrayBlockingQueue<>(configuration.size);
@ -78,7 +78,7 @@ public class PacketCollector {
// If the packet collector has already been cancelled, do nothing. // If the packet collector has already been cancelled, do nothing.
if (!cancelled) { if (!cancelled) {
cancelled = true; cancelled = true;
connection.removePacketCollector(this); connection.removeStanzaCollector(this);
} }
} }
@ -274,7 +274,7 @@ public class PacketCollector {
* *
* @param packet the stanza(/packet) to process. * @param packet the stanza(/packet) to process.
*/ */
protected void processPacket(Stanza packet) { protected void processStanza(Stanza packet) {
if (packetFilter == null || packetFilter.accept(packet)) { if (packetFilter == null || packetFilter.accept(packet)) {
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
while (!resultQueue.offer(packet)) { while (!resultQueue.offer(packet)) {
@ -305,8 +305,8 @@ public class PacketCollector {
public static final class Configuration { public static final class Configuration {
private StanzaFilter packetFilter; private StanzaFilter packetFilter;
private int size = SmackConfiguration.getPacketCollectorSize(); private int size = SmackConfiguration.getStanzaCollectorSize();
private PacketCollector collectorToReset; private StanzaCollector collectorToReset;
private Configuration() { private Configuration() {
} }
@ -355,7 +355,7 @@ public class PacketCollector {
* @param collector * @param collector
* @return a reference to this configuration. * @return a reference to this configuration.
*/ */
public Configuration setCollectorToReset(PacketCollector collector) { public Configuration setCollectorToReset(StanzaCollector collector) {
this.collectorToReset = collector; this.collectorToReset = collector;
return this; return this;
} }

View file

@ -23,8 +23,8 @@ import org.jivesoftware.smack.packet.Stanza;
/** /**
* Provides a mechanism to listen for packets that pass a specified filter. * 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, * This allows event-style programming -- every time a new stanza(/packet) is found,
* the {@link #processPacket(Stanza)} method will be called. This is the * the {@link #processStanza(Stanza)} method will be called. This is the
* opposite approach to the functionality provided by a {@link PacketCollector} * opposite approach to the functionality provided by a {@link StanzaCollector}
* which lets you block while waiting for results. * which lets you block while waiting for results.
* <p> * <p>
* Additionally you are able to intercept Packets that are going to be send and * Additionally you are able to intercept Packets that are going to be send and
@ -50,6 +50,6 @@ public interface StanzaListener {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException; public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException;
} }

View file

@ -225,11 +225,11 @@ public interface XMPPConnection {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @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 * 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 * more suitable to use than a {@link StanzaListener} when you need to wait for
* a specific result. * a specific result.
* *
@ -239,46 +239,46 @@ public interface XMPPConnection {
* @throws InterruptedException * @throws InterruptedException
* @throws NotConnectedException * @throws NotConnectedException
*/ */
public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet) public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
throws NotConnectedException, InterruptedException; throws NotConnectedException, InterruptedException;
/** /**
* Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter * Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter
* determines which packets will be accumulated by the collector. A * 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. * when you need to wait for a specific result.
* <p> * <p>
* <b>Note:</b> If you send a Stanza(/Packet) right after using this method, then * <b>Note:</b> If you send a Stanza(/Packet) right after using this method, then
* consider using * consider using
* {@link #createPacketCollectorAndSend(StanzaFilter, Stanza)} instead. * {@link #createStanzaCollectorAndSend(StanzaFilter, Stanza)} instead.
* Otherwise make sure cancel the PacketCollector in every case, e.g. even * Otherwise make sure cancel the StanzaCollector in every case, e.g. even
* if an exception is thrown, or otherwise you may leak the PacketCollector. * if an exception is thrown, or otherwise you may leak the StanzaCollector.
* </p> * </p>
* *
* @param packetFilter the stanza(/packet) filter to use. * @param packetFilter the stanza(/packet) filter to use.
* @return a new stanza(/packet) collector. * @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. * Create a new stanza(/packet) collector with the given stanza(/packet) collector configuration.
* <p> * <p>
* Please make sure to cancel the collector when it is no longer required. See also * Please make sure to cancel the collector when it is no longer required. See also
* {@link #createPacketCollector(StanzaFilter)}. * {@link #createStanzaCollector(StanzaFilter)}.
* </p> * </p>
* *
* @param configuration the stanza(/packet) collector configuration. * @param configuration the stanza(/packet) collector configuration.
* @return a new stanza(/packet) collector. * @return a new stanza(/packet) collector.
* @since 4.1 * @since 4.1
*/ */
public PacketCollector createPacketCollector(PacketCollector.Configuration configuration); public StanzaCollector createStanzaCollector(StanzaCollector.Configuration configuration);
/** /**
* Remove a stanza(/packet) collector of this connection. * Remove a stanza(/packet) collector of this connection.
* *
* @param collector a stanza(/packet) collectors which was created for 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. * 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 * 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 * 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 * 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> * </p>
* *
* @param packetListener the stanza(/packet) listener to notify of new received packets. * @param packetListener the stanza(/packet) listener to notify of new received packets.

View file

@ -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 // 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. // data as Smack sees it and not as it's coming in as raw XML.
listener = new StanzaListener() { listener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
if (printInterpreted) { if (printInterpreted) {
log("RCV PKT (" + connection.getConnectionCounter() + "): " + packet.toXML()); log("RCV PKT (" + connection.getConnectionCounter() + "): " + packet.toXML());
} }

View file

@ -37,10 +37,10 @@ package org.jivesoftware.smack.filter;
* } * }
* }; * };
* // Create a new stanza(/packet) collector using the filter we created. * // Create a new stanza(/packet) collector using the filter we created.
* PacketCollector myCollector = packetReader.createPacketCollector(myFilter); * StanzaCollector myCollector = packetReader.createStanzaCollector(myFilter);
* </pre> * </pre>
* *
* @see org.jivesoftware.smack.PacketCollector * @see org.jivesoftware.smack.StanzaCollector
* @see org.jivesoftware.smack.StanzaListener * @see org.jivesoftware.smack.StanzaListener
* @author Matt Tucker * @author Matt Tucker
* @deprecated use {@link StanzaFilter} * @deprecated use {@link StanzaFilter}

View file

@ -39,10 +39,10 @@ import org.jivesoftware.smack.packet.Stanza;
* } * }
* }; * };
* // Create a new stanza collector using the filter we created. * // Create a new stanza collector using the filter we created.
* PacketCollector myCollector = connection.createPacketCollector(myFilter); * StanzaCollector myCollector = connection.createStanzaCollector(myFilter);
* </pre> * </pre>
* *
* @see org.jivesoftware.smack.PacketCollector * @see org.jivesoftware.smack.StanzaCollector
* @see org.jivesoftware.smack.StanzaListener * @see org.jivesoftware.smack.StanzaListener
* @author Matt Tucker * @author Matt Tucker
*/ */

View file

@ -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; package org.jivesoftware.smack.filter;

View file

@ -180,7 +180,7 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param packet the stanza(/packet) to process. * @param packet the stanza(/packet) to process.
*/ */
public void processStanza(Stanza packet) { public void processStanza(Stanza packet) {
invokePacketCollectorsAndNotifyRecvListeners(packet); invokeStanzaCollectorsAndNotifyRecvListeners(packet);
} }
/** /**

View file

@ -23,18 +23,18 @@ import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.junit.Test; import org.junit.Test;
public class PacketCollectorTest public class StanzaCollectorTest
{ {
@Test @Test
public void verifyRollover() throws InterruptedException 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++) for (int i=0; i<6; i++)
{ {
Stanza testPacket = new TestPacket(i); Stanza testPacket = new TestPacket(i);
collector.processPacket(testPacket); collector.processStanza(testPacket);
} }
// Assert that '0' has rolled off // Assert that '0' has rolled off
@ -48,7 +48,7 @@ public class PacketCollectorTest
for (int i=10; i<15; i++) for (int i=10; i<15; i++)
{ {
Stanza testPacket = new TestPacket(i); Stanza testPacket = new TestPacket(i);
collector.processPacket(testPacket); collector.processStanza(testPacket);
} }
assertEquals("10", collector.nextResultBlockForever().getStanzaId()); assertEquals("10", collector.nextResultBlockForever().getStanzaId());
@ -69,7 +69,7 @@ public class PacketCollectorTest
public void verifyThreadSafety() public void verifyThreadSafety()
{ {
int insertCount = 500; 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() Thread consumer1 = new Thread(new Runnable()
{ {
@ -158,7 +158,7 @@ public class PacketCollectorTest
for(int i=0; i<insertCount; i++) for(int i=0; i<insertCount; i++)
{ {
collector.processPacket(new TestPacket(i)); collector.processStanza(new TestPacket(i));
} }
try 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));
} }
} }

View file

@ -28,7 +28,7 @@ public class WaitForPacketListener implements StanzaListener {
private CountDownLatch latch = new CountDownLatch(1); private CountDownLatch latch = new CountDownLatch(1);
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
reportInvoked(); reportInvoked();
} }

View file

@ -31,7 +31,7 @@ class SLF4JLoggingPacketListener implements StanzaListener {
this.prefix = Validate.notNull(prefix); this.prefix = Validate.notNull(prefix);
} }
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) { if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
logger.debug("{}: PKT [{}] '{}'", prefix, packet.getClass().getName(), packet.toXML()); logger.debug("{}: PKT [{}] '{}'", prefix, packet.getClass().getName(), packet.toXML());
} }

View file

@ -208,7 +208,7 @@ public class EnhancedDebugger implements SmackDebugger {
packetReaderListener = new StanzaListener() { packetReaderListener = new StanzaListener() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS"); SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");
public void processPacket(final Stanza packet) { public void processStanza(final Stanza packet) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
public void run() { public void run() {
addReadPacketToTable(dateFormatter, packet); addReadPacketToTable(dateFormatter, packet);
@ -223,7 +223,7 @@ public class EnhancedDebugger implements SmackDebugger {
packetWriterListener = new StanzaListener() { packetWriterListener = new StanzaListener() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS"); SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss:SS");
public void processPacket(final Stanza packet) { public void processStanza(final Stanza packet) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
public void run() { public void run() {
addSentPacketToTable(dateFormatter, packet); addSentPacketToTable(dateFormatter, packet);

View file

@ -262,7 +262,7 @@ public class LiteDebugger implements SmackDebugger {
// the GUI. This is what we call "interpreted" packet data, since it's the packet // 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. // data as Smack sees it and not as it's coming in as raw XML.
listener = new StanzaListener() { listener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
interpretedText1.append(packet.toXML().toString()); interpretedText1.append(packet.toXML().toString());
interpretedText2.append(packet.toXML().toString()); interpretedText2.append(packet.toXML().toString());
interpretedText1.append(NEWLINE); interpretedText1.append(NEWLINE);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -230,7 +230,7 @@ public final class MultiUserChatLightManager extends Manager {
mucLightBlockingIQ.setTo(mucLightService); mucLightBlockingIQ.setTo(mucLightService);
StanzaFilter responseFilter = new IQReplyFilter(mucLightBlockingIQ, connection()); StanzaFilter responseFilter = new IQReplyFilter(mucLightBlockingIQ, connection());
IQ responseIq = connection().createPacketCollectorAndSend(responseFilter, mucLightBlockingIQ) IQ responseIq = connection().createStanzaCollectorAndSend(responseFilter, mucLightBlockingIQ)
.nextResultOrThrow(); .nextResultOrThrow();
MUCLightBlockingIQ muclIghtBlockingIQResult = (MUCLightBlockingIQ) responseIq; MUCLightBlockingIQ muclIghtBlockingIQResult = (MUCLightBlockingIQ) responseIq;
@ -278,7 +278,7 @@ public final class MultiUserChatLightManager extends Manager {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null); MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(Type.set); mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService); 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 mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(Type.set); mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService); 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 mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(Type.set); mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService); 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 mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(Type.set); mucLightBlockingIQ.setType(Type.set);
mucLightBlockingIQ.setTo(mucLightService); mucLightBlockingIQ.setTo(mucLightService);
connection().createPacketCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow(); connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
} }
} }

View file

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

View file

@ -59,7 +59,7 @@ public class CompressionTest extends SmackTestCase {
version.setTo(getXMPPServiceDomain()); version.setTo(getXMPPServiceDomain());
// Create a packet collector to listen for a response. // 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); connection.sendStanza(version);

View file

@ -18,7 +18,7 @@
package org.jivesoftware.smackx; package org.jivesoftware.smackx;
import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.ThreadFilter; import org.jivesoftware.smack.filter.ThreadFilter;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
@ -77,9 +77,9 @@ public class FormTest extends SmackTestCase {
// Create the chats between the two participants // Create the chats between the two participants
Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null); Chat chat = getConnection(0).getChatManager().createChat(getBareJID(1), null);
PacketCollector collector = getConnection(0).createPacketCollector( StanzaCollector collector = getConnection(0).createStanzaCollector(
new ThreadFilter(chat.getThreadID())); new ThreadFilter(chat.getThreadID()));
PacketCollector collector2 = getConnection(1).createPacketCollector( StanzaCollector collector2 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat.getThreadID())); new ThreadFilter(chat.getThreadID()));
Message msg = new Message(); Message msg = new Message();

View file

@ -30,7 +30,7 @@ import org.jivesoftware.smack.filter.StanzaExtensionFilter;
*/ */
public class GroupChatInvitationTest extends SmackTestCase { public class GroupChatInvitationTest extends SmackTestCase {
private PacketCollector collector = null; private StanzaCollector collector = null;
/** /**
* Constructor for GroupChatInvitationTest. * Constructor for GroupChatInvitationTest.
@ -68,7 +68,7 @@ public class GroupChatInvitationTest extends SmackTestCase {
super.setUp(); super.setUp();
// Register listener for groupchat invitations. // Register listener for groupchat invitations.
PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference"); PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference");
collector = getConnection(1).createPacketCollector(filter); collector = getConnection(1).createStanzaCollector(filter);
} }
protected void tearDown() throws Exception { protected void tearDown() throws Exception {

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx; package org.jivesoftware.smackx;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.filter.MessageTypeFilter;
@ -45,12 +45,12 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
*/ */
public void testSending() throws XMPPException { public void testSending() throws XMPPException {
PacketCollector collector1 = StanzaCollector collector1 =
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector2 = StanzaCollector collector2 =
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector3 = StanzaCollector collector3 =
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
Message message = new Message(); Message message = new Message();
message.setBody("Hola"); message.setBody("Hola");
@ -110,14 +110,14 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
* Ensures that replying to packets is ok. * Ensures that replying to packets is ok.
*/ */
public void testReplying() throws XMPPException { public void testReplying() throws XMPPException {
PacketCollector collector0 = StanzaCollector collector0 =
getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector1 = StanzaCollector collector1 =
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector2 = StanzaCollector collector2 =
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector3 = StanzaCollector collector3 =
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
// Send the intial message with multiple recipients // Send the intial message with multiple recipients
Message message = new Message(); Message message = new Message();
@ -192,12 +192,12 @@ public class MultipleRecipientManagerTest extends SmackTestCase {
* Ensures that replying is not allowed when disabled. * Ensures that replying is not allowed when disabled.
*/ */
public void testNoReply() throws XMPPException { public void testNoReply() throws XMPPException {
PacketCollector collector1 = StanzaCollector collector1 =
getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(1).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector2 = StanzaCollector collector2 =
getConnection(2).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(2).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
PacketCollector collector3 = StanzaCollector collector3 =
getConnection(3).createPacketCollector(new MessageTypeFilter(Message.Type.normal)); getConnection(3).createStanzaCollector(new MessageTypeFilter(Message.Type.normal));
// Send the intial message with multiple recipients // Send the intial message with multiple recipients
Message message = new Message(); Message message = new Message();

View file

@ -18,7 +18,7 @@
package org.jivesoftware.smackx; package org.jivesoftware.smackx;
import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
@ -98,7 +98,7 @@ public class OfflineMessageManagerTest extends SmackTestCase {
assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount()); assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount());
// User2 becomes available again // User2 becomes available again
PacketCollector collector = getConnection(1).createPacketCollector( StanzaCollector collector = getConnection(1).createStanzaCollector(
new MessageTypeFilter(Message.Type.chat)); new MessageTypeFilter(Message.Type.chat));
getConnection(1).sendStanza(new Presence(Presence.Type.available)); 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()); assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount());
// User2 becomes available again // User2 becomes available again
PacketCollector collector = getConnection(1).createPacketCollector( StanzaCollector collector = getConnection(1).createStanzaCollector(
new MessageTypeFilter(Message.Type.chat)); new MessageTypeFilter(Message.Type.chat));
getConnection(1).sendStanza(new Presence(Presence.Type.available)); getConnection(1).sendStanza(new Presence(Presence.Type.available));

View file

@ -90,7 +90,7 @@ public class XHTMLManagerTest extends SmackTestCase {
public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() { public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// User1 creates a message to send to user2 // User1 creates a message to send to user2
@ -150,7 +150,7 @@ public class XHTMLManagerTest extends SmackTestCase {
public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() { public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// User1 creates a message to send to user2 // User1 creates a message to send to user2

View file

@ -19,7 +19,7 @@ import java.util.Random;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter; import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Packet;
@ -61,7 +61,7 @@ public class InBandBytestreamTest extends SmackTestCase {
open.setFrom(initiatorConnection.getUser()); open.setFrom(initiatorConnection.getUser());
open.setTo(targetConnection.getUser()); open.setTo(targetConnection.getUser());
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter( StanzaCollector collector = initiatorConnection.createStanzaCollector(new PacketIDFilter(
open.getStanzaId())); open.getStanzaId()));
initiatorConnection.sendStanza(open); initiatorConnection.sendStanza(open);
Packet result = collector.nextResult(); Packet result = collector.nextResult();

View file

@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter; import org.jivesoftware.smack.filter.PacketIDFilter;
@ -82,7 +82,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
initiatorConnection.getUser(), targetConnection.getUser(), "session_id"); initiatorConnection.getUser(), targetConnection.getUser(), "session_id");
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777); bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter( StanzaCollector collector = initiatorConnection.createStanzaCollector(new PacketIDFilter(
bytestreamInitiation.getStanzaId())); bytestreamInitiation.getStanzaId()));
initiatorConnection.sendStanza(bytestreamInitiation); initiatorConnection.sendStanza(bytestreamInitiation);
Packet result = collector.nextResult(); Packet result = collector.nextResult();

View file

@ -29,7 +29,7 @@ import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ChatManagerListener; import org.jivesoftware.smack.ChatManagerListener;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.TCPConnection; import org.jivesoftware.smack.TCPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
@ -453,7 +453,7 @@ public class MultiUserChatTest extends SmackTestCase {
// Start a private chat with another participant // Start a private chat with another participant
Chat chat = muc2.createPrivateChat(room + "/testbot", null); Chat chat = muc2.createPrivateChat(room + "/testbot", null);
PacketCollector collector = chat.createCollector(); StanzaCollector collector = chat.createCollector();
chat.sendMessage("Hello there"); chat.sendMessage("Hello there");
Message response = (Message) collector.nextResult(2000); Message response = (Message) collector.nextResult(2000);

View file

@ -85,7 +85,7 @@ public class MessageEventTest extends SmackTestCase {
// This listener will listen on the conn2 and answer an ACK if everything is ok // This listener will listen on the conn2 and answer an ACK if everything is ok
PacketFilter packetFilter = new StanzaExtensionFilter("x", "jabber:x:event"); PacketFilter packetFilter = new StanzaExtensionFilter("x", "jabber:x:event");
PacketListener packetListener = new PacketListener() { PacketListener packetListener = new PacketListener() {
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
Message message = (Message) packet; Message message = (Message) packet;
try { try {
MessageEvent messageEvent = MessageEvent messageEvent =

View file

@ -71,7 +71,7 @@ public class RosterExchangeTest extends SmackTestCase {
public void testSendAndReceiveRosterEntries() { public void testSendAndReceiveRosterEntries() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// Create the message to send with the roster // Create the message to send with the roster
@ -115,7 +115,7 @@ public class RosterExchangeTest extends SmackTestCase {
public void testSendAndAcceptRosterEntries() { public void testSendAndAcceptRosterEntries() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// Create the message to send with the roster // Create the message to send with the roster

View file

@ -20,7 +20,7 @@ package org.jivesoftware.smackx.packet;
import java.util.Iterator; import java.util.Iterator;
import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.filter.StanzaExtensionFilter; import org.jivesoftware.smack.filter.StanzaExtensionFilter;
import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketFilter;
@ -83,7 +83,7 @@ public class XHTMLExtensionTest extends SmackTestCase {
public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() { public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// User1 creates a message to send to user2 // User1 creates a message to send to user2
@ -136,7 +136,7 @@ public class XHTMLExtensionTest extends SmackTestCase {
public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() { public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection // Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); 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())); new ThreadFilter(chat1.getThreadID()));
// Create a Listener that listens for Messages with the extension // 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"); new StanzaExtensionFilter("html", "http://jabber.org/protocol/xhtml-im");
PacketListener packetListener = new PacketListener() { PacketListener packetListener = new PacketListener() {
@Override @Override
public void processPacket(Packet packet) { public void processStanza(Packet packet) {
} }
}; };

View file

@ -165,7 +165,7 @@ public final class BlockingCommandManager extends Manager {
if (blockListCached == null) { if (blockListCached == null) {
BlockListIQ blockListIQ = new BlockListIQ(); BlockListIQ blockListIQ = new BlockListIQ();
BlockListIQ blockListIQResult = connection().createPacketCollectorAndSend(blockListIQ).nextResultOrThrow(); BlockListIQ blockListIQResult = connection().createStanzaCollectorAndSend(blockListIQ).nextResultOrThrow();
blockListCached = blockListIQResult.getBlockedJidsCopy(); blockListCached = blockListIQResult.getBlockedJidsCopy();
} }
@ -184,7 +184,7 @@ public final class BlockingCommandManager extends Manager {
public void blockContacts(List<Jid> jids) public void blockContacts(List<Jid> jids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids); 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) public void unblockContacts(List<Jid> jids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(jids); 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() public void unblockAll()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(); UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ();
connection().createPacketCollectorAndSend(unblockContactIQ).nextResultOrThrow(); connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow();
} }
} }

View file

@ -147,7 +147,7 @@ public final class BoBManager extends Manager {
requestBoBIQ.setTo(to); requestBoBIQ.setTo(to);
XMPPConnection connection = getAuthenticatedConnectionOrThrow(); XMPPConnection connection = getAuthenticatedConnectionOrThrow();
BoBIQ responseBoBIQ = connection.createPacketCollectorAndSend(requestBoBIQ).nextResultOrThrow(); BoBIQ responseBoBIQ = connection.createStanzaCollectorAndSend(requestBoBIQ).nextResultOrThrow();
bobData = responseBoBIQ.getBoBData(); bobData = responseBoBIQ.getBoBData();
BOB_CACHE.put(bobHash, bobData); BOB_CACHE.put(bobHash, bobData);

View file

@ -426,7 +426,7 @@ public final class InBandBytestreamManager implements BytestreamManager {
byteStreamRequest.setTo(targetJID); byteStreamRequest.setTo(targetJID);
// sending packet will throw exception on timeout or error reply // sending packet will throw exception on timeout or error reply
connection.createPacketCollectorAndSend(byteStreamRequest).nextResultOrThrow(); connection.createStanzaCollectorAndSend(byteStreamRequest).nextResultOrThrow();
InBandBytestreamSession inBandBytestreamSession = new InBandBytestreamSession( InBandBytestreamSession inBandBytestreamSession = new InBandBytestreamSession(
this.connection, byteStreamRequest, targetJID); this.connection, byteStreamRequest, targetJID);

View file

@ -211,7 +211,7 @@ public class InBandBytestreamSession implements BytestreamSession {
Close close = new Close(this.byteStreamRequest.getSessionID()); Close close = new Close(this.byteStreamRequest.getSessionID());
close.setTo(this.remoteJID); close.setTo(this.remoteJID);
try { try {
connection.createPacketCollectorAndSend(close).nextResultOrThrow(); connection.createStanzaCollectorAndSend(close).nextResultOrThrow();
} }
catch (Exception e) { catch (Exception e) {
// Sadly we are unable to use the IOException(Throwable) constructor because this // 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; private long lastSequence = -1;
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException { public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
// get data packet extension // get data packet extension
DataPacketExtension data = ((Data) packet).getDataPacketExtension(); DataPacketExtension data = ((Data) packet).getDataPacketExtension();
@ -510,7 +510,7 @@ public class InBandBytestreamSession implements BytestreamSession {
protected StanzaListener getDataPacketListener() { protected StanzaListener getDataPacketListener() {
return new StanzaListener() { return new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
// get data packet extension // get data packet extension
DataPacketExtension data = (DataPacketExtension) packet.getExtension( DataPacketExtension data = (DataPacketExtension) packet.getExtension(
DataPacketExtension.ELEMENT, DataPacketExtension.ELEMENT,
@ -781,7 +781,7 @@ public class InBandBytestreamSession implements BytestreamSession {
iq.setTo(remoteJID); iq.setTo(remoteJID);
try { try {
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} }
catch (Exception e) { catch (Exception e) {
// close session unless it is already closed // close session unless it is already closed
@ -824,7 +824,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* @throws InterruptedException * @throws InterruptedException
*/ */
public void processIQPacket(Data data) throws NotConnectedException, InterruptedException { public void processIQPacket(Data data) throws NotConnectedException, InterruptedException {
inputStream.dataPacketListener.processPacket(data); inputStream.dataPacketListener.processStanza(data);
} }
} }

View file

@ -464,7 +464,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts); Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts);
// send initiation packet // send initiation packet
Stanza response = connection.createPacketCollectorAndSend(initiation).nextResultOrThrow( Stanza response = connection.createStanzaCollectorAndSend(initiation).nextResultOrThrow(
getTargetResponseTimeout()); getTargetResponseTimeout());
// extract used stream host from response // extract used stream host from response
@ -590,7 +590,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
for (Jid proxy : proxies) { for (Jid proxy : proxies) {
Bytestream streamHostRequest = createStreamHostRequest(proxy); Bytestream streamHostRequest = createStreamHostRequest(proxy);
try { try {
Bytestream response = (Bytestream) connection.createPacketCollectorAndSend( Bytestream response = (Bytestream) connection.createStanzaCollectorAndSend(
streamHostRequest).nextResultOrThrow(); streamHostRequest).nextResultOrThrow();
streamHosts.addAll(response.getStreamHosts()); streamHosts.addAll(response.getStreamHosts());
} }

View file

@ -113,7 +113,7 @@ class Socks5ClientForInitiator extends Socks5Client {
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Bytestream activate = createStreamHostActivation(); Bytestream activate = createStreamHostActivation();
// if activation fails #nextResultOrThrow() throws an exception // if activation fails #nextResultOrThrow() throws an exception
connection.get().createPacketCollectorAndSend(activate).nextResultOrThrow(); connection.get().createStanzaCollectorAndSend(activate).nextResultOrThrow();
} }
/** /**

View file

@ -317,7 +317,7 @@ public final class EntityCapsManager extends Manager {
// Listen for remote presence stanzas with the caps extension // Listen for remote presence stanzas with the caps extension
// If we receive such a stanza, record the JID and nodeVer // If we receive such a stanza, record the JID and nodeVer
@Override @Override
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
if (!entityCapsEnabled()) if (!entityCapsEnabled())
return; return;
@ -337,7 +337,7 @@ public final class EntityCapsManager extends Manager {
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
presenceSend = (Presence) packet; presenceSend = (Presence) packet;
} }
}, PresenceTypeFilter.OUTGOING_PRESENCE_BROADCAST); }, PresenceTypeFilter.OUTGOING_PRESENCE_BROADCAST);
@ -346,7 +346,7 @@ public final class EntityCapsManager extends Manager {
// XEP-0115 specifies that a client SHOULD include entity capabilities // XEP-0115 specifies that a client SHOULD include entity capabilities
// with every presence notification it sends. // with every presence notification it sends.
StanzaListener packetInterceptor = new StanzaListener() { StanzaListener packetInterceptor = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
if (!entityCapsEnabled) { if (!entityCapsEnabled) {
// Be sure to not send stanzas with the caps extension if it's not enabled // Be sure to not send stanzas with the caps extension if it's not enabled
packet.removeExtension(CapsExtension.ELEMENT, CapsExtension.NAMESPACE); packet.removeExtension(CapsExtension.ELEMENT, CapsExtension.NAMESPACE);

View file

@ -145,7 +145,7 @@ public class RemoteCommand extends AdHocCommand {
AdHocCommandData responseData = null; AdHocCommandData responseData = null;
try { try {
responseData = connection.createPacketCollectorAndSend(data).nextResultOrThrow(); responseData = connection.createStanzaCollectorAndSend(data).nextResultOrThrow();
} }
finally { finally {
// We set the response data in a 'finally' block, so that it also gets set even if an error IQ was returned. // We set the response data in a 'finally' block, so that it also gets set even if an error IQ was returned.

View file

@ -536,7 +536,7 @@ public final class ServiceDiscoveryManager extends Manager {
disco.setTo(entityID); disco.setTo(entityID);
disco.setNode(node); disco.setNode(node);
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow(); Stanza result = connection().createStanzaCollectorAndSend(disco).nextResultOrThrow();
return (DiscoverInfo) result; return (DiscoverInfo) result;
} }
@ -575,7 +575,7 @@ public final class ServiceDiscoveryManager extends Manager {
disco.setTo(entityID); disco.setTo(entityID);
disco.setNode(node); disco.setNode(node);
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow(); Stanza result = connection().createStanzaCollectorAndSend(disco).nextResultOrThrow();
return (DiscoverItems) result; return (DiscoverItems) result;
} }
@ -647,7 +647,7 @@ public final class ServiceDiscoveryManager extends Manager {
discoverItems.setTo(entityID); discoverItems.setTo(entityID);
discoverItems.setNode(node); discoverItems.setNode(node);
connection().createPacketCollectorAndSend(discoverItems).nextResultOrThrow(); connection().createStanzaCollectorAndSend(discoverItems).nextResultOrThrow();
} }
/** /**

View file

@ -315,7 +315,7 @@ public final class FileTransferNegotiator extends Manager {
si.setTo(userID); si.setTo(userID);
si.setType(IQ.Type.set); si.setType(IQ.Type.set);
Stanza siResponse = connection().createPacketCollectorAndSend(si).nextResultOrThrow( Stanza siResponse = connection().createStanzaCollectorAndSend(si).nextResultOrThrow(
responseTimeout); responseTimeout);
if (siResponse instanceof IQ) { if (siResponse instanceof IQ) {

View file

@ -135,7 +135,7 @@ public final class LastActivityManager extends Manager {
// Listen to all the sent messages to reset the idle time on each one // Listen to all the sent messages to reset the idle time on each one
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Presence presence = (Presence) packet; Presence presence = (Presence) packet;
Presence.Mode mode = presence.getMode(); Presence.Mode mode = presence.getMode();
if (mode == null) return; if (mode == null) return;
@ -154,7 +154,7 @@ public final class LastActivityManager extends Manager {
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message message = (Message) packet; Message message = (Message) packet;
// if it's not an error message, reset the idle time // if it's not an error message, reset the idle time
if (message.getType() == Message.Type.error) return; 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, public LastActivity getLastActivity(Jid jid) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException { NotConnectedException, InterruptedException {
LastActivity activity = new LastActivity(jid); LastActivity activity = new LastActivity(jid);
return (LastActivity) connection().createPacketCollectorAndSend(activity).nextResultOrThrow(); return (LastActivity) connection().createStanzaCollectorAndSend(activity).nextResultOrThrow();
} }
/** /**

View file

@ -162,7 +162,7 @@ public final class PrivateDataManager extends Manager {
// Create an IQ packet to get the private data. // Create an IQ packet to get the private data.
IQ privateDataGet = new PrivateDataIQ(elementName, namespace); IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
PrivateDataIQ response = connection().createPacketCollectorAndSend( PrivateDataIQ response = connection().createStanzaCollectorAndSend(
privateDataGet).nextResultOrThrow(); privateDataGet).nextResultOrThrow();
return response.getPrivateData(); return response.getPrivateData();
} }
@ -182,7 +182,7 @@ public final class PrivateDataManager extends Manager {
// Create an IQ packet to set the private data. // Create an IQ packet to set the private data.
IQ privateDataSet = new PrivateDataIQ(privateData); IQ privateDataSet = new PrivateDataIQ(privateData);
connection().createPacketCollectorAndSend(privateDataSet).nextResultOrThrow(); connection().createStanzaCollectorAndSend(privateDataSet).nextResultOrThrow();
} }
private static final PrivateData DUMMY_PRIVATE_DATA = new PrivateData() { private static final PrivateData DUMMY_PRIVATE_DATA = new PrivateData() {

View file

@ -24,7 +24,7 @@ import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
@ -283,7 +283,7 @@ public final class AccountManager extends Manager {
Registration reg = new Registration(attributes); Registration reg = new Registration(attributes);
reg.setType(IQ.Type.set); reg.setType(IQ.Type.set);
reg.setTo(connection().getXMPPServiceDomain()); 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); Registration reg = new Registration(map);
reg.setType(IQ.Type.set); reg.setType(IQ.Type.set);
reg.setTo(connection().getXMPPServiceDomain()); 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); Registration reg = new Registration(attributes);
reg.setType(IQ.Type.set); reg.setType(IQ.Type.set);
reg.setTo(connection().getXMPPServiceDomain()); reg.setTo(connection().getXMPPServiceDomain());
createPacketCollectorAndSend(reg).nextResultOrThrow(); createStanzaCollectorAndSend(reg).nextResultOrThrow();
} }
public boolean isSupported() public boolean isSupported()
@ -356,11 +356,11 @@ public final class AccountManager extends Manager {
private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setTo(connection().getXMPPServiceDomain()); reg.setTo(connection().getXMPPServiceDomain());
info = createPacketCollectorAndSend(reg).nextResultOrThrow(); info = createStanzaCollectorAndSend(reg).nextResultOrThrow();
} }
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException { private StanzaCollector createStanzaCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException {
PacketCollector collector = connection().createPacketCollectorAndSend(new StanzaIdFilter(req.getStanzaId()), req); StanzaCollector collector = connection().createStanzaCollectorAndSend(new StanzaIdFilter(req.getStanzaId()), req);
return collector; return collector;
} }
} }

View file

@ -144,7 +144,7 @@ public final class VersionManager extends Manager {
if (!isSupported(jid)) { if (!isSupported(jid)) {
return null; 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) { private static Version generateVersionFrom(String name, String version, String os) {

View file

@ -28,7 +28,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.StanzaListener; import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.PresenceListener; import org.jivesoftware.smack.PresenceListener;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
@ -143,7 +143,7 @@ public class MultiUserChat {
private String subject; private String subject;
private Resourcepart nickname; private Resourcepart nickname;
private boolean joined = false; private boolean joined = false;
private PacketCollector messageCollector; private StanzaCollector messageCollector;
MultiUserChat(XMPPConnection connection, EntityBareJid room, MultiUserChatManager multiUserChatManager) { MultiUserChat(XMPPConnection connection, EntityBareJid room, MultiUserChatManager multiUserChatManager) {
this.connection = connection; this.connection = connection;
@ -155,7 +155,7 @@ public class MultiUserChat {
messageListener = new StanzaListener() { messageListener = new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
Message message = (Message) packet; Message message = (Message) packet;
for (MessageListener listener : messageListeners) { for (MessageListener listener : messageListeners) {
listener.processMessage(message); listener.processMessage(message);
@ -165,7 +165,7 @@ public class MultiUserChat {
// Create a listener for subject updates. // Create a listener for subject updates.
subjectListener = new StanzaListener() { subjectListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message msg = (Message) packet; Message msg = (Message) packet;
EntityFullJid from = msg.getFrom().asEntityFullJidIfPossible(); EntityFullJid from = msg.getFrom().asEntityFullJidIfPossible();
if (from == null) { if (from == null) {
@ -183,7 +183,7 @@ public class MultiUserChat {
// Create a listener for all presence updates. // Create a listener for all presence updates.
presenceListener = new StanzaListener() { presenceListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Presence presence = (Presence) packet; Presence presence = (Presence) packet;
final EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible(); final EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible();
if (from == null) { if (from == null) {
@ -253,7 +253,7 @@ public class MultiUserChat {
// Listens for all messages that include a MUCUser extension and fire the invitation // Listens for all messages that include a MUCUser extension and fire the invitation
// rejection listeners if the message includes an invitation rejection. // rejection listeners if the message includes an invitation rejection.
declinesListener = new StanzaListener() { declinesListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message message = (Message) packet; Message message = (Message) packet;
// Get the MUC User extension // Get the MUC User extension
MUCUser mucUser = MUCUser.from(packet); MUCUser mucUser = MUCUser.from(packet);
@ -269,7 +269,7 @@ public class MultiUserChat {
presenceInterceptor = new StanzaListener() { presenceInterceptor = new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Presence presence = (Presence) packet; Presence presence = (Presence) packet;
for (PresenceListener interceptor : presenceInterceptors) { for (PresenceListener interceptor : presenceInterceptors) {
interceptor.processPresence(presence); interceptor.processPresence(presence);
@ -323,7 +323,7 @@ public class MultiUserChat {
connection.addSyncStanzaListener(declinesListener, DECLINE_FILTER); connection.addSyncStanzaListener(declinesListener, DECLINE_FILTER);
connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room), connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room),
StanzaTypeFilter.PRESENCE)); StanzaTypeFilter.PRESENCE));
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter); messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
// Wait for a presence packet back from the server. // Wait for a presence packet back from the server.
// Use a bare JID filter, since the room may rewrite the nickname. // 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.class), MUCUserStatusCodeFilter.STATUS_110_PRESENCE_TO_SELF);
Presence presence; Presence presence;
try { try {
presence = connection.createPacketCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(conf.getTimeout()); presence = connection.createStanzaCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(conf.getTimeout());
} }
catch (InterruptedException | NoResponseException | XMPPErrorException e) { catch (InterruptedException | NoResponseException | XMPPErrorException e) {
// Ensure that all callbacks are removed if there is an exception // Ensure that all callbacks are removed if there is an exception
@ -758,7 +758,7 @@ public class MultiUserChat {
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.get); iq.setType(IQ.Type.get);
IQ answer = connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); IQ answer = connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
return Form.getFormFrom(answer); return Form.getFormFrom(answer);
} }
@ -778,7 +778,7 @@ public class MultiUserChat {
iq.setType(IQ.Type.set); iq.setType(IQ.Type.set);
iq.addExtension(form.getDataFormToSend()); 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.setType(IQ.Type.get);
reg.setTo(room); reg.setTo(room);
IQ result = connection.createPacketCollectorAndSend(reg).nextResultOrThrow(); IQ result = connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
return Form.getFormFrom(result); return Form.getFormFrom(result);
} }
@ -830,7 +830,7 @@ public class MultiUserChat {
reg.setTo(room); reg.setTo(room);
reg.addExtension(form.getDataFormToSend()); 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); Destroy destroy = new Destroy(alternateJID, reason);
iq.setDestroy(destroy); iq.setDestroy(destroy);
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
// Reset occupant information. // Reset occupant information.
occupantsMap.clear(); occupantsMap.clear();
@ -1082,7 +1082,7 @@ public class MultiUserChat {
new AndFilter( new AndFilter(
FromMatchesFilter.createFull(jid), FromMatchesFilter.createFull(jid),
new StanzaTypeFilter(Presence.class)); 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 // Wait up to a certain number of seconds for a reply. If there is a negative reply, an
// exception will be thrown // exception will be thrown
response.nextResultOrThrow(); response.nextResultOrThrow();
@ -1563,7 +1563,7 @@ public class MultiUserChat {
MUCItem item = new MUCItem(affiliation, jid, reason); MUCItem item = new MUCItem(affiliation, jid, reason);
iq.addItem(item); iq.addItem(item);
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} }
private void changeAffiliationByAdmin(Collection<? extends Jid> jids, MUCAffiliation affiliation) private void changeAffiliationByAdmin(Collection<? extends Jid> jids, MUCAffiliation affiliation)
@ -1577,7 +1577,7 @@ public class MultiUserChat {
iq.addItem(item); 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 { 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); MUCItem item = new MUCItem(role, nickname, reason);
iq.addItem(item); iq.addItem(item);
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} }
private void changeRole(Collection<Resourcepart> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { private void changeRole(Collection<Resourcepart> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
@ -1601,7 +1601,7 @@ public class MultiUserChat {
iq.addItem(item); iq.addItem(item);
} }
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} }
/** /**
@ -1759,7 +1759,7 @@ public class MultiUserChat {
MUCItem item = new MUCItem(affiliation); MUCItem item = new MUCItem(affiliation);
iq.addItem(item); 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 // Get the list of affiliates from the server's answer
List<Affiliate> affiliates = new ArrayList<Affiliate>(); List<Affiliate> affiliates = new ArrayList<Affiliate>();
@ -1814,7 +1814,7 @@ public class MultiUserChat {
MUCItem item = new MUCItem(role); MUCItem item = new MUCItem(role);
iq.addItem(item); 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 // Get the list of participants from the server's answer
List<Occupant> participants = new ArrayList<Occupant>(); List<Occupant> participants = new ArrayList<Occupant>();
for (MUCItem mucadminItem : answer.getItems()) { for (MUCItem mucadminItem : answer.getItems()) {
@ -1975,13 +1975,13 @@ public class MultiUserChat {
return subject.equals(msg.getSubject()); 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. // Wait up to a certain number of seconds for a reply.
response.nextResultOrThrow(); 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. * connection.
*/ */
private void removeConnectionCallbacks() { private void removeConnectionCallbacks() {

View file

@ -150,7 +150,7 @@ public final class MultiUserChatManager extends Manager {
// Listens for all messages that include a MUCUser extension and fire the invitation // Listens for all messages that include a MUCUser extension and fire the invitation
// listeners if the message includes an invitation. // listeners if the message includes an invitation.
StanzaListener invitationPacketListener = new StanzaListener() { StanzaListener invitationPacketListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
final Message message = (Message) packet; final Message message = (Message) packet;
// Get the MUCUser extension // Get the MUCUser extension
final MUCUser mucUser = MUCUser.from(message); final MUCUser mucUser = MUCUser.from(message);

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.offline; 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.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
@ -158,9 +158,9 @@ public class OfflineMessageManager {
return nodes.contains(info.getNode()); return nodes.contains(info.getNode());
} }
}); });
PacketCollector messageCollector = connection.createPacketCollector(messageFilter); StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter);
try { try {
connection.createPacketCollectorAndSend(request).nextResultOrThrow(); connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
// Collect the received offline messages // Collect the received offline messages
Message message = messageCollector.nextResult(); Message message = messageCollector.nextResult();
while (message != null) { while (message != null) {
@ -191,9 +191,9 @@ public class OfflineMessageManager {
OfflineMessageRequest request = new OfflineMessageRequest(); OfflineMessageRequest request = new OfflineMessageRequest();
request.setFetch(true); request.setFetch(true);
PacketCollector resultCollector = connection.createPacketCollectorAndSend(request); StanzaCollector resultCollector = connection.createStanzaCollectorAndSend(request);
PacketCollector.Configuration messageCollectorConfiguration = PacketCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector); StanzaCollector.Configuration messageCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector);
PacketCollector messageCollector = connection.createPacketCollector(messageCollectorConfiguration); StanzaCollector messageCollector = connection.createStanzaCollector(messageCollectorConfiguration);
List<Message> messages = null; List<Message> messages = null;
try { try {
@ -235,7 +235,7 @@ public class OfflineMessageManager {
item.setAction("remove"); item.setAction("remove");
request.addItem(item); request.addItem(item);
} }
connection.createPacketCollectorAndSend(request).nextResultOrThrow(); connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
} }
/** /**
@ -251,6 +251,6 @@ public class OfflineMessageManager {
OfflineMessageRequest request = new OfflineMessageRequest(); OfflineMessageRequest request = new OfflineMessageRequest();
request.setType(IQ.Type.set); request.setType(IQ.Type.set);
request.setPurge(true); request.setPurge(true);
connection.createPacketCollectorAndSend(request).nextResultOrThrow(); connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
} }
} }

View file

@ -91,7 +91,7 @@ public final class PEPManager extends Manager {
private PEPManager(XMPPConnection connection) { private PEPManager(XMPPConnection connection) {
super(connection); super(connection);
StanzaListener packetListener = new StanzaListener() { StanzaListener packetListener = new StanzaListener() {
public void processPacket(Stanza stanza) { public void processStanza(Stanza stanza) {
Message message = (Message) stanza; Message message = (Message) stanza;
EventElement event = EventElement.from(stanza); EventElement event = EventElement.from(stanza);
assert(event != null); assert(event != null);

View file

@ -167,7 +167,7 @@ public final class PingManager extends Manager {
} }
Ping ping = new Ping(jid); Ping ping = new Ping(jid);
try { try {
connection.createPacketCollectorAndSend(ping).nextResultOrThrow(pingTimeout); connection.createStanzaCollectorAndSend(ping).nextResultOrThrow(pingTimeout);
} }
catch (XMPPException exc) { catch (XMPPException exc) {
return jid.equals(connection.getXMPPServiceDomain()); return jid.equals(connection.getXMPPServiceDomain());

View file

@ -126,7 +126,7 @@ public final class PrivacyListManager extends Manager {
// cached(Active|Default)ListName handling // cached(Active|Default)ListName handling
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
XMPPConnection connection = connection(); XMPPConnection connection = connection();
Privacy privacy = (Privacy) packet; Privacy privacy = (Privacy) packet;
StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
@ -134,7 +134,7 @@ public final class PrivacyListManager extends Manager {
final boolean declinceActiveList = privacy.isDeclineActiveList(); final boolean declinceActiveList = privacy.isDeclineActiveList();
connection.addOneTimeSyncCallback(new StanzaListener() { connection.addOneTimeSyncCallback(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
if (declinceActiveList) { if (declinceActiveList) {
cachedActiveListName = null; cachedActiveListName = null;
} }
@ -148,7 +148,7 @@ public final class PrivacyListManager extends Manager {
}, SetActiveListFilter.INSTANCE); }, SetActiveListFilter.INSTANCE);
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
XMPPConnection connection = connection(); XMPPConnection connection = connection();
Privacy privacy = (Privacy) packet; Privacy privacy = (Privacy) packet;
StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
@ -156,7 +156,7 @@ public final class PrivacyListManager extends Manager {
final boolean declinceDefaultList = privacy.isDeclineDefaultList(); final boolean declinceDefaultList = privacy.isDeclineDefaultList();
connection.addOneTimeSyncCallback(new StanzaListener() { connection.addOneTimeSyncCallback(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
if (declinceDefaultList) { if (declinceDefaultList) {
cachedDefaultListName = null; cachedDefaultListName = null;
} }
@ -170,7 +170,7 @@ public final class PrivacyListManager extends Manager {
}, SetDefaultListFilter.INSTANCE); }, SetDefaultListFilter.INSTANCE);
connection.addSyncStanzaListener(new StanzaListener() { connection.addSyncStanzaListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
Privacy privacy = (Privacy) packet; Privacy privacy = (Privacy) packet;
// If a privacy IQ result stanza has an active or default list name set, then we use that // If a privacy IQ result stanza has an active or default list name set, then we use that
// as cached list name. // as cached list name.
@ -231,7 +231,7 @@ public final class PrivacyListManager extends Manager {
// The request is a get iq type // The request is a get iq type
requestPrivacy.setType(Privacy.Type.get); 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 // The request is a get iq type
requestPrivacy.setType(Privacy.Type.set); requestPrivacy.setType(Privacy.Type.set);
return connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow(); return connection().createStanzaCollectorAndSend(requestPrivacy).nextResultOrThrow();
} }
/** /**

View file

@ -58,7 +58,7 @@ public class LeafNode extends Node
DiscoverItems items = new DiscoverItems(); DiscoverItems items = new DiscoverItems();
items.setTo(pubSubManager.getServiceJid()); items.setTo(pubSubManager.getServiceJid());
items.setNode(getId()); 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, private <T extends Item> List<T> getItems(PubSub request,
List<ExtensionElement> returnedExtensions) throws NoResponseException, List<ExtensionElement> returnedExtensions) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException { XMPPErrorException, NotConnectedException, InterruptedException {
PubSub result = pubSubManager.getConnection().createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
if (returnedExtensions != null) { if (returnedExtensions != null) {
returnedExtensions.addAll(result.getExtensions()); returnedExtensions.addAll(result.getExtensions());
@ -289,7 +289,7 @@ public class LeafNode extends Node
{ {
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId())); 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)); 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()); 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)); items.add(new Item(id));
} }
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items)); PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createPacketCollectorAndSend(request).nextResultOrThrow(); pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} }
} }

View file

@ -105,7 +105,7 @@ abstract public class Node
{ {
PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER, PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
getId(), submitForm), PubSubNamespace.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(); DiscoverInfo info = new DiscoverInfo();
info.setTo(pubSubManager.getServiceJid()); info.setTo(pubSubManager.getServiceJid());
info.setNode(getId()); 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" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public void processPacket(Stanza packet) public void processStanza(Stanza packet)
{ {
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
@ -635,7 +635,7 @@ abstract public class Node
listener = eventListener; listener = eventListener;
} }
public void processPacket(Stanza packet) public void processStanza(Stanza packet)
{ {
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
@ -680,7 +680,7 @@ abstract public class Node
listener = eventListener; listener = eventListener;
} }
public void processPacket(Stanza packet) public void processStanza(Stanza packet)
{ {
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());

View file

@ -234,7 +234,7 @@ public final class PubSubManager extends Manager {
info.setTo(pubSubService); info.setTo(pubSubService);
info.setNode(id); info.setNode(id);
DiscoverInfo infoReply = connection().createPacketCollectorAndSend(info).nextResultOrThrow(); DiscoverInfo infoReply = connection().createStanzaCollectorAndSend(info).nextResultOrThrow();
if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) { if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) {
node = new LeafNode(this, id); node = new LeafNode(this, id);
@ -283,7 +283,7 @@ public final class PubSubManager extends Manager {
if (nodeId != null) if (nodeId != null)
items.setNode(nodeId); items.setNode(nodeId);
items.setTo(pubSubService); items.setTo(pubSubService);
DiscoverItems nodeItems = connection().createPacketCollectorAndSend(items).nextResultOrThrow(); DiscoverItems nodeItems = connection().createStanzaCollectorAndSend(items).nextResultOrThrow();
return nodeItems; return nodeItems;
} }
@ -434,7 +434,7 @@ public final class PubSubManager extends Manager {
PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException, PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException { NotConnectedException, InterruptedException {
IQ resultIQ = connection().createPacketCollectorAndSend(packet).nextResultOrThrow(); IQ resultIQ = connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
if (resultIQ instanceof EmptyResultIQ) { if (resultIQ instanceof EmptyResultIQ) {
return null; return null;
} }

View file

@ -136,7 +136,7 @@ public final class DeliveryReceiptManager extends Manager {
// Add the packet listener to handling incoming delivery receipts // Add the packet listener to handling incoming delivery receipts
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
DeliveryReceipt dr = DeliveryReceipt.from((Message) packet); DeliveryReceipt dr = DeliveryReceipt.from((Message) packet);
// notify listeners of incoming receipt // notify listeners of incoming receipt
for (ReceiptReceivedListener l : receiptReceivedListeners) { for (ReceiptReceivedListener l : receiptReceivedListeners) {
@ -148,7 +148,7 @@ public final class DeliveryReceiptManager extends Manager {
// Add the packet listener to handle incoming delivery receipt requests // Add the packet listener to handle incoming delivery receipt requests
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException { public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
final Jid from = packet.getFrom(); final Jid from = packet.getFrom();
final XMPPConnection connection = connection(); final XMPPConnection connection = connection();
switch (autoReceiptMode) { switch (autoReceiptMode) {
@ -261,7 +261,7 @@ public final class DeliveryReceiptManager extends Manager {
private static final StanzaListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new StanzaListener() { private static final StanzaListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new StanzaListener() {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processStanza(Stanza packet) throws NotConnectedException {
Message message = (Message) packet; Message message = (Message) packet;
DeliveryReceiptRequest.addTo(message); DeliveryReceiptRequest.addTo(message);
} }

View file

@ -68,7 +68,7 @@ public class UserSearch extends SimpleIQ {
search.setType(IQ.Type.get); search.setType(IQ.Type.get);
search.setTo(searchService); search.setTo(searchService);
IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow(); IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return Form.getFormFrom(response); return Form.getFormFrom(response);
} }
@ -90,7 +90,7 @@ public class UserSearch extends SimpleIQ {
search.setTo(searchService); search.setTo(searchService);
search.addExtension(searchForm.getDataFormToSend()); search.addExtension(searchForm.getDataFormToSend());
IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow(); IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return ReportedData.getReportedDataFrom(response); return ReportedData.getReportedDataFrom(response);
} }
@ -112,7 +112,7 @@ public class UserSearch extends SimpleIQ {
search.setType(IQ.Type.set); search.setType(IQ.Type.set);
search.setTo(searchService); search.setTo(searchService);
SimpleUserSearch response = (SimpleUserSearch) con.createPacketCollectorAndSend(search).nextResultOrThrow(); SimpleUserSearch response = (SimpleUserSearch) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return response.getReportedData(); return response.getReportedData();
} }

View file

@ -51,7 +51,7 @@ public class SharedGroupManager {
SharedGroupsInfo info = new SharedGroupsInfo(); SharedGroupsInfo info = new SharedGroupsInfo();
info.setType(IQ.Type.get); info.setType(IQ.Type.get);
SharedGroupsInfo result = (SharedGroupsInfo) connection.createPacketCollectorAndSend(info).nextResultOrThrow(); SharedGroupsInfo result = (SharedGroupsInfo) connection.createStanzaCollectorAndSend(info).nextResultOrThrow();
return result.getGroups(); return result.getGroups();
} }
} }

View file

@ -110,7 +110,7 @@ public final class EntityTimeManager extends Manager {
Time request = new Time(); Time request = new Time();
// TODO Add Time(Jid) constructor and use this constructor instead // TODO Add Time(Jid) constructor and use this constructor instead
request.setTo(jid); request.setTo(jid);
Time response = (Time) connection().createPacketCollectorAndSend(request).nextResultOrThrow(); Time response = (Time) connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
} }

View file

@ -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 // 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) // want to use the same stanza id again (although it wouldn't break if we did)
vcard.setStanzaId(StanzaIdUtil.newStanzaId()); 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 { public VCard loadVCard(EntityBareJid bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
VCard vcardRequest = new VCard(); VCard vcardRequest = new VCard();
vcardRequest.setTo(bareJid); vcardRequest.setTo(bareJid);
VCard result = connection().createPacketCollectorAndSend(vcardRequest).nextResultOrThrow(); VCard result = connection().createStanzaCollectorAndSend(vcardRequest).nextResultOrThrow();
return result; return result;
} }

View file

@ -274,7 +274,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
dataMessage.addExtension(dpe); dataMessage.addExtension(dpe);
// add data packets // add data packets
listener.processPacket(dataMessage); listener.processStanza(dataMessage);
// read until exception is thrown // read until exception is thrown
try { try {
@ -313,7 +313,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
Message dataMessage = new Message(); Message dataMessage = new Message();
dataMessage.addExtension(dpe); dataMessage.addExtension(dpe);
listener.processPacket(dataMessage); listener.processStanza(dataMessage);
} }
byte[] bytes = new byte[3 * blockSize]; byte[] bytes = new byte[3 * blockSize];
@ -358,7 +358,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
Message dataMessage = new Message(); Message dataMessage = new Message();
dataMessage.addExtension(dpe); dataMessage.addExtension(dpe);
listener.processPacket(dataMessage); listener.processStanza(dataMessage);
} }
// read data // read data

View file

@ -316,7 +316,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
String base64Data = Base64.encode("Data"); String base64Data = Base64.encode("Data");
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
Data data = new Data(dpe); Data data = new Data(dpe);
listener.processPacket(data); listener.processStanza(data);
// verify no packet send // verify no packet send
protocol.verifyAll(); protocol.verifyAll();
@ -352,7 +352,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
Data data = new Data(dpe); Data data = new Data(dpe);
listener.processPacket(data); listener.processStanza(data);
protocol.verifyAll(); protocol.verifyAll();
@ -392,8 +392,8 @@ public class InBandBytestreamSessionTest extends InitExtensions {
Data data2 = new Data(dpe); Data data2 = new Data(dpe);
// notify listener // notify listener
listener.processPacket(data1); listener.processStanza(data1);
listener.processPacket(data2); listener.processStanza(data2);
protocol.verifyAll(); protocol.verifyAll();
@ -428,7 +428,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
Data data = new Data(dpe); Data data = new Data(dpe);
// notify listener // notify listener
listener.processPacket(data); listener.processStanza(data);
protocol.verifyAll(); protocol.verifyAll();
@ -463,7 +463,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
Data data = new Data(dpe); Data data = new Data(dpe);
// add data packets // add data packets
listener.processPacket(data); listener.processStanza(data);
// read until exception is thrown // read until exception is thrown
try { try {
@ -504,7 +504,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize); String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize);
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
Data data = new Data(dpe); Data data = new Data(dpe);
listener.processPacket(data); listener.processStanza(data);
} }
byte[] bytes = new byte[3 * blockSize]; byte[] bytes = new byte[3 * blockSize];
@ -551,7 +551,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize); String base64Data = Base64.encodeToString(controlData, i * blockSize, blockSize);
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data); DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
Data data = new Data(dpe); Data data = new Data(dpe);
listener.processPacket(data); listener.processStanza(data);
} }
// read data // read data
@ -592,7 +592,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
Data data = new Data(dpe); Data data = new Data(dpe);
// add data packets // add data packets
listener.processPacket(data); listener.processStanza(data);
inputStream.close(); inputStream.close();
@ -635,7 +635,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
Data data = new Data(dpe); Data data = new Data(dpe);
// add data packets // add data packets
listener.processPacket(data); listener.processStanza(data);
Thread closer = new Thread(new Runnable() { Thread closer = new Thread(new Runnable() {

View file

@ -23,7 +23,7 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; 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.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
@ -49,11 +49,11 @@ public class ConnectionUtils {
* form the protocol instance. * form the protocol instance.
* <p> * <p>
* This mocked connection can used to collect packets that require a reply using a * This mocked connection can used to collect packets that require a reply using a
* PacketCollector. * StanzaCollector.
* *
* <pre> * <pre>
* <code> * <code>
* PacketCollector collector = connection.createPacketCollector(new PacketFilter()); * StanzaCollector collector = connection.createStanzaCollector(new PacketFilter());
* connection.sendStanza(packet); * connection.sendStanza(packet);
* Stanza(/Packet) reply = collector.nextResult(); * Stanza(/Packet) reply = collector.nextResult();
* </code> * </code>
@ -76,19 +76,19 @@ public class ConnectionUtils {
when(connection.getXMPPServiceDomain()).thenReturn(xmppServer); when(connection.getXMPPServiceDomain()).thenReturn(xmppServer);
// mock packet collector // mock packet collector
final PacketCollector collector = mock(PacketCollector.class); final StanzaCollector collector = mock(StanzaCollector.class);
when(connection.createPacketCollector(isA(StanzaFilter.class))).thenReturn( when(connection.createStanzaCollector(isA(StanzaFilter.class))).thenReturn(
collector); collector);
Answer<PacketCollector> collectorAndSend = new Answer<PacketCollector>() { Answer<StanzaCollector> collectorAndSend = new Answer<StanzaCollector>() {
@Override @Override
public PacketCollector answer(InvocationOnMock invocation) throws Throwable { public StanzaCollector answer(InvocationOnMock invocation) throws Throwable {
Stanza packet = (Stanza) invocation.getArguments()[0]; Stanza packet = (Stanza) invocation.getArguments()[0];
protocol.getRequests().add(packet); protocol.getRequests().add(packet);
return collector; return collector;
} }
}; };
when(connection.createPacketCollectorAndSend(isA(IQ.class))).thenAnswer(collectorAndSend); when(connection.createStanzaCollectorAndSend(isA(IQ.class))).thenAnswer(collectorAndSend);
// mock send method // mock send method
Answer<Object> addIncoming = new Answer<Object>() { Answer<Object> addIncoming = new Answer<Object>() {

View file

@ -51,7 +51,7 @@ import org.jivesoftware.smack.packet.Stanza;
* <code> * <code>
* public void methodToTest() { * public void methodToTest() {
* Stanza(/Packet) stanza(/packet) = new Packet(); // create an XMPP packet * 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); * connection.sendStanza(packet);
* Stanza(/Packet) reply = collector.nextResult(); * Stanza(/Packet) reply = collector.nextResult();
* } * }

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smack.chat; 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.SmackException.NotConnectedException;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils; 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 * Creates a {@link org.jivesoftware.smack.StanzaCollector} which will accumulate the Messages
* for this chat. Always cancel PacketCollectors when finished with them as they will accumulate * for this chat. Always cancel StanzaCollectors when finished with them as they will accumulate
* messages indefinitely. * messages indefinitely.
* *
* @return the PacketCollector which returns Messages for this chat. * @return the StanzaCollector which returns Messages for this chat.
*/ */
public PacketCollector createCollector() { public StanzaCollector createCollector() {
return chatManager.createPacketCollector(this); return chatManager.createStanzaCollector(this);
} }
/** /**

View file

@ -28,7 +28,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.StanzaListener; import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.SmackException.NotConnectedException; 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 // Add a listener for all message packets so that we can deliver
// messages to the best Chat instance available. // messages to the best Chat instance available.
connection.addSyncStanzaListener(new StanzaListener() { connection.addSyncStanzaListener(new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message message = (Message) packet; Message message = (Message) packet;
Chat chat; Chat chat;
if (message.getThread() == null) { if (message.getThread() == null) {
@ -378,8 +378,8 @@ public final class ChatManager extends Manager{
connection().sendStanza(message); connection().sendStanza(message);
} }
PacketCollector createPacketCollector(Chat chat) { StanzaCollector createStanzaCollector(Chat chat) {
return connection().createPacketCollector(new AndFilter(new ThreadFilter(chat.getThreadID()), return connection().createStanzaCollector(new AndFilter(new ThreadFilter(chat.getThreadID()),
FromMatchesFilter.create(chat.getParticipant()))); FromMatchesFilter.create(chat.getParticipant())));
} }

View file

@ -244,7 +244,7 @@ public final class Roster extends Manager {
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza stanza) throws NotConnectedException, public void processStanza(Stanza stanza) throws NotConnectedException,
InterruptedException { InterruptedException {
Presence presence = (Presence) stanza; Presence presence = (Presence) stanza;
Jid from = presence.getFrom(); Jid from = presence.getFrom();
@ -318,7 +318,7 @@ public final class Roster extends Manager {
connection.addPacketSendingListener(new StanzaListener() { connection.addPacketSendingListener(new StanzaListener() {
@Override @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 // 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 // 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 // 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); rosterPacket.addRosterItem(item);
connection.createPacketCollectorAndSend(rosterPacket).nextResultOrThrow(); connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
sendSubscriptionRequest(user); 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 // Set the item type as REMOVE so that the server will delete the entry
item.setItemType(RosterPacket.ItemType.remove); item.setItemType(RosterPacket.ItemType.remove);
packet.addRosterItem(item); 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)); packetUnavailable.setFrom(JidCreate.fullFrom(bareUserJid, resource));
try { try {
presencePacketListener.processPacket(packetUnavailable); presencePacketListener.processStanza(packetUnavailable);
} }
catch (NotConnectedException e) { catch (NotConnectedException e) {
throw new IllegalStateException( 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); e);
} }
catch (InterruptedException e) { catch (InterruptedException e) {
@ -1422,7 +1422,7 @@ public final class Roster extends Manager {
private class PresencePacketListener implements StanzaListener { private class PresencePacketListener implements StanzaListener {
@Override @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 // 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 // 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. // 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 { private class RosterResultListener implements StanzaListener {
@Override @Override
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
final XMPPConnection connection = connection(); final XMPPConnection connection = connection();
LOGGER.fine("RosterResultListener received stanza"); LOGGER.fine("RosterResultListener received stanza");
Collection<Jid> addedEntries = new ArrayList<>(); Collection<Jid> addedEntries = new ArrayList<>();

View file

@ -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 // 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. // RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
packet.addRosterItem(toRosterItem(this, name)); 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 // We have received a result response to the IQ set, the name was successfully changed
item.setName(name); item.setName(name);

View file

@ -84,7 +84,7 @@ public class RosterGroup extends Manager {
item.removeGroupName(this.name); item.removeGroupName(this.name);
item.addGroupName(name); item.addGroupName(name);
packet.addRosterItem(item); packet.addRosterItem(item);
connection().createPacketCollectorAndSend(packet).nextResultOrThrow(); connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
} }
} }
} }
@ -179,7 +179,7 @@ public class RosterGroup extends Manager {
item.addGroupName(getName()); item.addGroupName(getName());
packet.addRosterItem(item); packet.addRosterItem(item);
// Wait up to a certain number of seconds for a reply from the server. // 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()); item.removeGroupName(this.getName());
packet.addRosterItem(item); packet.addRosterItem(item);
// Wait up to a certain number of seconds for a reply from the server. // Wait up to a certain number of seconds for a reply from the server.
connection().createPacketCollectorAndSend(packet).nextResultOrThrow(); connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
} }
} }
} }

View file

@ -20,7 +20,7 @@ import java.util.Random;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Logger; 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.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
@ -44,9 +44,9 @@ public abstract class AbstractSmackIntTest {
protected void performActionAndWaitUntilStanzaReceived(Runnable action, XMPPConnection connection, StanzaFilter filter) protected void performActionAndWaitUntilStanzaReceived(Runnable action, XMPPConnection connection, StanzaFilter filter)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setStanzaFilter( StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration().setStanzaFilter(
filter).setSize(1); filter).setSize(1);
PacketCollector collector = connection.createPacketCollector(configuration); StanzaCollector collector = connection.createStanzaCollector(configuration);
try { try {
action.run(); action.run();

View file

@ -67,7 +67,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
@SmackIntegrationTest @SmackIntegrationTest
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception { public void testProperties() throws XmppStringprepException, NotConnectedException, Exception {
Chat newChat = chatManagerOne.createChat(conTwo.getUser()); 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(); Message msg = new Message();

View file

@ -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 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 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, MessageWithBodiesFilter.INSTANCE,
FromMatchesFilter.createFull(conOne.getUser()))); FromMatchesFilter.createFull(conOne.getUser())));
@ -84,7 +84,7 @@ public class StreamManagementTest extends AbstractSmackLowLevelIntegrationTest {
from.sendStanza(message); 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(); Message message = collector.nextResult();
assertNotNull(message); assertNotNull(message);
assertEquals(body, message.getBody()); assertEquals(body, message.getBody());

View file

@ -134,7 +134,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
conOne.addPacketSendingListener(new StanzaListener() { conOne.addPacketSendingListener(new StanzaListener() {
@Override @Override
public void processPacket(Stanza stanza) { public void processStanza(Stanza stanza) {
discoInfoSend = true; discoInfoSend = true;
} }

View file

@ -160,7 +160,7 @@ public class JingleManagerTest extends SmackTestCase {
// Start a packet listener for session initiation requests // Start a packet listener for session initiation requests
getConnection(0).addAsyncPacketListener(new PacketListener() { getConnection(0).addAsyncPacketListener(new PacketListener() {
public void processPacket(final Packet packet) { public void processStanza(final Packet packet) {
System.out.println("Packet detected... "); System.out.println("Packet detected... ");
incCounter(); incCounter();
} }

View file

@ -14,7 +14,7 @@
*/ */
package org.jivesoftware.smackx.jingle.provider; 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.SmackConfiguration;
import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.filter.StanzaTypeFilter;
@ -70,7 +70,7 @@ public class JingleProviderTest extends SmackTestCase {
// Create a filter and a collector... // Create a filter and a collector...
PacketFilter filter = new StanzaTypeFilter(IQ.class); 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..."); System.out.println("Testing if a Jingle IQ can be sent and received...");

View file

@ -467,7 +467,7 @@ public class JingleManager implements JingleSessionListener {
// Start a packet listener for session initiation requests // Start a packet listener for session initiation requests
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
triggerSessionRequested((Jingle) packet); triggerSessionRequested((Jingle) packet);
} }
}, initRequestFilter); }, initRequestFilter);

View file

@ -678,7 +678,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
LOGGER.fine("UpdatePacketListener"); LOGGER.fine("UpdatePacketListener");
packetListener = new StanzaListener() { packetListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
try { try {
receivePacketAndRespond((IQ) packet); receivePacketAndRespond((IQ) packet);
} catch (Exception e) { } catch (Exception e) {

View file

@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; 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.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
@ -402,7 +402,7 @@ public class RTPBridge extends IQ {
RTPBridge rtpPacket = new RTPBridge(sessionID); RTPBridge rtpPacket = new RTPBridge(sessionID);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain()); rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
PacketCollector collector = connection.createPacketCollectorAndSend(rtpPacket); StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult(); RTPBridge response = collector.nextResult();
@ -479,7 +479,7 @@ public class RTPBridge extends IQ {
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
PacketCollector collector = connection.createPacketCollectorAndSend(rtpPacket); StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult(); RTPBridge response = collector.nextResult();
@ -510,7 +510,7 @@ public class RTPBridge extends IQ {
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
PacketCollector collector = xmppConnection.createPacketCollectorAndSend(rtpPacket); StanzaCollector collector = xmppConnection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult(); RTPBridge response = collector.nextResult();

View file

@ -24,7 +24,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.SimpleIQ; import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
@ -185,7 +185,7 @@ public class STUN extends SimpleIQ {
STUN stunPacket = new STUN(); STUN stunPacket = new STUN();
stunPacket.setTo(DOMAIN + "." + connection.getXMPPServiceDomain()); stunPacket.setTo(DOMAIN + "." + connection.getXMPPServiceDomain());
PacketCollector collector = connection.createPacketCollectorAndSend(stunPacket); StanzaCollector collector = connection.createStanzaCollectorAndSend(stunPacket);
STUN response = collector.nextResult(); STUN response = collector.nextResult();

View file

@ -40,7 +40,7 @@ public class Agent {
public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AgentWorkgroups request = new AgentWorkgroups(agentJID); AgentWorkgroups request = new AgentWorkgroups(agentJID);
request.setTo(serviceJID); request.setTo(serviceJID);
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); AgentWorkgroups response = (AgentWorkgroups) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.getWorkgroups(); return response.getWorkgroups();
} }
@ -75,7 +75,7 @@ public class Agent {
agentInfo.setType(IQ.Type.get); agentInfo.setType(IQ.Type.get);
agentInfo.setTo(workgroupJID); agentInfo.setTo(workgroupJID);
agentInfo.setFrom(getUser()); agentInfo.setFrom(getUser());
AgentInfo response = (AgentInfo) connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow(); AgentInfo response = (AgentInfo) connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
return response.getName(); return response.getName();
} }
@ -97,6 +97,6 @@ public class Agent {
agentInfo.setTo(workgroupJID); agentInfo.setTo(workgroupJID);
agentInfo.setFrom(getUser()); agentInfo.setFrom(getUser());
agentInfo.setName(newName); agentInfo.setName(newName);
connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow(); connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
} }
} }

View file

@ -283,7 +283,7 @@ public class AgentRoster {
* Listens for all presence packets and processes them. * Listens for all presence packets and processes them.
*/ */
private class PresencePacketListener implements StanzaListener { private class PresencePacketListener implements StanzaListener {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Presence presence = (Presence)packet; Presence presence = (Presence)packet;
EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible(); EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible();
if (from == null) { if (from == null) {
@ -359,7 +359,7 @@ public class AgentRoster {
*/ */
private class AgentStatusListener implements StanzaListener { private class AgentStatusListener implements StanzaListener {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
if (packet instanceof AgentStatusRequest) { if (packet instanceof AgentStatusRequest) {
AgentStatusRequest statusRequest = (AgentStatusRequest)packet; AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) { for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) {

View file

@ -29,7 +29,7 @@ import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.StanzaListener; import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
@ -147,7 +147,7 @@ public class AgentSession {
new StanzaTypeFilter(Message.class)); new StanzaTypeFilter(Message.class));
packetListener = new StanzaListener() { packetListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
try { try {
handlePacket(packet); handlePacket(packet);
} }
@ -335,7 +335,7 @@ public class AgentSession {
presence.addExtension(new StandardExtensionElement(AgentStatus.ELEMENT_NAME, presence.addExtension(new StandardExtensionElement(AgentStatus.ELEMENT_NAME,
AgentStatus.NAMESPACE)); AgentStatus.NAMESPACE));
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter( StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence);
presence = (Presence)collector.nextResultOrThrow(); presence = (Presence)collector.nextResultOrThrow();
@ -437,7 +437,7 @@ public class AgentSession {
presence.addExtension(builder.build()); presence.addExtension(builder.build());
presence.addExtension(new MetaData(this.metaData)); presence.addExtension(new MetaData(this.metaData));
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter( StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
new StanzaTypeFilter(Presence.class), new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence); FromMatchesFilter.create(workgroupJID)), presence);
@ -482,7 +482,7 @@ public class AgentSession {
} }
presence.addExtension(new MetaData(this.metaData)); 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); FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow(); collector.nextResultOrThrow();
@ -581,7 +581,7 @@ public class AgentSession {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
OccupantsInfo response = (OccupantsInfo) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); OccupantsInfo response = (OccupantsInfo) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -837,7 +837,7 @@ public class AgentSession {
notes.setTo(workgroupJID); notes.setTo(workgroupJID);
notes.setSessionID(sessionID); notes.setSessionID(sessionID);
notes.setNotes(note); notes.setNotes(note);
connection.createPacketCollectorAndSend(notes).nextResultOrThrow(); connection.createStanzaCollectorAndSend(notes).nextResultOrThrow();
} }
/** /**
@ -856,7 +856,7 @@ public class AgentSession {
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);
ChatNotes response = (ChatNotes) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); ChatNotes response = (ChatNotes) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -882,7 +882,7 @@ public class AgentSession {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
AgentChatHistory response = connection.createPacketCollectorAndSend( AgentChatHistory response = connection.createStanzaCollectorAndSend(
request).nextResult(); request).nextResult();
return response; return response;
@ -902,7 +902,7 @@ public class AgentSession {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
SearchSettings response = (SearchSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); SearchSettings response = (SearchSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -922,7 +922,7 @@ public class AgentSession {
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setPersonal(!global); request.setPersonal(!global);
Macros response = (Macros) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); Macros response = (Macros) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.getRootGroup(); return response.getRootGroup();
} }
@ -942,7 +942,7 @@ public class AgentSession {
request.setPersonal(true); request.setPersonal(true);
request.setPersonalMacroGroup(group); request.setPersonalMacroGroup(group);
connection.createPacketCollectorAndSend(request).nextResultOrThrow(); connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
} }
/** /**
@ -960,7 +960,7 @@ public class AgentSession {
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);
ChatMetadata response = connection.createPacketCollectorAndSend(request).nextResult(); ChatMetadata response = connection.createStanzaCollectorAndSend(request).nextResult();
return response.getMetadata(); return response.getMetadata();
} }
@ -1002,7 +1002,7 @@ public class AgentSession {
iq.setTo(workgroupJID); iq.setTo(workgroupJID);
iq.setFrom(connection.getUser()); iq.setFrom(connection.getUser());
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} }
/** /**
@ -1040,7 +1040,7 @@ public class AgentSession {
iq.setTo(workgroupJID); iq.setTo(workgroupJID);
iq.setFrom(connection.getUser()); 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.setType(IQ.Type.get);
setting.setTo(workgroupJID); setting.setTo(workgroupJID);
GenericSettings response = (GenericSettings) connection.createPacketCollectorAndSend( GenericSettings response = (GenericSettings) connection.createStanzaCollectorAndSend(
setting).nextResultOrThrow(); setting).nextResultOrThrow();
return response; return response;
} }
@ -1069,7 +1069,7 @@ public class AgentSession {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
MonitorPacket response = (MonitorPacket) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); MonitorPacket response = (MonitorPacket) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.isMonitor(); return response.isMonitor();
} }
@ -1079,6 +1079,6 @@ public class AgentSession {
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);
connection.createPacketCollectorAndSend(request).nextResultOrThrow(); connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
} }
} }

View file

@ -53,7 +53,7 @@ public class TranscriptManager {
public Transcript getTranscript(Jid workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public Transcript getTranscript(Jid workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcript request = new Transcript(sessionID); Transcript request = new Transcript(sessionID);
request.setTo(workgroupJID); request.setTo(workgroupJID);
Transcript response = (Transcript) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); Transcript response = (Transcript) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -72,7 +72,7 @@ public class TranscriptManager {
public Transcripts getTranscripts(Jid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public Transcripts getTranscripts(Jid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcripts request = new Transcripts(userID); Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID); request.setTo(workgroupJID);
Transcripts response = (Transcripts) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); Transcripts response = (Transcripts) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
} }

View file

@ -58,7 +58,7 @@ public class TranscriptSearchManager {
search.setType(IQ.Type.get); search.setType(IQ.Type.get);
search.setTo(serviceJID); search.setTo(serviceJID);
TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend( TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
search).nextResultOrThrow(); search).nextResultOrThrow();
return Form.getFormFrom(response); return Form.getFormFrom(response);
} }
@ -82,7 +82,7 @@ public class TranscriptSearchManager {
search.setTo(serviceJID); search.setTo(serviceJID);
search.addExtension(completedForm.getDataFormToSend()); search.addExtension(completedForm.getDataFormToSend());
TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend( TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
search).nextResultOrThrow(); search).nextResultOrThrow();
return ReportedData.getReportedDataFrom(response); return ReportedData.getReportedDataFrom(response);
} }

View file

@ -21,7 +21,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.StanzaCollector;
import org.jivesoftware.smack.StanzaListener; import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
@ -145,7 +145,7 @@ public class Workgroup {
StanzaFilter typeFilter = new StanzaTypeFilter(Message.class); StanzaFilter typeFilter = new StanzaTypeFilter(Message.class);
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
handlePacket(packet); handlePacket(packet);
} }
}, typeFilter); }, typeFilter);
@ -184,7 +184,7 @@ public class Workgroup {
directedPresence.setTo(workgroupJID); directedPresence.setTo(workgroupJID);
StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class); StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class);
StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID); StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID);
PacketCollector collector = connection.createPacketCollectorAndSend(new AndFilter(fromFilter, StanzaCollector collector = connection.createStanzaCollectorAndSend(new AndFilter(fromFilter,
typeFilter), directedPresence); typeFilter), directedPresence);
Presence response = (Presence)collector.nextResultOrThrow(); Presence response = (Presence)collector.nextResultOrThrow();
@ -342,7 +342,7 @@ public class Workgroup {
JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID); JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID);
connection.createPacketCollectorAndSend(joinPacket).nextResultOrThrow(); connection.createStanzaCollectorAndSend(joinPacket).nextResultOrThrow();
// Notify listeners that we've joined the queue. // Notify listeners that we've joined the queue.
fireQueueJoinedEvent(); fireQueueJoinedEvent();
} }
@ -424,7 +424,7 @@ public class Workgroup {
} }
DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID); DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID);
connection.createPacketCollectorAndSend(departPacket).nextResultOrThrow(); connection.createStanzaCollectorAndSend(departPacket).nextResultOrThrow();
// Notify listeners that we're no longer in the queue. // Notify listeners that we're no longer in the queue.
fireQueueDepartedEvent(); fireQueueDepartedEvent();
@ -649,7 +649,7 @@ public class Workgroup {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
ChatSettings response = (ChatSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); ChatSettings response = (ChatSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -689,7 +689,7 @@ public class Workgroup {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
OfflineSettings response = (OfflineSettings) connection.createPacketCollectorAndSend( OfflineSettings response = (OfflineSettings) connection.createStanzaCollectorAndSend(
request).nextResultOrThrow(); request).nextResultOrThrow();
return response; return response;
} }
@ -708,7 +708,7 @@ public class Workgroup {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
SoundSettings response = (SoundSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); SoundSettings response = (SoundSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response; return response;
} }
@ -726,7 +726,7 @@ public class Workgroup {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend( WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
request).nextResultOrThrow(); request).nextResultOrThrow();
return response; return response;
} }
@ -747,7 +747,7 @@ public class Workgroup {
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend( WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
request).nextResultOrThrow(); request).nextResultOrThrow();
return response; return response;
} }
@ -769,7 +769,7 @@ public class Workgroup {
workgroupForm.setType(IQ.Type.get); workgroupForm.setType(IQ.Type.get);
workgroupForm.setTo(workgroupJID); workgroupForm.setTo(workgroupJID);
WorkgroupForm response = (WorkgroupForm) connection.createPacketCollectorAndSend( WorkgroupForm response = (WorkgroupForm) connection.createStanzaCollectorAndSend(
workgroupForm).nextResultOrThrow(); workgroupForm).nextResultOrThrow();
return Form.getFormFrom(response); return Form.getFormFrom(response);
} }

View file

@ -77,7 +77,7 @@ public final class MessageEventManager extends Manager {
super(connection); super(connection);
// Listens for all message event packets and fire the proper message event listeners. // Listens for all message event packets and fire the proper message event listeners.
connection.addAsyncStanzaListener(new StanzaListener() { connection.addAsyncStanzaListener(new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message message = (Message) packet; Message message = (Message) packet;
MessageEvent messageEvent = MessageEvent messageEvent =
(MessageEvent) message.getExtension("x", "jabber:x:event"); (MessageEvent) message.getExtension("x", "jabber:x:event");

View file

@ -78,7 +78,7 @@ public class RosterExchangeManager {
weakRefConnection = new WeakReference<XMPPConnection>(connection); weakRefConnection = new WeakReference<XMPPConnection>(connection);
// Listens for all roster exchange packets and fire the roster exchange listeners. // Listens for all roster exchange packets and fire the roster exchange listeners.
packetListener = new StanzaListener() { packetListener = new StanzaListener() {
public void processPacket(Stanza packet) { public void processStanza(Stanza packet) {
Message message = (Message) packet; Message message = (Message) packet;
RosterExchange rosterExchange = RosterExchange rosterExchange =
(RosterExchange) message.getExtension(ELEMENT, NAMESPACE); (RosterExchange) message.getExtension(ELEMENT, NAMESPACE);

View file

@ -1857,7 +1857,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
for (Stanza ackedStanza : ackedStanzas) { for (Stanza ackedStanza : ackedStanzas) {
for (StanzaListener listener : stanzaAcknowledgedListeners) { for (StanzaListener listener : stanzaAcknowledgedListeners) {
try { try {
listener.processPacket(ackedStanza); listener.processStanza(ackedStanza);
} }
catch (InterruptedException | NotConnectedException e) { catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.FINER, "Received exception", e); LOGGER.log(Level.FINER, "Received exception", e);
@ -1870,7 +1870,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
StanzaListener listener = stanzaIdAcknowledgedListeners.remove(id); StanzaListener listener = stanzaIdAcknowledgedListeners.remove(id);
if (listener != null) { if (listener != null) {
try { try {
listener.processPacket(ackedStanza); listener.processStanza(ackedStanza);
} }
catch (InterruptedException | NotConnectedException e) { catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.FINER, "Received exception", e); LOGGER.log(Level.FINER, "Received exception", e);