1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-29 17:52:06 +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:
Florian Schmaus 2014-07-12 13:50:50 +02:00
parent cde6dd65b3
commit c063fb1376
3 changed files with 16 additions and 15 deletions

View file

@ -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 * Responses to the given packet's sender with a XMPP error that a SOCKS5 Bytestream is not
* accepted. * accepted.
* <p>
* Specified in XEP-65 5.3.1 (Example 13)
* </p>
* *
* @param packet Packet that should be answered with a not-acceptable error * @param packet Packet that should be answered with a not-acceptable error
* @throws NotConnectedException * @throws NotConnectedException

View file

@ -168,13 +168,25 @@ public class FileTransferManager {
return transfer; 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 { protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {
StreamInitiation initiation = request.getStreamInitiation(); StreamInitiation initiation = request.getStreamInitiation();
IQ rejection = FileTransferNegotiator.createIQ( IQ rejection = FileTransferNegotiator.createIQ(
initiation.getPacketID(), initiation.getFrom(), initiation initiation.getPacketID(), initiation.getFrom(), initiation
.getTo(), IQ.Type.ERROR); .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); connection.sendPacket(rejection);
} }
} }

View file

@ -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. * Returns a new, unique, stream ID to identify a file transfer.
* *