mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Added privacy list support and improved error handling from Francisco (SMACK-121, SMACK-31).
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4603 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1716c6ed22
commit
47abf627b7
20 changed files with 2099 additions and 81 deletions
|
@ -172,7 +172,7 @@ public class FileTransferManager {
|
|||
IQ rejection = FileTransferNegotiator.createIQ(
|
||||
initiation.getPacketID(), initiation.getFrom(), initiation
|
||||
.getTo(), IQ.Type.ERROR);
|
||||
rejection.setError(new XMPPError(403));
|
||||
rejection.setError(new XMPPError(XMPPError.Condition.forbidden));
|
||||
connection.sendPacket(rejection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,12 +223,13 @@ public class FileTransferNegotiator {
|
|||
.getFeatureNegotiationForm());
|
||||
|
||||
if (streamMethodField == null) {
|
||||
XMPPError error = new XMPPError(400);
|
||||
String errorMessage = "No stream methods contained in packet.";
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.bad_request, errorMessage);
|
||||
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
|
||||
IQ.Type.ERROR);
|
||||
iqPacket.setError(error);
|
||||
connection.sendPacket(iqPacket);
|
||||
throw new XMPPException("No stream methods contained in packet.", error);
|
||||
throw new XMPPException(errorMessage, error);
|
||||
}
|
||||
|
||||
// select the appropriate protocol
|
||||
|
@ -278,8 +279,9 @@ public class FileTransferNegotiator {
|
|||
}
|
||||
|
||||
if (!isByteStream && !isIBB) {
|
||||
XMPPError error = new XMPPError(400);
|
||||
throw new XMPPException("No acceptable transfer mechanism", error);
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
|
||||
"No acceptable transfer mechanism");
|
||||
throw new XMPPException(error.getMessage(), error);
|
||||
}
|
||||
|
||||
if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
|
||||
|
@ -299,7 +301,7 @@ public class FileTransferNegotiator {
|
|||
* @param si The Stream Initiation request to reject.
|
||||
*/
|
||||
public void rejectStream(final StreamInitiation si) {
|
||||
XMPPError error = new XMPPError(403, "Offer Declined");
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.forbidden, "Offer Declined");
|
||||
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
|
||||
IQ.Type.ERROR);
|
||||
iqPacket.setError(error);
|
||||
|
@ -409,8 +411,9 @@ public class FileTransferNegotiator {
|
|||
}
|
||||
|
||||
if (!isByteStream && !isIBB) {
|
||||
XMPPError error = new XMPPError(400);
|
||||
throw new XMPPException("No acceptable transfer mechanism", error);
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
|
||||
"No acceptable transfer mechanism");
|
||||
throw new XMPPException(error.getMessage(), error);
|
||||
}
|
||||
|
||||
if (isByteStream && isIBB) {
|
||||
|
|
|
@ -377,7 +377,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
private void sendCancelMessage(Message message) {
|
||||
IQ error = FileTransferNegotiator.createIQ(message.getPacketID(), message.getFrom(), message.getTo(),
|
||||
IQ.Type.ERROR);
|
||||
error.setError(new XMPPError(504));
|
||||
error.setError(new XMPPError(XMPPError.Condition.remote_server_timeout, "Cancel Message Transfer"));
|
||||
connection.sendPacket(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -220,8 +220,9 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
|||
}
|
||||
}
|
||||
if (selectedHost == null || socket == null || !socket.isConnected()) {
|
||||
throw new XMPPException(
|
||||
"Could not establish socket with any provided host", new XMPPError(406));
|
||||
String errorMessage = "Could not establish socket with any provided host";
|
||||
throw new XMPPException(errorMessage, new XMPPError(
|
||||
XMPPError.Condition.no_acceptable, errorMessage));
|
||||
}
|
||||
|
||||
return new SelectedHostInfo(selectedHost, socket);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue