mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Fix incoming file transfers
With bb8dcc9874 the concept if IQ request
handlers was introduced in Smack. This doesn't allow packet/stanza
collectors/listeners to filter for incoming IQ requests. Unfortunately
the file transfer code relied on this being able, so it broke with the
change.
There were two places where the file transfer code was listening for
incoming IQ requests:
- InitationListener(s)
- Negotiator(s)
With this change, we let the InitiationListener signal the existence of
an incoming initation request, send by an IQ of type 'set', using the
newly created EventManager utility.
The negotiator waits for those events to arrive and proceedes as it would
have done when the packet collector was used.
This commit is contained in:
parent
21c0be5e2a
commit
dde0cfd7f6
7 changed files with 171 additions and 167 deletions
|
|
@ -27,6 +27,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
import org.jivesoftware.smackx.filetransfer.StreamNegotiator;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -86,6 +87,8 @@ class InitiationListener extends AbstractIqRequestHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
StreamNegotiator.signal(ibbRequest.getFrom() + '\t' + ibbRequest.getSessionID(), ibbRequest);
|
||||
|
||||
// ignore request if in ignore list
|
||||
if (this.manager.getIgnoredBytestreamRequests().remove(ibbRequest.getSessionID()))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.filetransfer.StreamNegotiator;
|
||||
|
||||
/**
|
||||
* InitiationListener handles all incoming SOCKS5 Bytestream initiation requests. If there are no
|
||||
|
|
@ -77,6 +78,8 @@ final class InitiationListener extends AbstractIqRequestHandler {
|
|||
private void processRequest(Stanza packet) throws NotConnectedException {
|
||||
Bytestream byteStreamRequest = (Bytestream) packet;
|
||||
|
||||
StreamNegotiator.signal(byteStreamRequest.getFrom() + '\t' + byteStreamRequest.getSessionID(), byteStreamRequest);
|
||||
|
||||
// ignore request if in ignore list
|
||||
if (this.manager.getIgnoredBytestreamRequests().remove(byteStreamRequest.getSessionID())) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue