mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Add an API to send and wait async for a response
SMACK-595 Also remove the unused AbstractXMPPConnection.getPacketListeners() method.
This commit is contained in:
parent
18a958e442
commit
aeda0e4660
6 changed files with 221 additions and 27 deletions
|
@ -29,7 +29,6 @@ import org.jivesoftware.smack.PacketListener;
|
|||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.IQReplyFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
@ -121,17 +120,11 @@ public class CarbonManager extends Manager {
|
|||
public void sendCarbonsEnabled(final boolean new_state) throws NotConnectedException {
|
||||
IQ setIQ = carbonsEnabledIQ(new_state);
|
||||
|
||||
connection().addPacketListener(new PacketListener() {
|
||||
connection().sendIqWithResponseCallback(setIQ, new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
IQ result = (IQ)packet;
|
||||
if (result.getType() == IQ.Type.result) {
|
||||
enabled_state = new_state;
|
||||
}
|
||||
connection().removePacketListener(this);
|
||||
enabled_state = new_state;
|
||||
}
|
||||
}, new IQReplyFilter(setIQ, connection()));
|
||||
|
||||
connection().sendPacket(setIQ);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue