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

Rename IQ.ELEMENT to IQ.IQ_ELEMENT

to avoid confusion between the IQ element 'iq' and the IQs child
element. ELEMENT defined in an IQ sublcass should contain the *child*
element.

Add element to StreamInitation and fix FileTransferManager which still
used a packet listener instead of an IQ request handler to handle
incoming stream initiation requests.
This commit is contained in:
Florian Schmaus 2015-01-11 21:52:06 +01:00
parent f1a1215f35
commit b0cecee710
6 changed files with 19 additions and 15 deletions

View file

@ -30,6 +30,9 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
* @author Alexander Wenckus
*/
public class Bytestream extends IQ {
public static final String ELEMENT = QUERY_ELEMENT;
/**
* The XMPP namespace of the SOCKS5 Bytestream
*/
@ -49,7 +52,7 @@ public class Bytestream extends IQ {
* The default constructor
*/
public Bytestream() {
super(QUERY_ELEMENT, NAMESPACE);
super(ELEMENT, NAMESPACE);
}
/**

View file

@ -17,14 +17,11 @@
package org.jivesoftware.smackx.filetransfer;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.IQTypeFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.si.packet.StreamInitiation;
import org.jxmpp.util.XmppStringUtils;
@ -73,15 +70,18 @@ public class FileTransferManager extends Manager {
super(connection);
this.fileTransferNegotiator = FileTransferNegotiator
.getInstanceFor(connection);
connection.addAsyncPacketListener(new PacketListener() {
public void processPacket(Packet packet) {
connection.registerIQRequestHandler(new AbstractIqRequestHandler(StreamInitiation.ELEMENT,
StreamInitiation.NAMESPACE, IQ.Type.set, Mode.async) {
@Override
public IQ handleIQRequest(IQ packet) {
StreamInitiation si = (StreamInitiation) packet;
final FileTransferRequest request = new FileTransferRequest(FileTransferManager.this, si);
for (final FileTransferListener listener : listeners) {
listener.fileTransferRequest(request);
}
return null;
}
}, new AndFilter(new PacketTypeFilter(StreamInitiation.class), IQTypeFilter.SET));
});
}
/**