mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 05:22:06 +01:00
Rename 'Packet' class to 'Stanza'
Smack still uses the term 'Packet' in some places. This is just the first step towards using correct XMPP terms in Smack.
This commit is contained in:
parent
9fc26f1d83
commit
4698805a34
142 changed files with 595 additions and 572 deletions
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.Element;
|
import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PlainStreamElement;
|
import org.jivesoftware.smack.packet.PlainStreamElement;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Presence.Type;
|
import org.jivesoftware.smack.packet.Presence.Type;
|
||||||
|
@ -256,15 +256,15 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendPacketInternal(Packet packet) throws NotConnectedException {
|
protected void sendPacketInternal(Stanza packet) throws NotConnectedException {
|
||||||
sendElement(packet);
|
sendElement(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendElement(Element element) {
|
private void sendElement(Element element) {
|
||||||
try {
|
try {
|
||||||
send(ComposableBody.builder().setPayloadXML(element.toXML().toString()).build());
|
send(ComposableBody.builder().setPayloadXML(element.toXML().toString()).build());
|
||||||
if (element instanceof Packet) {
|
if (element instanceof Stanza) {
|
||||||
firePacketSendingListeners((Packet) element);
|
firePacketSendingListeners((Stanza) element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (BOSHException e) {
|
catch (BOSHException e) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class IQTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getPacketID()),
|
PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getStanzaId()),
|
||||||
new PacketTypeFilter(IQ.class));
|
new PacketTypeFilter(IQ.class));
|
||||||
PacketCollector collector = getConnection(0).createPacketCollector(filter);
|
PacketCollector collector = getConnection(0).createPacketCollector(filter);
|
||||||
// Send the iq packet with an invalid namespace
|
// Send the iq packet with an invalid namespace
|
||||||
|
@ -83,7 +83,7 @@ public class IQTest extends SmackTestCase {
|
||||||
|
|
||||||
// Create a packet collector to listen for a response.
|
// Create a packet collector to listen for a response.
|
||||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||||
new PacketIDFilter(versionRequest.getPacketID()));
|
new PacketIDFilter(versionRequest.getStanzaId()));
|
||||||
|
|
||||||
getConnection(0).sendPacket(versionRequest);
|
getConnection(0).sendPacket(versionRequest);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PacketReaderTest extends SmackTestCase {
|
||||||
|
|
||||||
// Send the IQ and wait for the answer
|
// Send the IQ and wait for the answer
|
||||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||||
new PacketIDFilter(iqPacket.getPacketID()));
|
new PacketIDFilter(iqPacket.getStanzaId()));
|
||||||
getConnection(0).sendPacket(iqPacket);
|
getConnection(0).sendPacket(iqPacket);
|
||||||
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class PacketIDFilterTest extends TestCase {
|
||||||
public MockIDPacket(String id) {
|
public MockIDPacket(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
public String getPacketID() {
|
public String getStanzaId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ import org.jivesoftware.smack.packet.Bind;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Mechanisms;
|
import org.jivesoftware.smack.packet.Mechanisms;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Session;
|
import org.jivesoftware.smack.packet.Session;
|
||||||
|
@ -120,7 +120,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* 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(Packet)} for-each
|
* consistent and we want {@link #invokePacketCollectors(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 PacketCollector 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>.
|
||||||
|
@ -362,7 +362,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
@Override
|
@Override
|
||||||
public abstract boolean isSecureConnection();
|
public abstract boolean isSecureConnection();
|
||||||
|
|
||||||
protected abstract void sendPacketInternal(Packet packet) throws NotConnectedException;
|
protected abstract void sendPacketInternal(Stanza packet) throws NotConnectedException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void send(PlainStreamElement element) throws NotConnectedException;
|
public abstract void send(PlainStreamElement element) throws NotConnectedException;
|
||||||
|
@ -634,7 +634,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacket(Packet packet) throws NotConnectedException {
|
public void sendPacket(Stanza packet) throws NotConnectedException {
|
||||||
Objects.requireNonNull(packet, "Packet must not be null");
|
Objects.requireNonNull(packet, "Packet must not be null");
|
||||||
|
|
||||||
throwNotConnectedExceptionIfAppropriate();
|
throwNotConnectedExceptionIfAppropriate();
|
||||||
|
@ -725,7 +725,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Packet packet)
|
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet)
|
||||||
throws NotConnectedException {
|
throws NotConnectedException {
|
||||||
// Create the packet collector before sending the packet
|
// Create the packet collector before sending the packet
|
||||||
PacketCollector packetCollector = createPacketCollector(packetFilter);
|
PacketCollector packetCollector = createPacketCollector(packetFilter);
|
||||||
|
@ -828,13 +828,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Process all packet listeners for sending packets.
|
* Process all packet listeners for sending packets.
|
||||||
* <p>
|
* <p>
|
||||||
* Compared to {@link #firePacketInterceptors(Packet)}, the listeners will be invoked in a new thread.
|
* Compared to {@link #firePacketInterceptors(Stanza)}, the listeners will be invoked in a new thread.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
protected void firePacketSendingListeners(final Packet packet) {
|
protected void firePacketSendingListeners(final Stanza packet) {
|
||||||
final List<PacketListener> listenersToNotify = new LinkedList<PacketListener>();
|
final List<PacketListener> listenersToNotify = new LinkedList<PacketListener>();
|
||||||
synchronized (sendListeners) {
|
synchronized (sendListeners) {
|
||||||
for (ListenerWrapper listenerWrapper : sendListeners.values()) {
|
for (ListenerWrapper listenerWrapper : sendListeners.values()) {
|
||||||
|
@ -889,7 +889,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
*
|
*
|
||||||
* @param packet the packet that is going to be sent to the server
|
* @param packet the packet that is going to be sent to the server
|
||||||
*/
|
*/
|
||||||
private void firePacketInterceptors(Packet packet) {
|
private void firePacketInterceptors(Stanza packet) {
|
||||||
List<PacketListener> interceptorsToInvoke = new LinkedList<PacketListener>();
|
List<PacketListener> interceptorsToInvoke = new LinkedList<PacketListener>();
|
||||||
synchronized (interceptors) {
|
synchronized (interceptors) {
|
||||||
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
|
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
|
||||||
|
@ -973,7 +973,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
protected void parseAndProcessStanza(XmlPullParser parser) throws Exception {
|
protected void parseAndProcessStanza(XmlPullParser parser) throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
int parserDepth = parser.getDepth();
|
int parserDepth = parser.getDepth();
|
||||||
Packet stanza = null;
|
Stanza stanza = null;
|
||||||
try {
|
try {
|
||||||
stanza = PacketParserUtils.parseStanza(parser);
|
stanza = PacketParserUtils.parseStanza(parser);
|
||||||
}
|
}
|
||||||
|
@ -999,7 +999,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
*
|
*
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
protected void processPacket(Packet packet) {
|
protected void processPacket(Stanza packet) {
|
||||||
assert(packet != null);
|
assert(packet != null);
|
||||||
lastStanzaReceived = System.currentTimeMillis();
|
lastStanzaReceived = System.currentTimeMillis();
|
||||||
// Deliver the incoming packet to listeners.
|
// Deliver the incoming packet to listeners.
|
||||||
|
@ -1011,9 +1011,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
*/
|
*/
|
||||||
private class ListenerNotification implements Runnable {
|
private class ListenerNotification implements Runnable {
|
||||||
|
|
||||||
private final Packet packet;
|
private final Stanza packet;
|
||||||
|
|
||||||
public ListenerNotification(Packet packet) {
|
public ListenerNotification(Stanza packet) {
|
||||||
this.packet = packet;
|
this.packet = packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,12 +1023,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke {@link PacketCollector#processPacket(Packet)} for every
|
* Invoke {@link PacketCollector#processPacket(Stanza)} for every
|
||||||
* PacketCollector with the given packet. Also notify the receive listeners with a matching packet filter about the packet.
|
* PacketCollector with the given packet. Also notify the receive listeners with a matching packet filter about the packet.
|
||||||
*
|
*
|
||||||
* @param packet the packet to notify the PacketCollectors and receive listeners about.
|
* @param packet the packet to notify the PacketCollectors and receive listeners about.
|
||||||
*/
|
*/
|
||||||
protected void invokePacketCollectorsAndNotifyRecvListeners(final Packet packet) {
|
protected void invokePacketCollectorsAndNotifyRecvListeners(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();
|
||||||
|
@ -1259,7 +1259,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
this.packetFilter = packetFilter;
|
this.packetFilter = packetFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean filterMatches(Packet packet) {
|
public boolean filterMatches(Stanza packet) {
|
||||||
return packetFilter == null || packetFilter.accept(packet);
|
return packetFilter == null || packetFilter.accept(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,7 +1287,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
this.packetFilter = packetFilter;
|
this.packetFilter = packetFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean filterMatches(Packet packet) {
|
public boolean filterMatches(Stanza packet) {
|
||||||
return packetFilter == null || packetFilter.accept(packet);
|
return packetFilter == null || packetFilter.accept(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1418,13 +1418,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
|
||||||
PacketListener callback) throws NotConnectedException {
|
PacketListener callback) throws NotConnectedException {
|
||||||
sendStanzaWithResponseCallback(stanza, replyFilter, callback, null);
|
sendStanzaWithResponseCallback(stanza, replyFilter, callback, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
|
||||||
PacketListener callback, ExceptionCallback exceptionCallback)
|
PacketListener callback, ExceptionCallback exceptionCallback)
|
||||||
throws NotConnectedException {
|
throws NotConnectedException {
|
||||||
sendStanzaWithResponseCallback(stanza, replyFilter, callback, exceptionCallback,
|
sendStanzaWithResponseCallback(stanza, replyFilter, callback, exceptionCallback,
|
||||||
|
@ -1432,7 +1432,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
|
||||||
final PacketListener callback, final ExceptionCallback exceptionCallback,
|
final PacketListener callback, final ExceptionCallback exceptionCallback,
|
||||||
long timeout) throws NotConnectedException {
|
long timeout) throws NotConnectedException {
|
||||||
Objects.requireNonNull(stanza, "stanza must not be null");
|
Objects.requireNonNull(stanza, "stanza must not be null");
|
||||||
|
@ -1443,7 +1443,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
final PacketListener packetListener = new PacketListener() {
|
final PacketListener packetListener = new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
try {
|
try {
|
||||||
XMPPErrorException.ifHasErrorThenThrow(packet);
|
XMPPErrorException.ifHasErrorThenThrow(packet);
|
||||||
callback.processPacket(packet);
|
callback.processPacket(packet);
|
||||||
|
@ -1497,7 +1497,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
public void addOneTimeSyncCallback(final PacketListener callback, final PacketFilter packetFilter) {
|
public void addOneTimeSyncCallback(final PacketListener callback, final PacketFilter packetFilter) {
|
||||||
final PacketListener packetListener = new PacketListener() {
|
final PacketListener packetListener = new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
try {
|
try {
|
||||||
callback.processPacket(packet);
|
callback.processPacket(packet);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.logging.Logger;
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a mechanism to collect packets into a result queue that pass a
|
* Provides a mechanism to collect packets into a result queue that pass a
|
||||||
|
@ -46,7 +46,7 @@ public class PacketCollector {
|
||||||
private static final Logger LOGGER = Logger.getLogger(PacketCollector.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(PacketCollector.class.getName());
|
||||||
|
|
||||||
private final PacketFilter packetFilter;
|
private final PacketFilter packetFilter;
|
||||||
private final ArrayBlockingQueue<Packet> resultQueue;
|
private final ArrayBlockingQueue<Stanza> resultQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The packet collector which timeout for the next result will get reset once this collector collects a stanza.
|
* The packet collector which timeout for the next result will get reset once this collector collects a stanza.
|
||||||
|
@ -103,7 +103,7 @@ public class PacketCollector {
|
||||||
* results.
|
* results.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <P extends Packet> P pollResult() {
|
public <P extends Stanza> P pollResult() {
|
||||||
return (P) resultQueue.poll();
|
return (P) resultQueue.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public class PacketCollector {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws XMPPErrorException in case an error response.
|
* @throws XMPPErrorException in case an error response.
|
||||||
*/
|
*/
|
||||||
public <P extends Packet> P pollResultOrThrow() throws XMPPErrorException {
|
public <P extends Stanza> P pollResultOrThrow() throws XMPPErrorException {
|
||||||
P result = pollResult();
|
P result = pollResult();
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
XMPPErrorException.ifHasErrorThenThrow(result);
|
XMPPErrorException.ifHasErrorThenThrow(result);
|
||||||
|
@ -133,7 +133,7 @@ public class PacketCollector {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <P extends Packet> P nextResultBlockForever() {
|
public <P extends Stanza> P nextResultBlockForever() {
|
||||||
throwIfCancelled();
|
throwIfCancelled();
|
||||||
P res = null;
|
P res = null;
|
||||||
while (res == null) {
|
while (res == null) {
|
||||||
|
@ -153,7 +153,7 @@ public class PacketCollector {
|
||||||
*
|
*
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
*/
|
*/
|
||||||
public <P extends Packet> P nextResult() {
|
public <P extends Stanza> P nextResult() {
|
||||||
return nextResult(connection.getPacketReplyTimeout());
|
return nextResult(connection.getPacketReplyTimeout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class PacketCollector {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <P extends Packet> P nextResult(long timeout) {
|
public <P extends Stanza> P nextResult(long timeout) {
|
||||||
throwIfCancelled();
|
throwIfCancelled();
|
||||||
P res = null;
|
P res = null;
|
||||||
long remainingWait = timeout;
|
long remainingWait = timeout;
|
||||||
|
@ -197,7 +197,7 @@ public class PacketCollector {
|
||||||
* @throws XMPPErrorException in case an error response.
|
* @throws XMPPErrorException in case an error response.
|
||||||
* @throws NoResponseException if there was no response from the server.
|
* @throws NoResponseException if there was no response from the server.
|
||||||
*/
|
*/
|
||||||
public <P extends Packet> P nextResultOrThrow() throws NoResponseException, XMPPErrorException {
|
public <P extends Stanza> P nextResultOrThrow() throws NoResponseException, XMPPErrorException {
|
||||||
return nextResultOrThrow(connection.getPacketReplyTimeout());
|
return nextResultOrThrow(connection.getPacketReplyTimeout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class PacketCollector {
|
||||||
* @throws NoResponseException if there was no response from the server.
|
* @throws NoResponseException if there was no response from the server.
|
||||||
* @throws XMPPErrorException in case an error response.
|
* @throws XMPPErrorException in case an error response.
|
||||||
*/
|
*/
|
||||||
public <P extends Packet> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException {
|
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException {
|
||||||
P result = nextResult(timeout);
|
P result = nextResult(timeout);
|
||||||
cancel();
|
cancel();
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
@ -238,7 +238,7 @@ public class PacketCollector {
|
||||||
*
|
*
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
protected void processPacket(Packet packet) {
|
protected void processPacket(Stanza packet) {
|
||||||
if (packetFilter == null || packetFilter.accept(packet)) {
|
if (packetFilter == null || packetFilter.accept(packet)) {
|
||||||
while (!resultQueue.offer(packet)) {
|
while (!resultQueue.offer(packet)) {
|
||||||
// Since we know the queue is full, this poll should never actually block.
|
// Since we know the queue is full, this poll should never actually block.
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
package org.jivesoftware.smack;
|
package org.jivesoftware.smack;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
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 packet is found,
|
* This allows event-style programming -- every time a new packet is found,
|
||||||
* the {@link #processPacket(Packet)} method will be called. This is the
|
* the {@link #processPacket(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 PacketCollector}
|
||||||
* which lets you block while waiting for results.
|
* which lets you block while waiting for results.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -48,6 +48,6 @@ public interface PacketListener {
|
||||||
*
|
*
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
public void processPacket(Packet packet) throws NotConnectedException;
|
public void processPacket(Stanza packet) throws NotConnectedException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.logging.Logger;
|
||||||
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.packet.TopLevelStreamElement;
|
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PlainStreamElement;
|
import org.jivesoftware.smack.packet.PlainStreamElement;
|
||||||
|
|
||||||
public class SynchronizationPoint<E extends Exception> {
|
public class SynchronizationPoint<E extends Exception> {
|
||||||
|
@ -61,8 +61,8 @@ public class SynchronizationPoint<E extends Exception> {
|
||||||
connectionLock.lock();
|
connectionLock.lock();
|
||||||
try {
|
try {
|
||||||
if (request != null) {
|
if (request != null) {
|
||||||
if (request instanceof Packet) {
|
if (request instanceof Stanza) {
|
||||||
connection.sendPacket((Packet) request);
|
connection.sendPacket((Stanza) request);
|
||||||
}
|
}
|
||||||
else if (request instanceof PlainStreamElement){
|
else if (request instanceof PlainStreamElement){
|
||||||
connection.send((PlainStreamElement) request);
|
connection.send((PlainStreamElement) request);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.jivesoftware.smack.filter.IQReplyFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.PlainStreamElement;
|
import org.jivesoftware.smack.packet.PlainStreamElement;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public interface XMPPConnection {
|
||||||
* @param packet the packet to send.
|
* @param packet the packet to send.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public void sendPacket(Packet packet) throws NotConnectedException;
|
public void sendPacket(Stanza packet) throws NotConnectedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a PlainStreamElement.
|
* Send a PlainStreamElement.
|
||||||
|
@ -203,7 +203,7 @@ public interface XMPPConnection {
|
||||||
* @param packet the packet to send right after the collector got created
|
* @param packet the packet to send right after the collector got created
|
||||||
* @return a new packet collector.
|
* @return a new packet collector.
|
||||||
*/
|
*/
|
||||||
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Packet packet)
|
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet)
|
||||||
throws NotConnectedException;
|
throws NotConnectedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,7 +214,7 @@ public interface XMPPConnection {
|
||||||
* <p>
|
* <p>
|
||||||
* <b>Note:</b> If you send a Packet right after using this method, then
|
* <b>Note:</b> If you send a Packet right after using this method, then
|
||||||
* consider using
|
* consider using
|
||||||
* {@link #createPacketCollectorAndSend(PacketFilter, Packet)} instead.
|
* {@link #createPacketCollectorAndSend(PacketFilter, Stanza)} instead.
|
||||||
* Otherwise make sure cancel the PacketCollector in every case, e.g. even
|
* Otherwise make sure cancel the PacketCollector 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 PacketCollector.
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -455,7 +455,7 @@ public interface XMPPConnection {
|
||||||
* @param callback the callback invoked if there is a response (required)
|
* @param callback the callback invoked if there is a response (required)
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
|
||||||
PacketListener callback) throws NotConnectedException;
|
PacketListener callback) throws NotConnectedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -472,7 +472,7 @@ public interface XMPPConnection {
|
||||||
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter, PacketListener callback,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, PacketListener callback,
|
||||||
ExceptionCallback exceptionCallback) throws NotConnectedException;
|
ExceptionCallback exceptionCallback) throws NotConnectedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -490,7 +490,7 @@ public interface XMPPConnection {
|
||||||
* @param timeout the timeout in milliseconds to wait for a response
|
* @param timeout the timeout in milliseconds to wait for a response
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter,
|
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
|
||||||
final PacketListener callback, final ExceptionCallback exceptionCallback,
|
final PacketListener callback, final ExceptionCallback exceptionCallback,
|
||||||
long timeout) throws NotConnectedException;
|
long timeout) throws NotConnectedException;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack;
|
package org.jivesoftware.smack;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public abstract class XMPPException extends Exception {
|
||||||
return getMessage();
|
return getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ifHasErrorThenThrow(Packet packet) throws XMPPErrorException {
|
public static void ifHasErrorThenThrow(Stanza packet) throws XMPPErrorException {
|
||||||
XMPPError xmppError = packet.getError();
|
XMPPError xmppError = packet.getError();
|
||||||
if (xmppError != null) {
|
if (xmppError != null) {
|
||||||
throw new XMPPErrorException(xmppError);
|
throw new XMPPErrorException(xmppError);
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.debugger;
|
||||||
import org.jivesoftware.smack.ConnectionListener;
|
import org.jivesoftware.smack.ConnectionListener;
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.ObservableReader;
|
import org.jivesoftware.smack.util.ObservableReader;
|
||||||
import org.jivesoftware.smack.util.ObservableWriter;
|
import org.jivesoftware.smack.util.ObservableWriter;
|
||||||
import org.jivesoftware.smack.util.ReaderListener;
|
import org.jivesoftware.smack.util.ReaderListener;
|
||||||
|
@ -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 PacketListener() {
|
listener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
if (printInterpreted) {
|
if (printInterpreted) {
|
||||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + packet.toXML());
|
log("RCV PKT (" + connection.getConnectionCounter() + "): " + packet.toXML());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ public class AndFilter implements PacketFilter {
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
for (PacketFilter filter : filters) {
|
for (PacketFilter filter : filters) {
|
||||||
if (!filter.accept(packet)) {
|
if (!filter.accept(packet)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,14 +19,14 @@ package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters for packets of a particular type and allows a custom method to further filter the packets.
|
* Filters for packets of a particular type and allows a custom method to further filter the packets.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public abstract class FlexiblePacketTypeFilter<P extends Packet> implements PacketFilter {
|
public abstract class FlexiblePacketTypeFilter<P extends Stanza> implements PacketFilter {
|
||||||
|
|
||||||
protected final Class<P> packetType;
|
protected final Class<P> packetType;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public abstract class FlexiblePacketTypeFilter<P extends Packet> implements Pack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
if (packetType.isInstance(packet)) {
|
if (packetType.isInstance(packet)) {
|
||||||
return acceptSpecific((P) packet);
|
return acceptSpecific((P) packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jxmpp.util.XmppStringUtils;
|
import org.jxmpp.util.XmppStringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +89,7 @@ public class FromMatchesFilter implements PacketFilter {
|
||||||
return new FromMatchesFilter(address, false);
|
return new FromMatchesFilter(address, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
String from = packet.getFrom();
|
String from = packet.getFrom();
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
return address == null;
|
return address == null;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jxmpp.util.XmppStringUtils;
|
import org.jxmpp.util.XmppStringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,7 @@ public class IQReplyFilter implements PacketFilter {
|
||||||
local = localJid.toLowerCase(Locale.US);
|
local = localJid.toLowerCase(Locale.US);
|
||||||
|
|
||||||
server = conn.getServiceName().toLowerCase(Locale.US);
|
server = conn.getServiceName().toLowerCase(Locale.US);
|
||||||
packetId = iqPacket.getPacketID();
|
packetId = iqPacket.getStanzaId();
|
||||||
|
|
||||||
PacketFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT);
|
PacketFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT);
|
||||||
PacketFilter idFilter = new PacketIDFilter(iqPacket);
|
PacketFilter idFilter = new PacketIDFilter(iqPacket);
|
||||||
|
@ -113,7 +113,7 @@ public class IQReplyFilter implements PacketFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
// First filter out everything that is not an IQ stanza and does not have the correct ID set.
|
// First filter out everything that is not an IQ stanza and does not have the correct ID set.
|
||||||
if (!iqAndIdFilter.accept(packet))
|
if (!iqAndIdFilter.accept(packet))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,7 @@ public class IQResultReplyFilter extends IQReplyFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
if (!super.accept(packet)) {
|
if (!super.accept(packet)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the logical NOT operation on a packet filter. In other words, packets
|
* Implements the logical NOT operation on a packet filter. In other words, packets
|
||||||
|
@ -41,7 +41,7 @@ public class NotFilter implements PacketFilter {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return !filter.accept(packet);
|
return !filter.accept(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ public class OrFilter implements PacketFilter {
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
for (PacketFilter filter : filters) {
|
for (PacketFilter filter : filters) {
|
||||||
if (filter.accept(packet)) {
|
if (filter.accept(packet)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class PacketExtensionFilter implements PacketFilter {
|
||||||
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return packet.hasExtension(elementName, namespace);
|
return packet.hasExtension(elementName, namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a way to filter packets for particular attributes. Packet filters are used when
|
* Defines a way to filter packets for particular attributes. Packet filters are used when
|
||||||
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.packet.Packet;
|
||||||
* // all packets that have a packet ID of "RS145".
|
* // all packets that have a packet ID of "RS145".
|
||||||
* PacketFilter myFilter = new PacketFilter() {
|
* PacketFilter myFilter = new PacketFilter() {
|
||||||
* public boolean accept(Packet packet) {
|
* public boolean accept(Packet packet) {
|
||||||
* return "RS145".equals(packet.getPacketID());
|
* return "RS145".equals(packet.getStanzaId());
|
||||||
* }
|
* }
|
||||||
* };
|
* };
|
||||||
* // Create a new packet collector using the filter we created.
|
* // Create a new packet collector using the filter we created.
|
||||||
|
@ -54,5 +54,5 @@ public interface PacketFilter {
|
||||||
* @param packet the packet to test.
|
* @param packet the packet to test.
|
||||||
* @return true if and only if <tt>packet</tt> passes the filter.
|
* @return true if and only if <tt>packet</tt> passes the filter.
|
||||||
*/
|
*/
|
||||||
public boolean accept(Packet packet);
|
public boolean accept(Stanza packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,8 +34,8 @@ public class PacketIDFilter implements PacketFilter {
|
||||||
*
|
*
|
||||||
* @param packet the packet which the ID is taken from.
|
* @param packet the packet which the ID is taken from.
|
||||||
*/
|
*/
|
||||||
public PacketIDFilter(Packet packet) {
|
public PacketIDFilter(Stanza packet) {
|
||||||
this(packet.getPacketID());
|
this(packet.getStanzaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,8 +48,8 @@ public class PacketIDFilter implements PacketFilter {
|
||||||
this.packetID = packetID;
|
this.packetID = packetID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return packetID.equals(packet.getPacketID());
|
return packetID.equals(packet.getStanzaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class PacketTypeFilter implements PacketFilter {
|
||||||
public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class);
|
public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class);
|
||||||
public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class);
|
public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class);
|
||||||
|
|
||||||
private final Class<? extends Packet> packetType;
|
private final Class<? extends Stanza> packetType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new packet type filter that will filter for packets that are the
|
* Creates a new packet type filter that will filter for packets that are the
|
||||||
|
@ -45,11 +45,11 @@ public class PacketTypeFilter implements PacketFilter {
|
||||||
*
|
*
|
||||||
* @param packetType the Class type.
|
* @param packetType the Class type.
|
||||||
*/
|
*/
|
||||||
public PacketTypeFilter(Class<? extends Packet> packetType) {
|
public PacketTypeFilter(Class<? extends Stanza> packetType) {
|
||||||
this.packetType = packetType;
|
this.packetType = packetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return packetType.isInstance(packet);
|
return packetType.isInstance(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class ThreadFilter implements PacketFilter {
|
||||||
this.thread = thread;
|
this.thread = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return packet instanceof Message && thread.equals(((Message) packet).getThread());
|
return packet instanceof Message && thread.equals(((Message) packet).getThread());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
public class ToFilter implements PacketFilter {
|
public class ToFilter implements PacketFilter {
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class ToFilter implements PacketFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
String packetTo = packet.getTo();
|
String packetTo = packet.getTo();
|
||||||
if (packetTo == null) {
|
if (packetTo == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class EmptyResultIQ extends IQ {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
}
|
}
|
||||||
setPacketID(request.getPacketID());
|
setStanzaId(request.getStanzaId());
|
||||||
setFrom(request.getTo());
|
setFrom(request.getTo());
|
||||||
setTo(request.getFrom());
|
setTo(request.getFrom());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Stream elements. Everything that is not a stanza (RFC 6120 8.), ie. message,
|
* Base class for Stream elements. Everything that is not a stanza (RFC 6120 8.), ie. message,
|
||||||
* presence and iq, should sublcass this class instead of {@link Packet}.
|
* presence and iq, should sublcass this class instead of {@link Stanza}.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public abstract class IQ extends Packet {
|
public abstract class IQ extends Stanza {
|
||||||
|
|
||||||
// Don't name this field 'ELEMENT'. When it comes to IQ, ELEMENT is the child element!
|
// Don't name this field 'ELEMENT'. When it comes to IQ, ELEMENT is the child element!
|
||||||
public static final String IQ_ELEMENT = "iq";
|
public static final String IQ_ELEMENT = "iq";
|
||||||
|
@ -247,7 +247,7 @@ public abstract class IQ extends Packet {
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
}
|
}
|
||||||
final ErrorIQ result = new ErrorIQ(error);
|
final ErrorIQ result = new ErrorIQ(error);
|
||||||
result.setPacketID(request.getPacketID());
|
result.setStanzaId(request.getStanzaId());
|
||||||
result.setFrom(request.getTo());
|
result.setFrom(request.getTo());
|
||||||
result.setTo(request.getFrom());
|
result.setTo(request.getFrom());
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public final class Message extends Packet {
|
public final class Message extends Stanza {
|
||||||
|
|
||||||
public static final String ELEMENT = "message";
|
public static final String ELEMENT = "message";
|
||||||
public static final String BODY = "body";
|
public static final String BODY = "body";
|
||||||
|
@ -126,7 +126,7 @@ public final class Message extends Packet {
|
||||||
* <p>
|
* <p>
|
||||||
* The default subject of a message is the subject that corresponds to the message's language.
|
* The default subject of a message is the subject that corresponds to the message's language.
|
||||||
* (see {@link #getLanguage()}) or if no language is set to the applications default
|
* (see {@link #getLanguage()}) or if no language is set to the applications default
|
||||||
* language (see {@link Packet#getDefaultLanguage()}).
|
* language (see {@link Stanza#getDefaultLanguage()}).
|
||||||
*
|
*
|
||||||
* @return the subject of the message.
|
* @return the subject of the message.
|
||||||
*/
|
*/
|
||||||
|
@ -244,7 +244,7 @@ public final class Message extends Packet {
|
||||||
* <p>
|
* <p>
|
||||||
* The default body of a message is the body that corresponds to the message's language.
|
* The default body of a message is the body that corresponds to the message's language.
|
||||||
* (see {@link #getLanguage()}) or if no language is set to the applications default
|
* (see {@link #getLanguage()}) or if no language is set to the applications default
|
||||||
* language (see {@link Packet#getDefaultLanguage()}).
|
* language (see {@link Stanza#getDefaultLanguage()}).
|
||||||
*
|
*
|
||||||
* @return the body of the message.
|
* @return the body of the message.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smack.packet;
|
||||||
/**
|
/**
|
||||||
* Plain stream elements, ie. everything that is <b>not a stanza</b> as defined
|
* Plain stream elements, ie. everything that is <b>not a stanza</b> as defined
|
||||||
* RFC 6120 8. Stanzas are {@link Message}, {@link Presence} and {@link IQ}.
|
* RFC 6120 8. Stanzas are {@link Message}, {@link Presence} and {@link IQ}.
|
||||||
* Everything else should sublcass this class instead of {@link Packet}.
|
* Everything else should sublcass this class instead of {@link Stanza}.
|
||||||
* <p>
|
* <p>
|
||||||
* It is important to cleanly distinguish between stanzas and non-stanzas. For
|
* It is important to cleanly distinguish between stanzas and non-stanzas. For
|
||||||
* example plain stream elements don't count into the stanza count of XEP-198
|
* example plain stream elements don't count into the stanza count of XEP-198
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public final class Presence extends Packet {
|
public final class Presence extends Stanza {
|
||||||
|
|
||||||
public static final String ELEMENT = "presence";
|
public static final String ELEMENT = "presence";
|
||||||
|
|
||||||
|
|
|
@ -28,18 +28,21 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for XMPP Stanzas, which are called packets in Smack.
|
* Base class for XMPP Stanzas, which are called Packet in older versions of Smack (i.e. < 4.1).
|
||||||
* <p>
|
* <p>
|
||||||
* Every packet has a unique ID (which is automatically
|
* Every stanza has a unique ID (which is automatically generated, but can be overridden). Stanza
|
||||||
* generated, but can be overridden). Optionally, the "to" and "from" fields can be set.
|
* IDs are required for IQ stanzas and recommended for presence and message stanzas. Optionally, the
|
||||||
|
* "to" and "from" fields can be set.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* XMPP Stanzas are {@link Message}, {@link IQ} and {@link Presence}. Which therefore subclass this class.
|
* XMPP Stanzas are {@link Message}, {@link IQ} and {@link Presence}. Which therefore subclass this
|
||||||
|
* class. <b>If you think you need to subclass this class, then you are doing something wrong.</b>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
|
* @see <a href="http://xmpp.org/rfcs/rfc6120.html#stanzas">RFC 6120 § 8. XML Stanzas</a>
|
||||||
*/
|
*/
|
||||||
public abstract class Packet implements TopLevelStreamElement {
|
public abstract class Stanza implements TopLevelStreamElement {
|
||||||
|
|
||||||
public static final String TEXT = "text";
|
public static final String TEXT = "text";
|
||||||
public static final String ITEM = "item";
|
public static final String ITEM = "item";
|
||||||
|
@ -49,7 +52,7 @@ public abstract class Packet implements TopLevelStreamElement {
|
||||||
|
|
||||||
private final MultiMap<String, PacketExtension> packetExtensions = new MultiMap<>();
|
private final MultiMap<String, PacketExtension> packetExtensions = new MultiMap<>();
|
||||||
|
|
||||||
private String packetID = null;
|
private String id = null;
|
||||||
private String to = null;
|
private String to = null;
|
||||||
private String from = null;
|
private String from = null;
|
||||||
private XMPPError error = null;
|
private XMPPError error = null;
|
||||||
|
@ -66,16 +69,16 @@ public abstract class Packet implements TopLevelStreamElement {
|
||||||
*/
|
*/
|
||||||
protected String language;
|
protected String language;
|
||||||
|
|
||||||
public Packet() {
|
public Stanza() {
|
||||||
this(StanzaIdUtil.newStanzaId());
|
this(StanzaIdUtil.newStanzaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Packet(String packetID) {
|
public Stanza(String stanzaId) {
|
||||||
setPacketID(packetID);
|
setStanzaId(stanzaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Packet(Packet p) {
|
public Stanza(Stanza p) {
|
||||||
packetID = p.getPacketID();
|
id = p.getStanzaId();
|
||||||
to = p.getTo();
|
to = p.getTo();
|
||||||
from = p.getFrom();
|
from = p.getFrom();
|
||||||
error = p.error;
|
error = p.error;
|
||||||
|
@ -87,22 +90,42 @@ public abstract class Packet implements TopLevelStreamElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unique ID of the packet. The returned value could be <code>null</code>.
|
* Returns the unique ID of the stanza. The returned value could be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @return the packet's unique ID or <code>null</code> if the packet's id is not available.
|
* @return the packet's unique ID or <code>null</code> if the id is not available.
|
||||||
*/
|
*/
|
||||||
|
public String getStanzaId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the stanza id.
|
||||||
|
* @deprecated use {@link #getStanzaId()} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getPacketID() {
|
public String getPacketID() {
|
||||||
return packetID;
|
return getStanzaId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the unique ID of the packet. To indicate that a packet has no id
|
* Sets the unique ID of the packet. To indicate that a packet has no id
|
||||||
* pass <code>null</code> as the packet's id value.
|
* pass <code>null</code> as the packet's id value.
|
||||||
*
|
*
|
||||||
* @param packetID the unique ID for the packet.
|
* @param id the unique ID for the packet.
|
||||||
*/
|
*/
|
||||||
|
public void setStanzaId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param packetID
|
||||||
|
* @deprecated use {@link #setStanzaId(String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setPacketID(String packetID) {
|
public void setPacketID(String packetID) {
|
||||||
this.packetID = packetID;
|
setStanzaId(packetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,7 +390,7 @@ public abstract class Packet implements TopLevelStreamElement {
|
||||||
protected void addCommonAttributes(XmlStringBuilder xml) {
|
protected void addCommonAttributes(XmlStringBuilder xml) {
|
||||||
xml.optAttribute("to", getTo());
|
xml.optAttribute("to", getTo());
|
||||||
xml.optAttribute("from", getFrom());
|
xml.optAttribute("from", getFrom());
|
||||||
xml.optAttribute("id", getPacketID());
|
xml.optAttribute("id", getStanzaId());
|
||||||
xml.xmllangAttribute(getLanguage());
|
xml.xmllangAttribute(getLanguage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A XMPP top level stream element. This is either a stanza ({@link Packet}) or
|
* A XMPP top level stream element. This is either a stanza ({@link Stanza}) or
|
||||||
* just a plain stream element ({@link PlainStreamElement}).
|
* just a plain stream element ({@link PlainStreamElement}).
|
||||||
*/
|
*/
|
||||||
public interface TopLevelStreamElement extends Element {
|
public interface TopLevelStreamElement extends Element {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Session;
|
import org.jivesoftware.smack.packet.Session;
|
||||||
|
@ -128,7 +128,7 @@ public class PacketParserUtils {
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet parseStanza(String stanza) throws XmlPullParserException, IOException, SmackException {
|
public static Stanza parseStanza(String stanza) throws XmlPullParserException, IOException, SmackException {
|
||||||
return parseStanza(getParserFor(stanza));
|
return parseStanza(getParserFor(stanza));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class PacketParserUtils {
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Packet parseStanza(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
public static Stanza parseStanza(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
final String name = parser.getName();
|
final String name = parser.getName();
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
@ -221,7 +221,7 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.setPacketID(parser.getAttributeValue("", "id"));
|
message.setStanzaId(parser.getAttributeValue("", "id"));
|
||||||
message.setTo(parser.getAttributeValue("", "to"));
|
message.setTo(parser.getAttributeValue("", "to"));
|
||||||
message.setFrom(parser.getAttributeValue("", "from"));
|
message.setFrom(parser.getAttributeValue("", "from"));
|
||||||
String typeString = parser.getAttributeValue("", "type");
|
String typeString = parser.getAttributeValue("", "type");
|
||||||
|
@ -237,7 +237,7 @@ public class PacketParserUtils {
|
||||||
defaultLanguage = language;
|
defaultLanguage = language;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
defaultLanguage = Packet.getDefaultLanguage();
|
defaultLanguage = Stanza.getDefaultLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse sub-elements. We include extra logic to make sure the values
|
// Parse sub-elements. We include extra logic to make sure the values
|
||||||
|
@ -529,7 +529,7 @@ public class PacketParserUtils {
|
||||||
Presence presence = new Presence(type);
|
Presence presence = new Presence(type);
|
||||||
presence.setTo(parser.getAttributeValue("", "to"));
|
presence.setTo(parser.getAttributeValue("", "to"));
|
||||||
presence.setFrom(parser.getAttributeValue("", "from"));
|
presence.setFrom(parser.getAttributeValue("", "from"));
|
||||||
presence.setPacketID(parser.getAttributeValue("", "id"));
|
presence.setStanzaId(parser.getAttributeValue("", "id"));
|
||||||
|
|
||||||
String language = getLanguageAttribute(parser);
|
String language = getLanguageAttribute(parser);
|
||||||
if (language != null && !"".equals(language.trim())) {
|
if (language != null && !"".equals(language.trim())) {
|
||||||
|
@ -562,7 +562,7 @@ public class PacketParserUtils {
|
||||||
LOGGER.warning("Empty or null mode text in presence show element form "
|
LOGGER.warning("Empty or null mode text in presence show element form "
|
||||||
+ presence.getFrom()
|
+ presence.getFrom()
|
||||||
+ " with id '"
|
+ " with id '"
|
||||||
+ presence.getPacketID()
|
+ presence.getStanzaId()
|
||||||
+ "' which is invalid according to RFC6121 4.7.2.1");
|
+ "' which is invalid according to RFC6121 4.7.2.1");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -661,7 +661,7 @@ public class PacketParserUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set basic values on the iq packet.
|
// Set basic values on the iq packet.
|
||||||
iqPacket.setPacketID(id);
|
iqPacket.setStanzaId(id);
|
||||||
iqPacket.setTo(to);
|
iqPacket.setTo(to);
|
||||||
iqPacket.setFrom(from);
|
iqPacket.setFrom(from);
|
||||||
iqPacket.setType(type);
|
iqPacket.setType(type);
|
||||||
|
@ -868,7 +868,7 @@ public class PacketParserUtils {
|
||||||
switch (namespace) {
|
switch (namespace) {
|
||||||
case XMPPError.NAMESPACE:
|
case XMPPError.NAMESPACE:
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case Packet.TEXT:
|
case Stanza.TEXT:
|
||||||
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1005,13 +1005,13 @@ public class PacketParserUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPacketExtension(Packet packet, XmlPullParser parser) throws XmlPullParserException,
|
public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws XmlPullParserException,
|
||||||
IOException, SmackException {
|
IOException, SmackException {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
addPacketExtension(packet, parser, parser.getName(), parser.getNamespace());
|
addPacketExtension(packet, parser, parser.getName(), parser.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPacketExtension(Packet packet, XmlPullParser parser, String elementName, String namespace)
|
public static void addPacketExtension(Stanza packet, XmlPullParser parser, String elementName, String namespace)
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
throws XmlPullParserException, IOException, SmackException {
|
||||||
PacketExtension packetExtension = parsePacketExtension(elementName, namespace, parser);
|
PacketExtension packetExtension = parsePacketExtension(elementName, namespace, parser);
|
||||||
packet.addExtension(packetExtension);
|
packet.addExtension(packetExtension);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PlainStreamElement;
|
import org.jivesoftware.smack.packet.PlainStreamElement;
|
||||||
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
* unit tests.
|
* unit tests.
|
||||||
*
|
*
|
||||||
* Instances store any packets that are delivered to be send using the
|
* Instances store any packets that are delivered to be send using the
|
||||||
* {@link #sendPacket(Packet)} method in a blocking queue. The content of this queue
|
* {@link #sendPacket(Stanza)} method in a blocking queue. The content of this queue
|
||||||
* can be inspected using {@link #getSentPacket()}. Typically these queues are
|
* can be inspected using {@link #getSentPacket()}. Typically these queues are
|
||||||
* used to retrieve a message that was generated by the client.
|
* used to retrieve a message that was generated by the client.
|
||||||
*
|
*
|
||||||
* Packets that should be processed by the client to simulate a received stanza
|
* Packets that should be processed by the client to simulate a received stanza
|
||||||
* can be delivered using the {@linkplain #processPacket(Packet)} method.
|
* can be delivered using the {@linkplain #processPacket(Stanza)} method.
|
||||||
* It invokes the registered packet interceptors and listeners.
|
* It invokes the registered packet interceptors and listeners.
|
||||||
*
|
*
|
||||||
* @see XMPPConnection
|
* @see XMPPConnection
|
||||||
|
@ -132,7 +132,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendPacketInternal(Packet packet) {
|
protected void sendPacketInternal(Stanza packet) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
if (SmackConfiguration.DEBUG) {
|
||||||
System.out.println("[SEND]: " + packet.toXML());
|
System.out.println("[SEND]: " + packet.toXML());
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of packets that's sent through {@link #sendPacket(Packet)} and
|
* Returns the number of packets that's sent through {@link #sendPacket(Stanza)} and
|
||||||
* that has not been returned by {@link #getSentPacket()}.
|
* that has not been returned by {@link #getSentPacket()}.
|
||||||
*
|
*
|
||||||
* @return the number of packets which are in the queue.
|
* @return the number of packets which are in the queue.
|
||||||
|
@ -150,7 +150,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first packet that's sent through {@link #sendPacket(Packet)}
|
* Returns the first packet that's sent through {@link #sendPacket(Stanza)}
|
||||||
* and that has not been returned by earlier calls to this method.
|
* and that has not been returned by earlier calls to this method.
|
||||||
*
|
*
|
||||||
* @return a sent packet.
|
* @return a sent packet.
|
||||||
|
@ -160,7 +160,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first packet that's sent through {@link #sendPacket(Packet)}
|
* Returns the first packet that's sent through {@link #sendPacket(Stanza)}
|
||||||
* and that has not been returned by earlier calls to this method. This
|
* and that has not been returned by earlier calls to this method. This
|
||||||
* method will block for up to the specified number of seconds if no packets
|
* method will block for up to the specified number of seconds if no packets
|
||||||
* have been sent yet.
|
* have been sent yet.
|
||||||
|
@ -184,7 +184,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
*
|
*
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
if (SmackConfiguration.DEBUG) {
|
||||||
System.out.println("[RECV]: " + packet.toXML());
|
System.out.println("[RECV]: " + packet.toXML());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class PacketCollectorTest
|
public class PacketCollectorTest
|
||||||
|
@ -33,29 +33,29 @@ public class PacketCollectorTest
|
||||||
|
|
||||||
for (int i=0; i<6; i++)
|
for (int i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
Packet testPacket = new TestPacket(i);
|
Stanza testPacket = new TestPacket(i);
|
||||||
collector.processPacket(testPacket);
|
collector.processPacket(testPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assert that '0' has rolled off
|
// Assert that '0' has rolled off
|
||||||
assertEquals("1", collector.nextResultBlockForever().getPacketID());
|
assertEquals("1", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("2", collector.nextResultBlockForever().getPacketID());
|
assertEquals("2", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("3", collector.nextResultBlockForever().getPacketID());
|
assertEquals("3", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("4", collector.nextResultBlockForever().getPacketID());
|
assertEquals("4", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("5", collector.pollResult().getPacketID());
|
assertEquals("5", collector.pollResult().getStanzaId());
|
||||||
assertNull(collector.pollResult());
|
assertNull(collector.pollResult());
|
||||||
|
|
||||||
for (int i=10; i<15; i++)
|
for (int i=10; i<15; i++)
|
||||||
{
|
{
|
||||||
Packet testPacket = new TestPacket(i);
|
Stanza testPacket = new TestPacket(i);
|
||||||
collector.processPacket(testPacket);
|
collector.processPacket(testPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("10", collector.nextResultBlockForever().getPacketID());
|
assertEquals("10", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("11", collector.nextResultBlockForever().getPacketID());
|
assertEquals("11", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("12", collector.nextResultBlockForever().getPacketID());
|
assertEquals("12", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("13", collector.nextResultBlockForever().getPacketID());
|
assertEquals("13", collector.nextResultBlockForever().getStanzaId());
|
||||||
assertEquals("14", collector.pollResult().getPacketID());
|
assertEquals("14", collector.pollResult().getStanzaId());
|
||||||
assertNull(collector.pollResult());
|
assertNull(collector.pollResult());
|
||||||
|
|
||||||
assertNull(collector.nextResult(1000));
|
assertNull(collector.nextResult(1000));
|
||||||
|
@ -88,7 +88,7 @@ public class PacketCollectorTest
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Packet packet = collector.nextResultBlockForever();
|
Stanza packet = collector.nextResultBlockForever();
|
||||||
// System.out.println(Thread.currentThread().getName() + " packet: " + packet);
|
// System.out.println(Thread.currentThread().getName() + " packet: " + packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class PacketCollectorTest
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Packet p = null;
|
Stanza p = null;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ public class PacketCollectorTest
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Packet p = null;
|
Stanza p = null;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ public class PacketCollectorTest
|
||||||
class OKEverything implements PacketFilter
|
class OKEverything implements PacketFilter
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet)
|
public boolean accept(Stanza packet)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -193,17 +193,17 @@ public class PacketCollectorTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestPacket extends Packet
|
class TestPacket extends Stanza
|
||||||
{
|
{
|
||||||
public TestPacket(int i)
|
public TestPacket(int i)
|
||||||
{
|
{
|
||||||
setPacketID(String.valueOf(i));
|
setStanzaId(String.valueOf(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML()
|
public String toXML()
|
||||||
{
|
{
|
||||||
return "<packetId>" + getPacketID() + "</packetId>";
|
return "<packetId>" + getStanzaId() + "</packetId>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,11 @@ public class StanzaIdTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIqId() {
|
public void testIqId() {
|
||||||
IQ iq1 = new TestIQ();
|
IQ iq1 = new TestIQ();
|
||||||
String iq1Id = iq1.getPacketID();
|
String iq1Id = iq1.getStanzaId();
|
||||||
assertTrue(StringUtils.isNotEmpty(iq1Id));
|
assertTrue(StringUtils.isNotEmpty(iq1Id));
|
||||||
|
|
||||||
IQ iq2 = new TestIQ();
|
IQ iq2 = new TestIQ();
|
||||||
String iq2Id = iq2.getPacketID();
|
String iq2Id = iq2.getStanzaId();
|
||||||
assertTrue(StringUtils.isNotEmpty(iq2Id));
|
assertTrue(StringUtils.isNotEmpty(iq2Id));
|
||||||
|
|
||||||
assertFalse(iq1Id.equals(iq2Id));
|
assertFalse(iq1Id.equals(iq2Id));
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,11 +34,11 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
*/
|
*/
|
||||||
public class ThreadedDummyConnection extends DummyConnection {
|
public class ThreadedDummyConnection extends DummyConnection {
|
||||||
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
||||||
private BlockingQueue<Packet> messageQ = new LinkedBlockingQueue<Packet>(5);
|
private BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
|
||||||
private volatile boolean timeout = false;
|
private volatile boolean timeout = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPacket(Packet packet) throws NotConnectedException {
|
public void sendPacket(Stanza packet) throws NotConnectedException {
|
||||||
super.sendPacket(packet);
|
super.sendPacket(packet);
|
||||||
|
|
||||||
if (packet instanceof IQ && !timeout) {
|
if (packet instanceof IQ && !timeout) {
|
||||||
|
@ -52,7 +52,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
replyPacket = IQ.createResultIQ((IQ) packet);
|
replyPacket = IQ.createResultIQ((IQ) packet);
|
||||||
replyQ.add(replyPacket);
|
replyQ.add(replyPacket);
|
||||||
}
|
}
|
||||||
replyPacket.setPacketID(packet.getPacketID());
|
replyPacket.setStanzaId(packet.getStanzaId());
|
||||||
replyPacket.setFrom(packet.getTo());
|
replyPacket.setFrom(packet.getTo());
|
||||||
replyPacket.setTo(packet.getFrom());
|
replyPacket.setTo(packet.getFrom());
|
||||||
replyPacket.setType(Type.result);
|
replyPacket.setType(Type.result);
|
||||||
|
@ -64,7 +64,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
/**
|
/**
|
||||||
* Calling this method will cause the next sendPacket call with an IQ packet to timeout.
|
* Calling this method will cause the next sendPacket call with an IQ packet to timeout.
|
||||||
* This is accomplished by simply stopping the auto creating of the reply packet
|
* This is accomplished by simply stopping the auto creating of the reply packet
|
||||||
* or processing one that was entered via {@link #processPacket(Packet)}.
|
* or processing one that was entered via {@link #processPacket(Stanza)}.
|
||||||
*/
|
*/
|
||||||
public void setTimeout() {
|
public void setTimeout() {
|
||||||
timeout = true;
|
timeout = true;
|
||||||
|
@ -86,9 +86,9 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProcessQueue extends Thread {
|
class ProcessQueue extends Thread {
|
||||||
private BlockingQueue<? extends Packet> processQ;
|
private BlockingQueue<? extends Stanza> processQ;
|
||||||
|
|
||||||
ProcessQueue(BlockingQueue<? extends Packet> queue) {
|
ProcessQueue(BlockingQueue<? extends Stanza> queue) {
|
||||||
processQ = queue;
|
processQ = queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
|
||||||
import org.jivesoftware.smack.filter.FromMatchesFilter;
|
import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ public class FromMatchesFilterTest {
|
||||||
public void autoCompareMatchingFullJid()
|
public void autoCompareMatchingFullJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.create(FULL_JID1_R1);
|
FromMatchesFilter filter = FromMatchesFilter.create(FULL_JID1_R1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ public class FromMatchesFilterTest {
|
||||||
public void autoCompareMatchingBaseJid()
|
public void autoCompareMatchingBaseJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.create(BASE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.create(BASE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -100,7 +100,7 @@ public class FromMatchesFilterTest {
|
||||||
public void autoCompareMatchingServiceJid()
|
public void autoCompareMatchingServiceJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.create(SERVICE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.create(SERVICE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,7 @@ public class FromMatchesFilterTest {
|
||||||
public void bareCompareMatchingFullJid()
|
public void bareCompareMatchingFullJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createBare(FULL_JID1_R1);
|
FromMatchesFilter filter = FromMatchesFilter.createBare(FULL_JID1_R1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -153,7 +153,7 @@ public class FromMatchesFilterTest {
|
||||||
public void bareCompareMatchingBaseJid()
|
public void bareCompareMatchingBaseJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createBare(BASE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.createBare(BASE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -181,7 +181,7 @@ public class FromMatchesFilterTest {
|
||||||
public void bareCompareMatchingServiceJid()
|
public void bareCompareMatchingServiceJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createBare(SERVICE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.createBare(SERVICE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -206,7 +206,7 @@ public class FromMatchesFilterTest {
|
||||||
public void fullCompareMatchingFullJid()
|
public void fullCompareMatchingFullJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createFull(FULL_JID1_R1);
|
FromMatchesFilter filter = FromMatchesFilter.createFull(FULL_JID1_R1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -234,7 +234,7 @@ public class FromMatchesFilterTest {
|
||||||
public void fullCompareMatchingBaseJid()
|
public void fullCompareMatchingBaseJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createFull(BASE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.createFull(BASE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
@ -262,7 +262,7 @@ public class FromMatchesFilterTest {
|
||||||
public void fullCompareMatchingServiceJid()
|
public void fullCompareMatchingServiceJid()
|
||||||
{
|
{
|
||||||
FromMatchesFilter filter = FromMatchesFilter.createFull(SERVICE_JID1);
|
FromMatchesFilter filter = FromMatchesFilter.createFull(SERVICE_JID1);
|
||||||
Packet packet = new Packet() {
|
Stanza packet = new Stanza() {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() { return null; }
|
public String toXML() { return null; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class IQResponseTest {
|
||||||
final IQ result = IQ.createResultIQ(request);
|
final IQ result = IQ.createResultIQ(request);
|
||||||
|
|
||||||
assertEquals(IQ.Type.result, result.getType());
|
assertEquals(IQ.Type.result, result.getType());
|
||||||
assertNotNull(result.getPacketID());
|
assertNotNull(result.getStanzaId());
|
||||||
assertEquals(request.getPacketID(), result.getPacketID());
|
assertEquals(request.getStanzaId(), result.getStanzaId());
|
||||||
assertEquals(request.getFrom(), result.getTo());
|
assertEquals(request.getFrom(), result.getTo());
|
||||||
assertEquals(request.getTo(), result.getFrom());
|
assertEquals(request.getTo(), result.getFrom());
|
||||||
assertEquals("", result.getChildElementXML().toString());
|
assertEquals("", result.getChildElementXML().toString());
|
||||||
|
@ -68,8 +68,8 @@ public class IQResponseTest {
|
||||||
final IQ result = IQ.createErrorResponse(request, error);
|
final IQ result = IQ.createErrorResponse(request, error);
|
||||||
|
|
||||||
assertEquals(IQ.Type.error, result.getType());
|
assertEquals(IQ.Type.error, result.getType());
|
||||||
assertNotNull(result.getPacketID());
|
assertNotNull(result.getStanzaId());
|
||||||
assertEquals(request.getPacketID(), result.getPacketID());
|
assertEquals(request.getStanzaId(), result.getStanzaId());
|
||||||
assertEquals(request.getFrom(), result.getTo());
|
assertEquals(request.getFrom(), result.getTo());
|
||||||
assertEquals(error, result.getError());
|
assertEquals(error, result.getError());
|
||||||
// TODO this test was never valid
|
// TODO this test was never valid
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MessageTest {
|
||||||
String control = controlBuilder.toString();
|
String control = controlBuilder.toString();
|
||||||
|
|
||||||
Message messageTypeInConstructor = new Message(null, Message.Type.chat);
|
Message messageTypeInConstructor = new Message(null, Message.Type.chat);
|
||||||
messageTypeInConstructor.setPacketID(null);
|
messageTypeInConstructor.setStanzaId(null);
|
||||||
assertEquals(type, messageTypeInConstructor.getType());
|
assertEquals(type, messageTypeInConstructor.getType());
|
||||||
assertXMLEqual(control, messageTypeInConstructor.toXML().toString());
|
assertXMLEqual(control, messageTypeInConstructor.toXML().toString());
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class MessageTest {
|
||||||
|
|
||||||
private static Message getNewMessage() {
|
private static Message getNewMessage() {
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.setPacketID(null);
|
message.setStanzaId(null);
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class PresenceTest {
|
||||||
String control = controlBuilder.toString();
|
String control = controlBuilder.toString();
|
||||||
|
|
||||||
Presence presenceTypeInConstructor = new Presence(type);
|
Presence presenceTypeInConstructor = new Presence(type);
|
||||||
presenceTypeInConstructor.setPacketID(null);
|
presenceTypeInConstructor.setStanzaId(null);
|
||||||
assertEquals(type, presenceTypeInConstructor.getType());
|
assertEquals(type, presenceTypeInConstructor.getType());
|
||||||
assertXMLEqual(control, presenceTypeInConstructor.toXML().toString());
|
assertXMLEqual(control, presenceTypeInConstructor.toXML().toString());
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class PresenceTest {
|
||||||
|
|
||||||
Presence presenceModeInConstructor = new Presence(Presence.Type.available, status, priority,
|
Presence presenceModeInConstructor = new Presence(Presence.Type.available, status, priority,
|
||||||
mode1);
|
mode1);
|
||||||
presenceModeInConstructor.setPacketID(null);
|
presenceModeInConstructor.setStanzaId(null);
|
||||||
assertEquals(mode1, presenceModeInConstructor.getMode());
|
assertEquals(mode1, presenceModeInConstructor.getMode());
|
||||||
assertXMLEqual(control, presenceModeInConstructor.toXML().toString());
|
assertXMLEqual(control, presenceModeInConstructor.toXML().toString());
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class PresenceTest {
|
||||||
|
|
||||||
private static Presence getNewPresence() {
|
private static Presence getNewPresence() {
|
||||||
Presence presence = new Presence(Presence.Type.available);
|
Presence presence = new Presence(Presence.Type.available);
|
||||||
presence.setPacketID(null);
|
presence.setStanzaId(null);
|
||||||
return presence;
|
return presence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
public class WaitForPacketListener implements PacketListener {
|
public class WaitForPacketListener implements PacketListener {
|
||||||
|
|
||||||
private CountDownLatch latch = new CountDownLatch(1);
|
private CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
reportInvoked();
|
reportInvoked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.sasl.SASLError;
|
import org.jivesoftware.smack.sasl.SASLError;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
||||||
|
@ -59,7 +59,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleMessageBodyTest() throws Exception {
|
public void singleMessageBodyTest() throws Exception {
|
||||||
String defaultLanguage = Packet.getDefaultLanguage();
|
String defaultLanguage = Stanza.getDefaultLanguage();
|
||||||
String otherLanguage = determineNonDefaultLanguage();
|
String otherLanguage = determineNonDefaultLanguage();
|
||||||
|
|
||||||
String control;
|
String control;
|
||||||
|
@ -208,7 +208,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleMessageSubjectTest() throws Exception {
|
public void singleMessageSubjectTest() throws Exception {
|
||||||
String defaultLanguage = Packet.getDefaultLanguage();
|
String defaultLanguage = Stanza.getDefaultLanguage();
|
||||||
String otherLanguage = determineNonDefaultLanguage();
|
String otherLanguage = determineNonDefaultLanguage();
|
||||||
|
|
||||||
String control;
|
String control;
|
||||||
|
@ -357,7 +357,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void multipleMessageBodiesTest() throws Exception {
|
public void multipleMessageBodiesTest() throws Exception {
|
||||||
String defaultLanguage = Packet.getDefaultLanguage();
|
String defaultLanguage = Stanza.getDefaultLanguage();
|
||||||
String otherLanguage = determineNonDefaultLanguage();
|
String otherLanguage = determineNonDefaultLanguage();
|
||||||
|
|
||||||
String control;
|
String control;
|
||||||
|
@ -510,7 +510,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void multipleMessageSubjectsTest() throws Exception {
|
public void multipleMessageSubjectsTest() throws Exception {
|
||||||
String defaultLanguage = Packet.getDefaultLanguage();
|
String defaultLanguage = Stanza.getDefaultLanguage();
|
||||||
String otherLanguage = determineNonDefaultLanguage();
|
String otherLanguage = determineNonDefaultLanguage();
|
||||||
|
|
||||||
String control;
|
String control;
|
||||||
|
@ -748,7 +748,7 @@ public class PacketParserUtilsTest {
|
||||||
.t("This is a test of the emergency broadcast system, 3.")
|
.t("This is a test of the emergency broadcast system, 3.")
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
Packet message = PacketParserUtils.parseStanza(control);
|
Stanza message = PacketParserUtils.parseStanza(control);
|
||||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
XmlUnitUtils.assertSimilar(control, message.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smackx.debugger.slf4j;
|
package org.jivesoftware.smackx.debugger.slf4j;
|
||||||
|
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class SLF4JLoggingPacketListener implements PacketListener {
|
||||||
this.prefix = Validate.notNull(prefix);
|
this.prefix = Validate.notNull(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.debugger.SmackDebugger;
|
import org.jivesoftware.smack.debugger.SmackDebugger;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.util.ObservableReader;
|
import org.jivesoftware.smack.util.ObservableReader;
|
||||||
import org.jivesoftware.smack.util.ObservableWriter;
|
import org.jivesoftware.smack.util.ObservableWriter;
|
||||||
|
@ -206,7 +206,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
packetReaderListener = new PacketListener() {
|
packetReaderListener = new PacketListener() {
|
||||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss:SS aaa");
|
SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss:SS aaa");
|
||||||
|
|
||||||
public void processPacket(final Packet packet) {
|
public void processPacket(final Stanza packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
addReadPacketToTable(dateFormatter, packet);
|
addReadPacketToTable(dateFormatter, packet);
|
||||||
|
@ -221,7 +221,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
packetWriterListener = new PacketListener() {
|
packetWriterListener = new PacketListener() {
|
||||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss:SS aaa");
|
SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss:SS aaa");
|
||||||
|
|
||||||
public void processPacket(final Packet packet) {
|
public void processPacket(final Stanza packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
addSentPacketToTable(dateFormatter, packet);
|
addSentPacketToTable(dateFormatter, packet);
|
||||||
|
@ -791,7 +791,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
||||||
* @param packet the read packet to add to the table
|
* @param packet the read packet to add to the table
|
||||||
*/
|
*/
|
||||||
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final Packet packet) {
|
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final Stanza packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String messageType;
|
String messageType;
|
||||||
|
@ -836,7 +836,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
packetReceivedIcon,
|
packetReceivedIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
messageType,
|
messageType,
|
||||||
packet.getPacketID(),
|
packet.getStanzaId(),
|
||||||
type,
|
type,
|
||||||
"",
|
"",
|
||||||
from});
|
from});
|
||||||
|
@ -852,7 +852,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
||||||
* @param packet the sent packet to add to the table
|
* @param packet the sent packet to add to the table
|
||||||
*/
|
*/
|
||||||
private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final Packet packet) {
|
private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final Stanza packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String messageType;
|
String messageType;
|
||||||
|
@ -897,7 +897,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
packetSentIcon,
|
packetSentIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
messageType,
|
messageType,
|
||||||
packet.getPacketID(),
|
packet.getStanzaId(),
|
||||||
type,
|
type,
|
||||||
to,
|
to,
|
||||||
""});
|
""});
|
||||||
|
@ -970,7 +970,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
* The whole text to send must be passed to the constructor. This implies that the client of
|
* The whole text to send must be passed to the constructor. This implies that the client of
|
||||||
* this class is responsible for sending a valid text to the constructor.
|
* this class is responsible for sending a valid text to the constructor.
|
||||||
*/
|
*/
|
||||||
private class AdHocPacket extends Packet {
|
private class AdHocPacket extends Stanza {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import javax.swing.JTextArea;
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.debugger.SmackDebugger;
|
import org.jivesoftware.smack.debugger.SmackDebugger;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.ObservableReader;
|
import org.jivesoftware.smack.util.ObservableReader;
|
||||||
import org.jivesoftware.smack.util.ObservableWriter;
|
import org.jivesoftware.smack.util.ObservableWriter;
|
||||||
import org.jivesoftware.smack.util.ReaderListener;
|
import org.jivesoftware.smack.util.ReaderListener;
|
||||||
|
@ -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 PacketListener() {
|
listener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(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);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
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.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
||||||
import org.jivesoftware.smackx.carbons.packet.Carbon;
|
import org.jivesoftware.smackx.carbons.packet.Carbon;
|
||||||
import org.jivesoftware.smackx.carbons.packet.CarbonExtension.Private;
|
import org.jivesoftware.smackx.carbons.packet.CarbonExtension.Private;
|
||||||
|
@ -120,7 +120,7 @@ public class CarbonManager extends Manager {
|
||||||
IQ setIQ = carbonsEnabledIQ(new_state);
|
IQ setIQ = carbonsEnabledIQ(new_state);
|
||||||
|
|
||||||
connection().sendIqWithResponseCallback(setIQ, new PacketListener() {
|
connection().sendIqWithResponseCallback(setIQ, new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
enabled_state = new_state;
|
enabled_state = new_state;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.gcm.packet;
|
package org.jivesoftware.smackx.gcm.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.json.packet.AbstractJsonPacketExtension;
|
import org.jivesoftware.smackx.json.packet.AbstractJsonPacketExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ public class GcmPacketExtension extends AbstractJsonPacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the GCM packet extension or null.
|
* @return the GCM packet extension or null.
|
||||||
*/
|
*/
|
||||||
public static GcmPacketExtension from(Packet packet) {
|
public static GcmPacketExtension from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.json.packet;
|
package org.jivesoftware.smackx.json.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XMPP JSON Containers as defined in XEP-0335
|
* XMPP JSON Containers as defined in XEP-0335
|
||||||
|
@ -48,7 +48,7 @@ public class JsonPacketExtension extends AbstractJsonPacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the JSON packet extension or null.
|
* @return the JSON packet extension or null.
|
||||||
*/
|
*/
|
||||||
public static JsonPacketExtension from(Packet packet) {
|
public static JsonPacketExtension from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class CompressionTest extends SmackTestCase {
|
||||||
version.setTo(getServiceName());
|
version.setTo(getServiceName());
|
||||||
|
|
||||||
// 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.getPacketID()));
|
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getStanzaId()));
|
||||||
|
|
||||||
connection.sendPacket(version);
|
connection.sendPacket(version);
|
||||||
|
|
||||||
|
|
|
@ -212,9 +212,9 @@ public class MessageEventManagerTest extends SmackTestCase {
|
||||||
// Send the message that contains the notifications request
|
// Send the message that contains the notifications request
|
||||||
try {
|
try {
|
||||||
chat1.sendMessage(msg);
|
chat1.sendMessage(msg);
|
||||||
messageEventManager2.sendDisplayedNotification(getBareJID(0), msg.getPacketID());
|
messageEventManager2.sendDisplayedNotification(getBareJID(0), msg.getStanzaId());
|
||||||
messageEventManager2.sendComposingNotification(getBareJID(0), msg.getPacketID());
|
messageEventManager2.sendComposingNotification(getBareJID(0), msg.getStanzaId());
|
||||||
messageEventManager2.sendCancelledNotification(getBareJID(0), msg.getPacketID());
|
messageEventManager2.sendCancelledNotification(getBareJID(0), msg.getStanzaId());
|
||||||
// Wait up to 2 seconds
|
// Wait up to 2 seconds
|
||||||
long initial = System.currentTimeMillis();
|
long initial = System.currentTimeMillis();
|
||||||
while (System.currentTimeMillis() - initial < 2000 &&
|
while (System.currentTimeMillis() - initial < 2000 &&
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class VersionTest extends SmackTestCase {
|
||||||
version.setTo(getServiceName());
|
version.setTo(getServiceName());
|
||||||
|
|
||||||
// Create a packet collector to listen for a response.
|
// Create a packet collector to listen for a response.
|
||||||
PacketCollector collector = getConnection(0).createPacketCollector(new PacketIDFilter(version.getPacketID()));
|
PacketCollector collector = getConnection(0).createPacketCollector(new PacketIDFilter(version.getStanzaId()));
|
||||||
|
|
||||||
getConnection(0).sendPacket(version);
|
getConnection(0).sendPacket(version);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class InBandBytestreamTest extends SmackTestCase {
|
||||||
open.setTo(targetConnection.getUser());
|
open.setTo(targetConnection.getUser());
|
||||||
|
|
||||||
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
||||||
open.getPacketID()));
|
open.getStanzaId()));
|
||||||
initiatorConnection.sendPacket(open);
|
initiatorConnection.sendPacket(open);
|
||||||
Packet result = collector.nextResult();
|
Packet result = collector.nextResult();
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class Socks5ByteStreamTest extends SmackTestCase {
|
||||||
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
|
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
|
||||||
|
|
||||||
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
|
||||||
bytestreamInitiation.getPacketID()));
|
bytestreamInitiation.getStanzaId()));
|
||||||
initiatorConnection.sendPacket(bytestreamInitiation);
|
initiatorConnection.sendPacket(bytestreamInitiation);
|
||||||
Packet result = collector.nextResult();
|
Packet result = collector.nextResult();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
|
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
@ -65,7 +65,7 @@ public class MultipleRecipientManager {
|
||||||
* @throws NoResponseException if there was no response from the server.
|
* @throws NoResponseException if there was no response from the server.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public static void send(XMPPConnection connection, Packet packet, Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException
|
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException
|
||||||
{
|
{
|
||||||
send(connection, packet, to, cc, bcc, null, null, false);
|
send(connection, packet, to, cc, bcc, null, null, false);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class MultipleRecipientManager {
|
||||||
* server does not support them.
|
* server does not support them.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public static void send(XMPPConnection connection, Packet packet, Collection<String> to, Collection<String> cc, Collection<String> bcc,
|
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc,
|
||||||
String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException {
|
String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException {
|
||||||
// Check if *only* 'to' is set and contains just *one* entry, in this case extended stanzas addressing is not
|
// Check if *only* 'to' is set and contains just *one* entry, in this case extended stanzas addressing is not
|
||||||
// required at all and we can send it just as normal stanza without needing to add the extension element
|
// required at all and we can send it just as normal stanza without needing to add the extension element
|
||||||
|
@ -192,13 +192,13 @@ public class MultipleRecipientManager {
|
||||||
* @return the MultipleRecipientInfo contained in the specified packet or <tt>null</tt>
|
* @return the MultipleRecipientInfo contained in the specified packet or <tt>null</tt>
|
||||||
* if none was found.
|
* if none was found.
|
||||||
*/
|
*/
|
||||||
public static MultipleRecipientInfo getMultipleRecipientInfo(Packet packet) {
|
public static MultipleRecipientInfo getMultipleRecipientInfo(Stanza packet) {
|
||||||
MultipleAddresses extension = (MultipleAddresses) packet
|
MultipleAddresses extension = (MultipleAddresses) packet
|
||||||
.getExtension(MultipleAddresses.ELEMENT, MultipleAddresses.NAMESPACE);
|
.getExtension(MultipleAddresses.ELEMENT, MultipleAddresses.NAMESPACE);
|
||||||
return extension == null ? null : new MultipleRecipientInfo(extension);
|
return extension == null ? null : new MultipleRecipientInfo(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendToIndividualRecipients(XMPPConnection connection, Packet packet,
|
private static void sendToIndividualRecipients(XMPPConnection connection, Stanza packet,
|
||||||
Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NotConnectedException {
|
Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NotConnectedException {
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
for (String jid : to) {
|
for (String jid : to) {
|
||||||
|
@ -220,7 +220,7 @@ public class MultipleRecipientManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendThroughService(XMPPConnection connection, Packet packet, Collection<String> to,
|
private static void sendThroughService(XMPPConnection connection, Stanza packet, Collection<String> to,
|
||||||
Collection<String> cc, Collection<String> bcc, String replyTo, String replyRoom, boolean noReply,
|
Collection<String> cc, Collection<String> bcc, String replyTo, String replyRoom, boolean noReply,
|
||||||
String serviceAddress) throws NotConnectedException {
|
String serviceAddress) throws NotConnectedException {
|
||||||
// Create multiple recipient extension
|
// Create multiple recipient extension
|
||||||
|
@ -289,7 +289,7 @@ public class MultipleRecipientManager {
|
||||||
* (i.e. cannot change the TO address of a queues packet to be sent) then this class was
|
* (i.e. cannot change the TO address of a queues packet to be sent) then this class was
|
||||||
* created to keep the XML stanza to send.
|
* created to keep the XML stanza to send.
|
||||||
*/
|
*/
|
||||||
private static class PacketCopy extends Packet {
|
private static class PacketCopy extends Stanza {
|
||||||
|
|
||||||
private CharSequence text;
|
private CharSequence text;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.filter.AndFilter;
|
import org.jivesoftware.smack.filter.AndFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class DataListener implements PacketListener {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
Data data = (Data) packet;
|
Data data = (Data) packet;
|
||||||
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
|
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
|
||||||
data.getDataPacketExtension().getSessionID());
|
data.getDataPacketExtension().getSessionID());
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||||
|
@ -447,7 +447,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
||||||
|
|
||||||
private long lastSequence = -1;
|
private long lastSequence = -1;
|
||||||
|
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
// get data packet extension
|
// get data packet extension
|
||||||
DataPacketExtension data = ((Data) packet).getDataPacketExtension();
|
DataPacketExtension data = ((Data) packet).getDataPacketExtension();
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
||||||
protected PacketListener getDataPacketListener() {
|
protected PacketListener getDataPacketListener() {
|
||||||
return new PacketListener() {
|
return new PacketListener() {
|
||||||
|
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
// get data packet extension
|
// get data packet extension
|
||||||
DataPacketExtension data = (DataPacketExtension) packet.getExtension(
|
DataPacketExtension data = (DataPacketExtension) packet.getExtension(
|
||||||
DataPacketExtension.ELEMENT,
|
DataPacketExtension.ELEMENT,
|
||||||
|
@ -553,7 +553,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
||||||
*/
|
*/
|
||||||
private class IBBDataPacketFilter implements PacketFilter {
|
private class IBBDataPacketFilter implements PacketFilter {
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
// sender equals remote peer
|
// sender equals remote peer
|
||||||
if (!packet.getFrom().equalsIgnoreCase(remoteJID)) {
|
if (!packet.getFrom().equalsIgnoreCase(remoteJID)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class InitiationListener extends AbstractIqRequestHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRequest(Packet packet) throws NotConnectedException {
|
private void processRequest(Stanza packet) throws NotConnectedException {
|
||||||
Open ibbRequest = (Open) packet;
|
Open ibbRequest = (Open) packet;
|
||||||
|
|
||||||
// validate that block size is within allowed range
|
// validate that block size is within allowed range
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRequest(Packet packet) throws NotConnectedException {
|
private void processRequest(Stanza packet) throws NotConnectedException {
|
||||||
Bytestream byteStreamRequest = (Bytestream) packet;
|
Bytestream byteStreamRequest = (Bytestream) packet;
|
||||||
|
|
||||||
// ignore request if in ignore list
|
// ignore request if in ignore list
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
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.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||||
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.BytestreamManager;
|
||||||
|
@ -480,7 +480,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
||||||
Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts);
|
Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts);
|
||||||
|
|
||||||
// send initiation packet
|
// send initiation packet
|
||||||
Packet response = connection.createPacketCollectorAndSend(initiation).nextResultOrThrow(
|
Stanza response = connection.createPacketCollectorAndSend(initiation).nextResultOrThrow(
|
||||||
getTargetResponseTimeout());
|
getTargetResponseTimeout());
|
||||||
|
|
||||||
// extract used stream host from response
|
// extract used stream host from response
|
||||||
|
|
|
@ -296,7 +296,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
||||||
Bytestream response = new Bytestream(this.bytestreamRequest.getSessionID());
|
Bytestream response = new Bytestream(this.bytestreamRequest.getSessionID());
|
||||||
response.setTo(this.bytestreamRequest.getFrom());
|
response.setTo(this.bytestreamRequest.getFrom());
|
||||||
response.setType(IQ.Type.result);
|
response.setType(IQ.Type.result);
|
||||||
response.setPacketID(this.bytestreamRequest.getPacketID());
|
response.setStanzaId(this.bytestreamRequest.getStanzaId());
|
||||||
response.setUsedHost(selectedHost.getJID());
|
response.setUsedHost(selectedHost.getJID());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
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.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.filter.NotFilter;
|
import org.jivesoftware.smack.filter.NotFilter;
|
||||||
|
@ -315,7 +315,7 @@ public 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(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
if (!entityCapsEnabled())
|
if (!entityCapsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ public class EntityCapsManager extends Manager {
|
||||||
|
|
||||||
connection.addAsyncPacketListener(new PacketListener() {
|
connection.addAsyncPacketListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
// always remove the JID from the map, even if entityCaps are
|
// always remove the JID from the map, even if entityCaps are
|
||||||
// disabled
|
// disabled
|
||||||
String from = packet.getFrom();
|
String from = packet.getFrom();
|
||||||
|
@ -338,7 +338,7 @@ public class EntityCapsManager extends Manager {
|
||||||
|
|
||||||
connection.addPacketSendingListener(new PacketListener() {
|
connection.addPacketSendingListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
presenceSend = true;
|
presenceSend = true;
|
||||||
}
|
}
|
||||||
}, PRESENCES);
|
}, PRESENCES);
|
||||||
|
@ -347,7 +347,7 @@ public 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.
|
||||||
PacketListener packetInterceptor = new PacketListener() {
|
PacketListener packetInterceptor = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
if (!entityCapsEnabled)
|
if (!entityCapsEnabled)
|
||||||
return;
|
return;
|
||||||
CapsVersionAndHash capsVersionAndHash = getCapsVersion();
|
CapsVersionAndHash capsVersionAndHash = getCapsVersion();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.caps.packet;
|
package org.jivesoftware.smackx.caps.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class CapsExtension implements PacketExtension {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CapsExtension from(Packet stanza) {
|
public static CapsExtension from(Stanza stanza) {
|
||||||
return stanza.getExtension(ELEMENT, NAMESPACE);
|
return stanza.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ public class AdHocCommandManager extends Manager {
|
||||||
// Creates the response with the corresponding data
|
// Creates the response with the corresponding data
|
||||||
AdHocCommandData response = new AdHocCommandData();
|
AdHocCommandData response = new AdHocCommandData();
|
||||||
response.setTo(requestData.getFrom());
|
response.setTo(requestData.getFrom());
|
||||||
response.setPacketID(requestData.getPacketID());
|
response.setStanzaId(requestData.getStanzaId());
|
||||||
response.setNode(requestData.getNode());
|
response.setNode(requestData.getNode());
|
||||||
response.setId(requestData.getTo());
|
response.setId(requestData.getTo());
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.delay;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||||
|
|
||||||
|
@ -38,24 +38,24 @@ public class DelayInformationManager {
|
||||||
/**
|
/**
|
||||||
* Get Delayed Delivery information as defined in XEP-203
|
* Get Delayed Delivery information as defined in XEP-203
|
||||||
* <p>
|
* <p>
|
||||||
* Prefer {@link #getDelayInformation(Packet)} over this method for backwards compatibility.
|
* Prefer {@link #getDelayInformation(Stanza)} over this method for backwards compatibility.
|
||||||
* </p>
|
* </p>
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the Delayed Delivery information or <code>null</code>
|
* @return the Delayed Delivery information or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public static DelayInformation getXep203DelayInformation(Packet packet) {
|
public static DelayInformation getXep203DelayInformation(Stanza packet) {
|
||||||
return DelayInformation.from(packet);
|
return DelayInformation.from(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Delayed Delivery information as defined in XEP-91
|
* Get Delayed Delivery information as defined in XEP-91
|
||||||
* <p>
|
* <p>
|
||||||
* Prefer {@link #getDelayInformation(Packet)} over this method for backwards compatibility.
|
* Prefer {@link #getDelayInformation(Stanza)} over this method for backwards compatibility.
|
||||||
* </p>
|
* </p>
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the Delayed Delivery information or <code>null</code>
|
* @return the Delayed Delivery information or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public static DelayInformation getLegacyDelayInformation(Packet packet) {
|
public static DelayInformation getLegacyDelayInformation(Stanza packet) {
|
||||||
return packet.getExtension(LEGACY_DELAYED_DELIVERY_ELEMENT, LEGACY_DELAYED_DELIVERY_NAMESPACE);
|
return packet.getExtension(LEGACY_DELAYED_DELIVERY_ELEMENT, LEGACY_DELAYED_DELIVERY_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class DelayInformationManager {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the Delayed Delivery information or <code>null</code>
|
* @return the Delayed Delivery information or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public static DelayInformation getDelayInformation(Packet packet) {
|
public static DelayInformation getDelayInformation(Stanza packet) {
|
||||||
DelayInformation delayInformation = getXep203DelayInformation(packet);
|
DelayInformation delayInformation = getXep203DelayInformation(packet);
|
||||||
if (delayInformation != null) {
|
if (delayInformation != null) {
|
||||||
return delayInformation;
|
return delayInformation;
|
||||||
|
@ -80,7 +80,7 @@ public class DelayInformationManager {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the Delayed Delivery timestamp or <code>null</code>
|
* @return the Delayed Delivery timestamp or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public static Date getDelayTimestamp(Packet packet) {
|
public static Date getDelayTimestamp(Stanza packet) {
|
||||||
DelayInformation delayInformation = getDelayInformation(packet);
|
DelayInformation delayInformation = getDelayInformation(packet);
|
||||||
if (delayInformation == null) {
|
if (delayInformation == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -94,7 +94,7 @@ public class DelayInformationManager {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return true if the stanza got delayed.
|
* @return true if the stanza got delayed.
|
||||||
*/
|
*/
|
||||||
public static boolean isDelayedStanza(Packet packet) {
|
public static boolean isDelayedStanza(Stanza packet) {
|
||||||
PacketExtension packetExtension = getDelayInformation(packet);
|
PacketExtension packetExtension = getDelayInformation(packet);
|
||||||
return packetExtension != null;
|
return packetExtension != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.delay.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.filter.NotFilter;
|
import org.jivesoftware.smack.filter.NotFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ public class DelayedStanzaFilter implements PacketFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
return DelayInformationManager.isDelayedStanza(packet);
|
return DelayInformationManager.isDelayedStanza(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.delay.packet;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
|
@ -111,10 +111,10 @@ public class DelayInformation implements PacketExtension {
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the DelayInformation or null
|
* @return the DelayInformation or null
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static DelayInformation getFrom(Packet packet) {
|
public static DelayInformation getFrom(Stanza packet) {
|
||||||
return from(packet);
|
return from(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class DelayInformation implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the DelayInformation or null
|
* @return the DelayInformation or null
|
||||||
*/
|
*/
|
||||||
public static DelayInformation from(Packet packet) {
|
public static DelayInformation from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smackx.caps.EntityCapsManager;
|
import org.jivesoftware.smackx.caps.EntityCapsManager;
|
||||||
|
@ -123,7 +123,7 @@ public class ServiceDiscoveryManager extends Manager {
|
||||||
DiscoverItems response = new DiscoverItems();
|
DiscoverItems response = new DiscoverItems();
|
||||||
response.setType(IQ.Type.result);
|
response.setType(IQ.Type.result);
|
||||||
response.setTo(discoverItems.getFrom());
|
response.setTo(discoverItems.getFrom());
|
||||||
response.setPacketID(discoverItems.getPacketID());
|
response.setStanzaId(discoverItems.getStanzaId());
|
||||||
response.setNode(discoverItems.getNode());
|
response.setNode(discoverItems.getNode());
|
||||||
|
|
||||||
// Add the defined items related to the requested node. Look for
|
// Add the defined items related to the requested node. Look for
|
||||||
|
@ -154,7 +154,7 @@ public class ServiceDiscoveryManager extends Manager {
|
||||||
DiscoverInfo response = new DiscoverInfo();
|
DiscoverInfo response = new DiscoverInfo();
|
||||||
response.setType(IQ.Type.result);
|
response.setType(IQ.Type.result);
|
||||||
response.setTo(discoverInfo.getFrom());
|
response.setTo(discoverInfo.getFrom());
|
||||||
response.setPacketID(discoverInfo.getPacketID());
|
response.setStanzaId(discoverInfo.getStanzaId());
|
||||||
response.setNode(discoverInfo.getNode());
|
response.setNode(discoverInfo.getNode());
|
||||||
// Add the client's identity and features only if "node" is null
|
// Add the client's identity and features only if "node" is null
|
||||||
// and if the request was not send to a node. If Entity Caps are
|
// and if the request was not send to a node. If Entity Caps are
|
||||||
|
@ -528,7 +528,7 @@ public class ServiceDiscoveryManager extends Manager {
|
||||||
disco.setTo(entityID);
|
disco.setTo(entityID);
|
||||||
disco.setNode(node);
|
disco.setNode(node);
|
||||||
|
|
||||||
Packet result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
||||||
|
|
||||||
return (DiscoverInfo) result;
|
return (DiscoverInfo) result;
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ public class ServiceDiscoveryManager extends Manager {
|
||||||
disco.setTo(entityID);
|
disco.setTo(entityID);
|
||||||
disco.setNode(node);
|
disco.setNode(node);
|
||||||
|
|
||||||
Packet result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
Stanza result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();
|
||||||
return (DiscoverItems) result;
|
return (DiscoverItems) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.filter.OrFilter;
|
import org.jivesoftware.smack.filter.OrFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
||||||
return new OrFilter(primaryFilter, secondaryFilter);
|
return new OrFilter(primaryFilter, secondaryFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream negotiateIncomingStream(Packet streamInitiation) {
|
InputStream negotiateIncomingStream(Stanza streamInitiation) {
|
||||||
throw new UnsupportedOperationException("Negotiation only handled by create incoming " +
|
throw new UnsupportedOperationException("Negotiation only handled by create incoming " +
|
||||||
"stream method.");
|
"stream method.");
|
||||||
}
|
}
|
||||||
|
|
||||||
final Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) {
|
final Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) {
|
||||||
throw new UnsupportedOperationException("Initiation handled by createIncomingStream " +
|
throw new UnsupportedOperationException("Initiation handled by createIncomingStream " +
|
||||||
"method");
|
"method");
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StreamNegotiator determineNegotiator(Packet streamInitiation) {
|
private StreamNegotiator determineNegotiator(Stanza streamInitiation) {
|
||||||
return primaryFilter.accept(streamInitiation) ? primaryNegotiator : secondaryNegotiator;
|
return primaryFilter.accept(streamInitiation) ? primaryNegotiator : secondaryNegotiator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream call() throws XMPPErrorException, InterruptedException, SmackException {
|
public InputStream call() throws XMPPErrorException, InterruptedException, SmackException {
|
||||||
Packet streamInitiation = collector.nextResult();
|
Stanza streamInitiation = collector.nextResult();
|
||||||
if (streamInitiation == null) {
|
if (streamInitiation == null) {
|
||||||
throw new NoResponseException(connection);
|
throw new NoResponseException(connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
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.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||||
|
@ -317,7 +317,7 @@ public class FileTransferNegotiator extends Manager {
|
||||||
si.setTo(userID);
|
si.setTo(userID);
|
||||||
si.setType(IQ.Type.set);
|
si.setType(IQ.Type.set);
|
||||||
|
|
||||||
Packet siResponse = connection().createPacketCollectorAndSend(si).nextResultOrThrow(
|
Stanza siResponse = connection().createPacketCollectorAndSend(si).nextResultOrThrow(
|
||||||
responseTimeout);
|
responseTimeout);
|
||||||
|
|
||||||
if (siResponse instanceof IQ) {
|
if (siResponse instanceof IQ) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession;
|
||||||
|
@ -77,7 +77,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
*/
|
*/
|
||||||
this.manager.ignoreBytestreamRequestOnce(initiation.getSessionID());
|
this.manager.ignoreBytestreamRequestOnce(initiation.getSessionID());
|
||||||
|
|
||||||
Packet streamInitiation = initiateIncomingStream(this.connection, initiation);
|
Stanza streamInitiation = initiateIncomingStream(this.connection, initiation);
|
||||||
return negotiateIncomingStream(streamInitiation);
|
return negotiateIncomingStream(streamInitiation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
return new String[] { DataPacketExtension.NAMESPACE };
|
return new String[] { DataPacketExtension.NAMESPACE };
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream negotiateIncomingStream(Packet streamInitiation) throws NotConnectedException {
|
InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException {
|
||||||
// build In-Band Bytestream request
|
// build In-Band Bytestream request
|
||||||
InBandBytestreamRequest request = new ByteStreamRequest(this.manager,
|
InBandBytestreamRequest request = new ByteStreamRequest(this.manager,
|
||||||
(Open) streamInitiation);
|
(Open) streamInitiation);
|
||||||
|
@ -123,7 +123,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
||||||
this.sessionID = sessionID;
|
this.sessionID = sessionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
if (super.accept(packet)) {
|
if (super.accept(packet)) {
|
||||||
Open bytestream = (Open) packet;
|
Open bytestream = (Open) packet;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest;
|
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest;
|
||||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
||||||
|
@ -79,7 +79,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
||||||
*/
|
*/
|
||||||
this.manager.ignoreBytestreamRequestOnce(initiation.getSessionID());
|
this.manager.ignoreBytestreamRequestOnce(initiation.getSessionID());
|
||||||
|
|
||||||
Packet streamInitiation = initiateIncomingStream(this.connection, initiation);
|
Stanza streamInitiation = initiateIncomingStream(this.connection, initiation);
|
||||||
return negotiateIncomingStream(streamInitiation);
|
return negotiateIncomingStream(streamInitiation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
InputStream negotiateIncomingStream(Packet streamInitiation) throws InterruptedException,
|
InputStream negotiateIncomingStream(Stanza streamInitiation) throws InterruptedException,
|
||||||
SmackException, XMPPErrorException {
|
SmackException, XMPPErrorException {
|
||||||
// build SOCKS5 Bytestream request
|
// build SOCKS5 Bytestream request
|
||||||
Socks5BytestreamRequest request = new ByteStreamRequest(this.manager,
|
Socks5BytestreamRequest request = new ByteStreamRequest(this.manager,
|
||||||
|
@ -138,7 +138,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
if (super.accept(packet)) {
|
if (super.accept(packet)) {
|
||||||
Bytestream bytestream = (Bytestream) packet;
|
Bytestream bytestream = (Bytestream) packet;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
import org.jivesoftware.smackx.si.packet.StreamInitiation;
|
||||||
import org.jivesoftware.smackx.xdata.FormField;
|
import org.jivesoftware.smackx.xdata.FormField;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
|
@ -58,7 +58,7 @@ public abstract class StreamNegotiator {
|
||||||
response.setTo(streamInitiationOffer.getFrom());
|
response.setTo(streamInitiationOffer.getFrom());
|
||||||
response.setFrom(streamInitiationOffer.getTo());
|
response.setFrom(streamInitiationOffer.getTo());
|
||||||
response.setType(IQ.Type.result);
|
response.setType(IQ.Type.result);
|
||||||
response.setPacketID(streamInitiationOffer.getPacketID());
|
response.setStanzaId(streamInitiationOffer.getStanzaId());
|
||||||
|
|
||||||
DataForm form = new DataForm(DataForm.Type.submit);
|
DataForm form = new DataForm(DataForm.Type.submit);
|
||||||
FormField field = new FormField(
|
FormField field = new FormField(
|
||||||
|
@ -72,7 +72,7 @@ public abstract class StreamNegotiator {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||||
StreamInitiation response = createInitiationAccept(initiation,
|
StreamInitiation response = createInitiationAccept(initiation,
|
||||||
getNamespaces());
|
getNamespaces());
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public abstract class StreamNegotiator {
|
||||||
PacketCollector collector = connection
|
PacketCollector collector = connection
|
||||||
.createPacketCollectorAndSend(getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()), response);
|
.createPacketCollectorAndSend(getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()), response);
|
||||||
|
|
||||||
Packet streamMethodInitiation = collector.nextResultOrThrow();
|
Stanza streamMethodInitiation = collector.nextResultOrThrow();
|
||||||
|
|
||||||
return streamMethodInitiation;
|
return streamMethodInitiation;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public abstract class StreamNegotiator {
|
||||||
public abstract PacketFilter getInitiationPacketFilter(String from, String streamID);
|
public abstract PacketFilter getInitiationPacketFilter(String from, String streamID);
|
||||||
|
|
||||||
|
|
||||||
abstract InputStream negotiateIncomingStream(Packet streamInitiation) throws XMPPErrorException,
|
abstract InputStream negotiateIncomingStream(Stanza streamInitiation) throws XMPPErrorException,
|
||||||
InterruptedException, NoResponseException, SmackException;
|
InterruptedException, NoResponseException, SmackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.forward.packet;
|
package org.jivesoftware.smackx.forward.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||||
|
@ -32,7 +32,7 @@ public class Forwarded implements PacketExtension {
|
||||||
public static final String ELEMENT = "forwarded";
|
public static final String ELEMENT = "forwarded";
|
||||||
|
|
||||||
private final DelayInformation delay;
|
private final DelayInformation delay;
|
||||||
private final Packet forwardedPacket;
|
private final Stanza forwardedPacket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Forwarded packet extension.
|
* Creates a new Forwarded packet extension.
|
||||||
|
@ -40,7 +40,7 @@ public class Forwarded implements PacketExtension {
|
||||||
* @param delay an optional {@link DelayInformation} timestamp of the packet.
|
* @param delay an optional {@link DelayInformation} timestamp of the packet.
|
||||||
* @param fwdPacket the packet that is forwarded (required).
|
* @param fwdPacket the packet that is forwarded (required).
|
||||||
*/
|
*/
|
||||||
public Forwarded(DelayInformation delay, Packet fwdPacket) {
|
public Forwarded(DelayInformation delay, Stanza fwdPacket) {
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
this.forwardedPacket = fwdPacket;
|
this.forwardedPacket = fwdPacket;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class Forwarded implements PacketExtension {
|
||||||
*
|
*
|
||||||
* @param fwdPacket the packet that is forwarded (required).
|
* @param fwdPacket the packet that is forwarded (required).
|
||||||
*/
|
*/
|
||||||
public Forwarded(Packet fwdPacket) {
|
public Forwarded(Stanza fwdPacket) {
|
||||||
this(null, fwdPacket);
|
this(null, fwdPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ public class Forwarded implements PacketExtension {
|
||||||
/**
|
/**
|
||||||
* get the packet forwarded by this stanza.
|
* get the packet forwarded by this stanza.
|
||||||
*
|
*
|
||||||
* @return the {@link Packet} instance (typically a message) that was forwarded.
|
* @return the {@link Stanza} instance (typically a message) that was forwarded.
|
||||||
*/
|
*/
|
||||||
public Packet getForwardedPacket() {
|
public Stanza getForwardedPacket() {
|
||||||
return forwardedPacket;
|
return forwardedPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class Forwarded implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the Forwarded extension or null
|
* @return the Forwarded extension or null
|
||||||
*/
|
*/
|
||||||
public static Forwarded from(Packet packet) {
|
public static Forwarded from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||||
|
@ -43,7 +43,7 @@ public class ForwardedProvider extends PacketExtensionProvider<Forwarded> {
|
||||||
@Override
|
@Override
|
||||||
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
|
||||||
DelayInformation di = null;
|
DelayInformation di = null;
|
||||||
Packet packet = null;
|
Stanza packet = null;
|
||||||
|
|
||||||
outerloop: while (true) {
|
outerloop: while (true) {
|
||||||
int eventType = parser.next();
|
int eventType = parser.next();
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
||||||
|
@ -135,7 +135,7 @@ public 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 PacketListener() {
|
connection.addPacketSendingListener(new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(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;
|
||||||
|
@ -153,7 +153,7 @@ public class LastActivityManager extends Manager {
|
||||||
|
|
||||||
connection.addPacketSendingListener(new PacketListener() {
|
connection.addPacketSendingListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(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;
|
||||||
|
@ -172,7 +172,7 @@ public class LastActivityManager extends Manager {
|
||||||
message.setType(IQ.Type.result);
|
message.setType(IQ.Type.result);
|
||||||
message.setTo(iqRequest.getFrom());
|
message.setTo(iqRequest.getFrom());
|
||||||
message.setFrom(iqRequest.getTo());
|
message.setFrom(iqRequest.getTo());
|
||||||
message.setPacketID(iqRequest.getPacketID());
|
message.setStanzaId(iqRequest.getStanzaId());
|
||||||
message.setLastActivity(getIdleTime());
|
message.setLastActivity(getIdleTime());
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
|
|
|
@ -290,7 +290,7 @@ public class AccountManager extends Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException {
|
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException {
|
||||||
PacketCollector collector = connection().createPacketCollectorAndSend(new PacketIDFilter(req.getPacketID()), req);
|
PacketCollector collector = connection().createPacketCollectorAndSend(new PacketIDFilter(req.getStanzaId()), req);
|
||||||
return collector;
|
return collector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.iqversion.packet;
|
||||||
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
||||||
*
|
*
|
||||||
* // Create a packet collector to listen for a response.
|
* // Create a packet collector to listen for a response.
|
||||||
* PacketCollector collector = con.createPacketCollector(
|
* PacketCollector collector = con.createPacketCollector(
|
||||||
* new PacketIDFilter(versionRequest.getPacketID()));
|
* new PacketIDFilter(versionRequest.getStanzaId()));
|
||||||
*
|
*
|
||||||
* con.sendPacket(versionRequest);
|
* con.sendPacket(versionRequest);
|
||||||
*
|
*
|
||||||
|
@ -147,9 +147,9 @@ public class Version extends IQ {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Version createResultFor(Packet request, Version version) {
|
public static Version createResultFor(Stanza request, Version version) {
|
||||||
Version result = new Version(version);
|
Version result = new Version(version);
|
||||||
result.setPacketID(request.getPacketID());
|
result.setStanzaId(request.getStanzaId());
|
||||||
result.setTo(request.getFrom());
|
result.setTo(request.getFrom());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
|
import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
|
||||||
|
|
||||||
public class JivePropertiesManager {
|
public class JivePropertiesManager {
|
||||||
|
@ -53,7 +53,7 @@ public class JivePropertiesManager {
|
||||||
* @param name the name of the property to add.
|
* @param name the name of the property to add.
|
||||||
* @param value the value of the property to add.
|
* @param value the value of the property to add.
|
||||||
*/
|
*/
|
||||||
public static void addProperty(Packet packet, String name, Object value) {
|
public static void addProperty(Stanza packet, String name, Object value) {
|
||||||
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
||||||
if (jpe == null) {
|
if (jpe == null) {
|
||||||
jpe = new JivePropertiesExtension();
|
jpe = new JivePropertiesExtension();
|
||||||
|
@ -70,7 +70,7 @@ public class JivePropertiesManager {
|
||||||
* @param name
|
* @param name
|
||||||
* @return the property or <tt>null</tt> if none found.
|
* @return the property or <tt>null</tt> if none found.
|
||||||
*/
|
*/
|
||||||
public static Object getProperty(Packet packet, String name) {
|
public static Object getProperty(Stanza packet, String name) {
|
||||||
Object res = null;
|
Object res = null;
|
||||||
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
||||||
if (jpe != null) {
|
if (jpe != null) {
|
||||||
|
@ -86,7 +86,7 @@ public class JivePropertiesManager {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return a collection of the names of all properties.
|
* @return a collection of the names of all properties.
|
||||||
*/
|
*/
|
||||||
public static Collection<String> getPropertiesNames(Packet packet) {
|
public static Collection<String> getPropertiesNames(Stanza packet) {
|
||||||
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
||||||
if (jpe == null) {
|
if (jpe == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -101,7 +101,7 @@ public class JivePropertiesManager {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return a map of all properties of the given packet.
|
* @return a map of all properties of the given packet.
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> getProperties(Packet packet) {
|
public static Map<String, Object> getProperties(Stanza packet) {
|
||||||
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
|
||||||
if (jpe == null) {
|
if (jpe == null) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.ToFilter;
|
import org.jivesoftware.smack.filter.ToFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
@ -136,7 +136,7 @@ public class MultiUserChat {
|
||||||
|
|
||||||
messageListener = new PacketListener() {
|
messageListener = new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(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);
|
||||||
|
@ -146,7 +146,7 @@ public class MultiUserChat {
|
||||||
|
|
||||||
// Create a listener for subject updates.
|
// Create a listener for subject updates.
|
||||||
subjectListener = new PacketListener() {
|
subjectListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
Message msg = (Message) packet;
|
Message msg = (Message) packet;
|
||||||
// Update the room subject
|
// Update the room subject
|
||||||
subject = msg.getSubject();
|
subject = msg.getSubject();
|
||||||
|
@ -159,7 +159,7 @@ public class MultiUserChat {
|
||||||
|
|
||||||
// Create a listener for all presence updates.
|
// Create a listener for all presence updates.
|
||||||
presenceListener = new PacketListener() {
|
presenceListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
Presence presence = (Presence) packet;
|
Presence presence = (Presence) packet;
|
||||||
String from = presence.getFrom();
|
String from = presence.getFrom();
|
||||||
String myRoomJID = MultiUserChat.this.room + "/" + nickname;
|
String myRoomJID = MultiUserChat.this.room + "/" + nickname;
|
||||||
|
@ -225,7 +225,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 PacketListener() {
|
declinesListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
// Get the MUC User extension
|
// Get the MUC User extension
|
||||||
MUCUser mucUser = MUCUser.from(packet);
|
MUCUser mucUser = MUCUser.from(packet);
|
||||||
// Check if the MUCUser informs that the invitee has declined the invitation
|
// Check if the MUCUser informs that the invitee has declined the invitation
|
||||||
|
@ -239,7 +239,7 @@ public class MultiUserChat {
|
||||||
|
|
||||||
presenceInterceptor = new PacketListener() {
|
presenceInterceptor = new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
Presence presence = (Presence) packet;
|
Presence presence = (Presence) packet;
|
||||||
for (PresenceListener interceptor : presenceInterceptors) {
|
for (PresenceListener interceptor : presenceInterceptors) {
|
||||||
interceptor.processPresence(presence);
|
interceptor.processPresence(presence);
|
||||||
|
@ -1709,7 +1709,7 @@ public class MultiUserChat {
|
||||||
// Wait for an error or confirmation message back from the server.
|
// Wait for an error or confirmation message back from the server.
|
||||||
PacketFilter responseFilter = new AndFilter(fromRoomGroupchatFilter, new PacketFilter() {
|
PacketFilter responseFilter = new AndFilter(fromRoomGroupchatFilter, new PacketFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
Message msg = (Message) packet;
|
Message msg = (Message) packet;
|
||||||
return subject.equals(msg.getSubject());
|
return subject.equals(msg.getSubject());
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.NotFilter;
|
import org.jivesoftware.smack.filter.NotFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -118,7 +118,7 @@ public 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.
|
||||||
PacketListener invitationPacketListener = new PacketListener() {
|
PacketListener invitationPacketListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(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);
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.muc.packet;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -112,10 +112,10 @@ public class GroupChatInvitation implements PacketExtension {
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the GroupChatInvitation or null
|
* @return the GroupChatInvitation or null
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static GroupChatInvitation getFrom(Packet packet) {
|
public static GroupChatInvitation getFrom(Stanza packet) {
|
||||||
return from(packet);
|
return from(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class GroupChatInvitation implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the GroupChatInvitation or null
|
* @return the GroupChatInvitation or null
|
||||||
*/
|
*/
|
||||||
public static GroupChatInvitation from(Packet packet) {
|
public static GroupChatInvitation from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smackx.muc.packet;
|
package org.jivesoftware.smackx.muc.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
|
@ -108,10 +108,10 @@ public class MUCInitialPresence implements PacketExtension {
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the MUCInitialPresence PacketExtension or {@code null}
|
* @return the MUCInitialPresence PacketExtension or {@code null}
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static MUCInitialPresence getFrom(Packet packet) {
|
public static MUCInitialPresence getFrom(Stanza packet) {
|
||||||
return from(packet);
|
return from(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public class MUCInitialPresence implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the MUCInitialPresence PacketExtension or {@code null}
|
* @return the MUCInitialPresence PacketExtension or {@code null}
|
||||||
*/
|
*/
|
||||||
public static MUCInitialPresence from(Packet packet) {
|
public static MUCInitialPresence from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smackx.muc.packet;
|
package org.jivesoftware.smackx.muc.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -204,10 +204,10 @@ public class MUCUser implements PacketExtension {
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the MUCUser PacketExtension or {@code null}
|
* @return the MUCUser PacketExtension or {@code null}
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static MUCUser getFrom(Packet packet) {
|
public static MUCUser getFrom(Stanza packet) {
|
||||||
return from(packet);
|
return from(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class MUCUser implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the MUCUser PacketExtension or {@code null}
|
* @return the MUCUser PacketExtension or {@code null}
|
||||||
*/
|
*/
|
||||||
public static MUCUser from(Packet packet) {
|
public static MUCUser from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||||
|
@ -147,7 +147,7 @@ public class OfflineMessageManager {
|
||||||
}
|
}
|
||||||
// Filter offline messages that were requested by this request
|
// Filter offline messages that were requested by this request
|
||||||
PacketFilter messageFilter = new AndFilter(PACKET_FILTER, new PacketFilter() {
|
PacketFilter messageFilter = new AndFilter(PACKET_FILTER, new PacketFilter() {
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Stanza packet) {
|
||||||
OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline",
|
OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline",
|
||||||
namespace);
|
namespace);
|
||||||
return nodes.contains(info.getNode());
|
return nodes.contains(info.getNode());
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smackx.pep.packet.PEPEvent;
|
import org.jivesoftware.smackx.pep.packet.PEPEvent;
|
||||||
import org.jivesoftware.smackx.pep.packet.PEPItem;
|
import org.jivesoftware.smackx.pep.packet.PEPItem;
|
||||||
|
@ -135,7 +135,7 @@ public class PEPManager {
|
||||||
private void init() {
|
private void init() {
|
||||||
// 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 PacketListener() {
|
packetListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Stanza packet) {
|
||||||
Message message = (Message) packet;
|
Message message = (Message) packet;
|
||||||
PEPEvent event = (PEPEvent) message.getExtension("event", "http://jabber.org/protocol/pubsub#event");
|
PEPEvent event = (PEPEvent) message.getExtension("event", "http://jabber.org/protocol/pubsub#event");
|
||||||
// Fire event for roster exchange listeners
|
// Fire event for roster exchange listeners
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.privacy.filter.SetActiveListFilter;
|
import org.jivesoftware.smackx.privacy.filter.SetActiveListFilter;
|
||||||
import org.jivesoftware.smackx.privacy.filter.SetDefaultListFilter;
|
import org.jivesoftware.smackx.privacy.filter.SetDefaultListFilter;
|
||||||
|
@ -125,7 +125,7 @@ public class PrivacyListManager extends Manager {
|
||||||
// cached(Active|Default)ListName handling
|
// cached(Active|Default)ListName handling
|
||||||
connection.addPacketSendingListener(new PacketListener() {
|
connection.addPacketSendingListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
XMPPConnection connection = connection();
|
XMPPConnection connection = connection();
|
||||||
Privacy privacy = (Privacy) packet;
|
Privacy privacy = (Privacy) packet;
|
||||||
PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
||||||
|
@ -133,7 +133,7 @@ public class PrivacyListManager extends Manager {
|
||||||
final boolean declinceActiveList = privacy.isDeclineActiveList();
|
final boolean declinceActiveList = privacy.isDeclineActiveList();
|
||||||
connection.addOneTimeSyncCallback(new PacketListener() {
|
connection.addOneTimeSyncCallback(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
if (declinceActiveList) {
|
if (declinceActiveList) {
|
||||||
cachedActiveListName = null;
|
cachedActiveListName = null;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class PrivacyListManager extends Manager {
|
||||||
}, SetActiveListFilter.INSTANCE);
|
}, SetActiveListFilter.INSTANCE);
|
||||||
connection.addPacketSendingListener(new PacketListener() {
|
connection.addPacketSendingListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
XMPPConnection connection = connection();
|
XMPPConnection connection = connection();
|
||||||
Privacy privacy = (Privacy) packet;
|
Privacy privacy = (Privacy) packet;
|
||||||
PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection);
|
||||||
|
@ -155,7 +155,7 @@ public class PrivacyListManager extends Manager {
|
||||||
final boolean declinceDefaultList = privacy.isDeclineDefaultList();
|
final boolean declinceDefaultList = privacy.isDeclineDefaultList();
|
||||||
connection.addOneTimeSyncCallback(new PacketListener() {
|
connection.addOneTimeSyncCallback(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
if (declinceDefaultList) {
|
if (declinceDefaultList) {
|
||||||
cachedDefaultListName = null;
|
cachedDefaultListName = null;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class PrivacyListManager extends Manager {
|
||||||
}, SetDefaultListFilter.INSTANCE);
|
}, SetDefaultListFilter.INSTANCE);
|
||||||
connection.addSyncPacketListener(new PacketListener() {
|
connection.addSyncPacketListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(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.
|
||||||
|
@ -243,7 +243,7 @@ public class PrivacyListManager extends Manager {
|
||||||
* @throws NoResponseException
|
* @throws NoResponseException
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
private Packet setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
private Stanza setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||||
// The request is a get iq type
|
// The request is a get iq type
|
||||||
requestPrivacy.setType(Privacy.Type.set);
|
requestPrivacy.setType(Privacy.Type.set);
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface defines {@link PacketExtension} implementations that contain other
|
* This interface defines {@link PacketExtension} implementations that contain other
|
||||||
* extensions. This effectively extends the idea of an extension within one of the
|
* extensions. This effectively extends the idea of an extension within one of the
|
||||||
* top level {@link Packet} types to consider any embedded element to be an extension
|
* top level {@link Stanza} types to consider any embedded element to be an extension
|
||||||
* of its parent. This more easily enables the usage of some of Smacks parsing
|
* of its parent. This more easily enables the usage of some of Smacks parsing
|
||||||
* utilities such as {@link PacketParserUtils#parsePacketExtension(String, String, org.xmlpull.v1.XmlPullParser)} to be used
|
* utilities such as {@link PacketParserUtils#parsePacketExtension(String, String, org.xmlpull.v1.XmlPullParser)} to be used
|
||||||
* to parse any element of the XML being parsed.
|
* to parse any element of the XML being parsed.
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.filter.OrFilter;
|
import org.jivesoftware.smack.filter.OrFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
||||||
|
@ -100,7 +100,7 @@ abstract public class Node
|
||||||
{
|
{
|
||||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(
|
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(
|
||||||
PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER);
|
PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER);
|
||||||
Packet reply = sendPubsubPacket(pubSub);
|
Stanza reply = sendPubsubPacket(pubSub);
|
||||||
return NodeUtils.getFormFromPacket(reply, PubSubElementType.CONFIGURE_OWNER);
|
return NodeUtils.getFormFromPacket(reply, PubSubElementType.CONFIGURE_OWNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ abstract public class Node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static List<String> getSubscriptionIds(Packet packet)
|
private static List<String> getSubscriptionIds(Stanza packet)
|
||||||
{
|
{
|
||||||
HeadersExtension headers = (HeadersExtension)packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
HeadersExtension headers = (HeadersExtension)packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
||||||
List<String> values = null;
|
List<String> values = null;
|
||||||
|
@ -526,7 +526,7 @@ abstract public class Node
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public void processPacket(Packet packet)
|
public void processPacket(Stanza packet)
|
||||||
{
|
{
|
||||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||||
ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
|
ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
|
||||||
|
@ -550,7 +550,7 @@ abstract public class Node
|
||||||
listener = eventListener;
|
listener = eventListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPacket(Packet packet)
|
public void processPacket(Stanza packet)
|
||||||
{
|
{
|
||||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ abstract public class Node
|
||||||
listener = eventListener;
|
listener = eventListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPacket(Packet packet)
|
public void processPacket(Stanza packet)
|
||||||
{
|
{
|
||||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||||
ConfigurationEvent config = (ConfigurationEvent)event.getEvent();
|
ConfigurationEvent config = (ConfigurationEvent)event.getEvent();
|
||||||
|
@ -624,7 +624,7 @@ abstract public class Node
|
||||||
secondElement = secondLevelElement;
|
secondElement = secondLevelElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet)
|
public boolean accept(Stanza packet)
|
||||||
{
|
{
|
||||||
if (!(packet instanceof Message))
|
if (!(packet instanceof Message))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -233,7 +233,7 @@ final public class PubSubManager
|
||||||
*/
|
*/
|
||||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
|
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||||
{
|
{
|
||||||
Packet reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null);
|
Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null);
|
||||||
SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
|
SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
|
||||||
return subElem.getSubscriptions();
|
return subElem.getSubscriptions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub.util;
|
package org.jivesoftware.smackx.pubsub.util;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.pubsub.ConfigureForm;
|
import org.jivesoftware.smackx.pubsub.ConfigureForm;
|
||||||
import org.jivesoftware.smackx.pubsub.FormNode;
|
import org.jivesoftware.smackx.pubsub.FormNode;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
||||||
|
@ -36,7 +36,7 @@ public class NodeUtils
|
||||||
* @param elem
|
* @param elem
|
||||||
* @return The configuration form
|
* @return The configuration form
|
||||||
*/
|
*/
|
||||||
public static ConfigureForm getFormFromPacket(Packet packet, PubSubElementType elem)
|
public static ConfigureForm getFormFromPacket(Stanza packet, PubSubElementType elem)
|
||||||
{
|
{
|
||||||
FormNode config = packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
|
FormNode config = packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||||
Form formReply = config.getForm();
|
Form formReply = config.getForm();
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.receipts;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -76,10 +76,10 @@ public class DeliveryReceipt implements PacketExtension
|
||||||
*
|
*
|
||||||
* @param p the packet
|
* @param p the packet
|
||||||
* @return the {@link DeliveryReceipt} extension or {@code null}
|
* @return the {@link DeliveryReceipt} extension or {@code null}
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static DeliveryReceipt getFrom(Packet p) {
|
public static DeliveryReceipt getFrom(Stanza p) {
|
||||||
return from(p);
|
return from(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class DeliveryReceipt implements PacketExtension
|
||||||
* @param packet the packet
|
* @param packet the packet
|
||||||
* @return the {@link DeliveryReceipt} extension or {@code null}
|
* @return the {@link DeliveryReceipt} extension or {@code null}
|
||||||
*/
|
*/
|
||||||
public static DeliveryReceipt from(Packet packet) {
|
public static DeliveryReceipt from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.roster.Roster;
|
import org.jivesoftware.smack.roster.Roster;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public class DeliveryReceiptManager extends Manager {
|
||||||
// Add the packet listener to handling incoming delivery receipts
|
// Add the packet listener to handling incoming delivery receipts
|
||||||
connection.addAsyncPacketListener(new PacketListener() {
|
connection.addAsyncPacketListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
DeliveryReceipt dr = DeliveryReceipt.from(packet);
|
DeliveryReceipt dr = DeliveryReceipt.from(packet);
|
||||||
// notify listeners of incoming receipt
|
// notify listeners of incoming receipt
|
||||||
for (ReceiptReceivedListener l : receiptReceivedListeners) {
|
for (ReceiptReceivedListener l : receiptReceivedListeners) {
|
||||||
|
@ -141,7 +141,7 @@ public 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.addAsyncPacketListener(new PacketListener() {
|
connection.addAsyncPacketListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
final String from = packet.getFrom();
|
final String from = packet.getFrom();
|
||||||
final XMPPConnection connection = connection();
|
final XMPPConnection connection = connection();
|
||||||
switch (autoReceiptMode) {
|
switch (autoReceiptMode) {
|
||||||
|
@ -157,7 +157,7 @@ public class DeliveryReceiptManager extends Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
Message ack = new Message(from, Message.Type.normal);
|
Message ack = new Message(from, Message.Type.normal);
|
||||||
ack.addExtension(new DeliveryReceipt(packet.getPacketID()));
|
ack.addExtension(new DeliveryReceipt(packet.getStanzaId()));
|
||||||
connection.sendPacket(ack);
|
connection.sendPacket(ack);
|
||||||
}
|
}
|
||||||
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
||||||
|
@ -234,7 +234,7 @@ public class DeliveryReceiptManager extends Manager {
|
||||||
|
|
||||||
private static final PacketListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new PacketListener() {
|
private static final PacketListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Packet packet) throws NotConnectedException {
|
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||||
Message message = (Message) packet;
|
Message message = (Message) packet;
|
||||||
DeliveryReceiptRequest.addTo(message);
|
DeliveryReceiptRequest.addTo(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.receipts;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.packet.id.StanzaIdUtil;
|
import org.jivesoftware.smack.packet.id.StanzaIdUtil;
|
||||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||||
|
@ -56,10 +56,10 @@ public class DeliveryReceiptRequest implements PacketExtension
|
||||||
*
|
*
|
||||||
* @param p the packet
|
* @param p the packet
|
||||||
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
||||||
* @deprecated use {@link #from(Packet)} instead
|
* @deprecated use {@link #from(Stanza)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static DeliveryReceiptRequest getFrom(Packet p) {
|
public static DeliveryReceiptRequest getFrom(Stanza p) {
|
||||||
return from(p);
|
return from(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class DeliveryReceiptRequest implements PacketExtension
|
||||||
* @param packet the packet
|
* @param packet the packet
|
||||||
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
||||||
*/
|
*/
|
||||||
public static DeliveryReceiptRequest from(Packet packet) {
|
public static DeliveryReceiptRequest from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, DeliveryReceipt.NAMESPACE);
|
return packet.getExtension(ELEMENT, DeliveryReceipt.NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,11 +83,11 @@ public class DeliveryReceiptRequest implements PacketExtension
|
||||||
* @return the Message ID which will be used as receipt ID
|
* @return the Message ID which will be used as receipt ID
|
||||||
*/
|
*/
|
||||||
public static String addTo(Message message) {
|
public static String addTo(Message message) {
|
||||||
if (message.getPacketID() == null) {
|
if (message.getStanzaId() == null) {
|
||||||
message.setPacketID(StanzaIdUtil.newStanzaId());
|
message.setStanzaId(StanzaIdUtil.newStanzaId());
|
||||||
}
|
}
|
||||||
message.addExtension(new DeliveryReceiptRequest());
|
message.addExtension(new DeliveryReceiptRequest());
|
||||||
return message.getPacketID();
|
return message.getStanzaId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.receipts;
|
package org.jivesoftware.smackx.receipts;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for received receipt notifications.
|
* Interface for received receipt notifications.
|
||||||
|
@ -28,7 +28,7 @@ public interface ReceiptReceivedListener {
|
||||||
* Callback invoked when a new receipt got received.
|
* Callback invoked when a new receipt got received.
|
||||||
* <p>
|
* <p>
|
||||||
* {@code receiptId} correspondents to the message ID, which can be obtained with
|
* {@code receiptId} correspondents to the message ID, which can be obtained with
|
||||||
* {@link org.jivesoftware.smack.packet.Packet#getPacketID()}.
|
* {@link org.jivesoftware.smack.packet.Stanza#getStanzaId()}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param fromJid the jid that send this receipt
|
* @param fromJid the jid that send this receipt
|
||||||
|
@ -36,5 +36,5 @@ public interface ReceiptReceivedListener {
|
||||||
* @param receiptId the message ID of the packet which has been received and this receipt is for
|
* @param receiptId the message ID of the packet which has been received and this receipt is for
|
||||||
* @param receipt the receipt
|
* @param receipt the receipt
|
||||||
*/
|
*/
|
||||||
void onReceiptReceived(String fromJid, String toJid, String receiptId, Packet receipt);
|
void onReceiptReceived(String fromJid, String toJid, String receiptId, Stanza receipt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.rsm.packet;
|
package org.jivesoftware.smackx.rsm.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class RSMSet implements PacketExtension {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RSMSet from(Packet packet) {
|
public static RSMSet from(Stanza packet) {
|
||||||
return (RSMSet) packet.getExtension(ELEMENT, NAMESPACE);
|
return (RSMSet) packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.search;
|
package org.jivesoftware.smackx.search;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.xdata.FormField;
|
import org.jivesoftware.smackx.xdata.FormField;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm.Item;
|
import org.jivesoftware.smackx.xdata.packet.DataForm.Item;
|
||||||
|
@ -43,7 +43,7 @@ public class ReportedData {
|
||||||
*
|
*
|
||||||
* @param packet the packet used for reporting data.
|
* @param packet the packet used for reporting data.
|
||||||
*/
|
*/
|
||||||
public static ReportedData getReportedDataFrom(Packet packet) {
|
public static ReportedData getReportedDataFrom(Stanza packet) {
|
||||||
// Check if the packet includes the DataForm extension
|
// Check if the packet includes the DataForm extension
|
||||||
DataForm dataForm = DataForm.from(packet);
|
DataForm dataForm = DataForm.from(packet);
|
||||||
if (dataForm != null) {
|
if (dataForm != null) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.shim.packet;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class HeadersExtension implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the headers extension or null.
|
* @return the headers extension or null.
|
||||||
*/
|
*/
|
||||||
public static HeadersExtension from(Packet packet) {
|
public static HeadersExtension from(Stanza packet) {
|
||||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ public class Form {
|
||||||
* @return the data form parsed from the packet or <tt>null</tt> if there was not
|
* @return the data form parsed from the packet or <tt>null</tt> if there was not
|
||||||
* a form in the packet.
|
* a form in the packet.
|
||||||
*/
|
*/
|
||||||
public static Form getFormFrom(Packet packet) {
|
public static Form getFormFrom(Stanza packet) {
|
||||||
// Check if the packet includes the DataForm extension
|
// Check if the packet includes the DataForm extension
|
||||||
DataForm dataForm = DataForm.from(packet);
|
DataForm dataForm = DataForm.from(packet);
|
||||||
if (dataForm != null) {
|
if (dataForm != null) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.jivesoftware.smackx.xdata.packet;
|
package org.jivesoftware.smackx.xdata.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jivesoftware.smackx.xdata.FormField;
|
import org.jivesoftware.smackx.xdata.FormField;
|
||||||
|
@ -305,7 +305,7 @@ public class DataForm implements PacketExtension {
|
||||||
* @param packet
|
* @param packet
|
||||||
* @return the DataForm or null
|
* @return the DataForm or null
|
||||||
*/
|
*/
|
||||||
public static DataForm from(Packet packet) {
|
public static DataForm from(Stanza packet) {
|
||||||
return (DataForm) packet.getExtension(ELEMENT, NAMESPACE);
|
return (DataForm) packet.getExtension(ELEMENT, NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue