mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Add StanzaIdFilter, deprecate PacketIDFilter
This commit is contained in:
parent
2856b8ace6
commit
7ebea7ce94
10 changed files with 73 additions and 29 deletions
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.filter.StanzaIdFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.iqregister.packet.Registration;
|
||||
import org.jxmpp.util.XmppStringUtils;
|
||||
|
@ -290,7 +290,7 @@ public class AccountManager extends Manager {
|
|||
}
|
||||
|
||||
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException {
|
||||
PacketCollector collector = connection().createPacketCollectorAndSend(new PacketIDFilter(req.getStanzaId()), req);
|
||||
PacketCollector collector = connection().createPacketCollectorAndSend(new StanzaIdFilter(req.getStanzaId()), req);
|
||||
return collector;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,26 +26,6 @@ import org.jivesoftware.smack.util.StringUtils;
|
|||
* A Version IQ packet, which is used by XMPP clients to discover version information
|
||||
* about the software running at another entity's JID.<p>
|
||||
*
|
||||
* An example to discover the version of the server:
|
||||
* <pre>
|
||||
* // Request the version from the server.
|
||||
* Version versionRequest = new Version();
|
||||
* timeRequest.setType(IQ.Type.get);
|
||||
* timeRequest.setTo("example.com");
|
||||
*
|
||||
* // Create a packet collector to listen for a response.
|
||||
* PacketCollector collector = con.createPacketCollector(
|
||||
* new PacketIDFilter(versionRequest.getStanzaId()));
|
||||
*
|
||||
* con.sendPacket(versionRequest);
|
||||
*
|
||||
* // Wait up to 5 seconds for a result.
|
||||
* IQ result = (IQ)collector.nextResult(5000);
|
||||
* if (result != null && result.getType() == IQ.Type.result) {
|
||||
* Version versionResult = (Version)result;
|
||||
* // Do something with result...
|
||||
* }</pre><p>
|
||||
*
|
||||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class Version extends IQ {
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
* <code>
|
||||
* public void methodToTest() {
|
||||
* Packet packet = new Packet(); // create an XMPP packet
|
||||
* PacketCollector collector = connection.createPacketCollector(new PacketIDFilter());
|
||||
* PacketCollector collector = connection.createPacketCollector(new StanzaIdFilter());
|
||||
* connection.sendPacket(packet);
|
||||
* Packet reply = collector.nextResult();
|
||||
* }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue