mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Reply correct error code on XEP-65 Stream rejection
this was previously erroneously changed with
197548b548
from 'forbidden' to
'not-acceptable'. We now change it back to 'forbidden'.
Also delete FileTransferNegotiator.rejectStream(StreamInitation) because
it is dead code and add some comments and javadoc.
This commit is contained in:
parent
cde6dd65b3
commit
c063fb1376
3 changed files with 16 additions and 15 deletions
|
@ -703,6 +703,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
|||
/**
|
||||
* Responses to the given packet's sender with a XMPP error that a SOCKS5 Bytestream is not
|
||||
* accepted.
|
||||
* <p>
|
||||
* Specified in XEP-65 5.3.1 (Example 13)
|
||||
* </p>
|
||||
*
|
||||
* @param packet Packet that should be answered with a not-acceptable error
|
||||
* @throws NotConnectedException
|
||||
|
|
|
@ -168,13 +168,25 @@ public class FileTransferManager {
|
|||
return transfer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject an incoming file transfer.
|
||||
* <p>
|
||||
* Specified in XEP-95 4.2 and 3.2 Example 8
|
||||
* </p>
|
||||
* @param request
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {
|
||||
StreamInitiation initiation = request.getStreamInitiation();
|
||||
|
||||
IQ rejection = FileTransferNegotiator.createIQ(
|
||||
initiation.getPacketID(), initiation.getFrom(), initiation
|
||||
.getTo(), IQ.Type.ERROR);
|
||||
rejection.setError(new XMPPError(XMPPError.Condition.not_acceptable));
|
||||
// Reject as specified in XEP-95 4.2. Note that this is not to be confused with the Socks 5
|
||||
// Bytestream rejection as specified in XEP-65 5.3.1 Example 13, which says that
|
||||
// 'not-acceptable' should be returned. This is done by Smack in
|
||||
// Socks5BytestreamManager.replyRejectPacket(IQ).
|
||||
rejection.setError(new XMPPError(XMPPError.Condition.forbidden));
|
||||
connection.sendPacket(rejection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,20 +322,6 @@ public class FileTransferNegotiator {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject a stream initiation request from a remote user.
|
||||
*
|
||||
* @param si The Stream Initiation request to reject.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void rejectStream(final StreamInitiation si) throws NotConnectedException {
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.forbidden, "Offer Declined");
|
||||
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
|
||||
IQ.Type.ERROR);
|
||||
iqPacket.setError(error);
|
||||
connection.sendPacket(iqPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new, unique, stream ID to identify a file transfer.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue