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

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

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

View file

@ -59,7 +59,7 @@ public class CompressionTest extends SmackTestCase {
version.setTo(getXMPPServiceDomain());
// Create a packet collector to listen for a response.
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getStanzaId()));
StanzaCollector collector = connection.createStanzaCollector(new PacketIDFilter(version.getStanzaId()));
connection.sendStanza(version);

View file

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

View file

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

View file

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

View file

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

View file

@ -90,7 +90,7 @@ public class XHTMLManagerTest extends SmackTestCase {
public void testSendSimpleXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
final PacketCollector chat2 = getConnection(1).createPacketCollector(
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat1.getThreadID()));
// User1 creates a message to send to user2
@ -150,7 +150,7 @@ public class XHTMLManagerTest extends SmackTestCase {
public void testSendComplexXHTMLMessageAndDisplayReceivedXHTMLMessage() {
// Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
final PacketCollector chat2 = getConnection(1).createPacketCollector(
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat1.getThreadID()));
// User1 creates a message to send to user2

View file

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

View file

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

View file

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

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
PacketFilter packetFilter = new StanzaExtensionFilter("x", "jabber:x:event");
PacketListener packetListener = new PacketListener() {
public void processPacket(Packet packet) {
public void processStanza(Packet packet) {
Message message = (Message) packet;
try {
MessageEvent messageEvent =

View file

@ -71,7 +71,7 @@ public class RosterExchangeTest extends SmackTestCase {
public void testSendAndReceiveRosterEntries() {
// Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
final PacketCollector chat2 = getConnection(1).createPacketCollector(
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat1.getThreadID()));
// Create the message to send with the roster
@ -115,7 +115,7 @@ public class RosterExchangeTest extends SmackTestCase {
public void testSendAndAcceptRosterEntries() {
// Create a chat for each connection
Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
final PacketCollector chat2 = getConnection(1).createPacketCollector(
final StanzaCollector chat2 = getConnection(1).createStanzaCollector(
new ThreadFilter(chat1.getThreadID()));
// Create the message to send with the roster

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

@ -144,7 +144,7 @@ public final class VersionManager extends Manager {
if (!isSupported(jid)) {
return null;
}
return connection().createPacketCollectorAndSend(new Version(jid)).nextResultOrThrow();
return connection().createStanzaCollectorAndSend(new Version(jid)).nextResultOrThrow();
}
private static Version generateVersionFrom(String name, String version, String os) {

View file

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

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
// listeners if the message includes an invitation.
StanzaListener invitationPacketListener = new StanzaListener() {
public void processPacket(Stanza packet) {
public void processStanza(Stanza packet) {
final Message message = (Message) packet;
// Get the MUCUser extension
final MUCUser mucUser = MUCUser.from(message);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -105,7 +105,7 @@ abstract public class Node
{
PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
getId(), submitForm), PubSubNamespace.OWNER);
pubSubManager.getConnection().createPacketCollectorAndSend(packet).nextResultOrThrow();
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
}
/**
@ -122,7 +122,7 @@ abstract public class Node
DiscoverInfo info = new DiscoverInfo();
info.setTo(pubSubManager.getServiceJid());
info.setNode(getId());
return pubSubManager.getConnection().createPacketCollectorAndSend(info).nextResultOrThrow();
return pubSubManager.getConnection().createStanzaCollectorAndSend(info).nextResultOrThrow();
}
/**
@ -609,7 +609,7 @@ abstract public class Node
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void processPacket(Stanza packet)
public void processStanza(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
@ -635,7 +635,7 @@ abstract public class Node
listener = eventListener;
}
public void processPacket(Stanza packet)
public void processStanza(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
@ -680,7 +680,7 @@ abstract public class Node
listener = eventListener;
}
public void processPacket(Stanza packet)
public void processStanza(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

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