mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-14 06:51:08 +01:00
Merge branch '4.2' into master-paul-merged
This commit is contained in:
commit
431e5b3c67
434 changed files with 1770 additions and 1517 deletions
|
|
@ -65,11 +65,11 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
@Override
|
||||
public InputStream createIncomingStream(final StreamInitiation initiation) throws SmackException, XMPPErrorException, InterruptedException {
|
||||
// This could be either an xep47 ibb 'open' iq or an xep65 streamhost iq
|
||||
IQ initationSet = initiateIncomingStream(connection(), initiation);
|
||||
IQ initiationSet = initiateIncomingStream(connection(), initiation);
|
||||
|
||||
StreamNegotiator streamNegotiator = determineNegotiator(initationSet);
|
||||
StreamNegotiator streamNegotiator = determineNegotiator(initiationSet);
|
||||
|
||||
return streamNegotiator.negotiateIncomingStream(initationSet);
|
||||
return streamNegotiator.negotiateIncomingStream(initiationSet);
|
||||
}
|
||||
|
||||
private StreamNegotiator determineNegotiator(Stanza streamInitiation) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import org.jxmpp.jid.EntityFullJid;
|
|||
*/
|
||||
public final class FileTransferManager extends Manager {
|
||||
|
||||
private static final Map<XMPPConnection, FileTransferManager> INSTANCES = new WeakHashMap<XMPPConnection, FileTransferManager>();
|
||||
private static final Map<XMPPConnection, FileTransferManager> INSTANCES = new WeakHashMap<>();
|
||||
|
||||
public static synchronized FileTransferManager getInstanceFor(XMPPConnection connection) {
|
||||
FileTransferManager fileTransferManager = INSTANCES.get(connection);
|
||||
|
|
@ -60,7 +60,7 @@ public final class FileTransferManager extends Manager {
|
|||
|
||||
private final FileTransferNegotiator fileTransferNegotiator;
|
||||
|
||||
private final List<FileTransferListener> listeners = new CopyOnWriteArrayList<FileTransferListener>();
|
||||
private final List<FileTransferListener> listeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a file transfer manager to initiate and receive file transfers.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
public static final String SI_PROFILE_FILE_TRANSFER_NAMESPACE = "http://jabber.org/protocol/si/profile/file-transfer";
|
||||
private static final String[] NAMESPACE = { SI_NAMESPACE, SI_PROFILE_FILE_TRANSFER_NAMESPACE };
|
||||
|
||||
private static final Map<XMPPConnection, FileTransferNegotiator> INSTANCES = new WeakHashMap<XMPPConnection, FileTransferNegotiator>();
|
||||
private static final Map<XMPPConnection, FileTransferNegotiator> INSTANCES = new WeakHashMap<>();
|
||||
|
||||
private static final String STREAM_INIT_PREFIX = "jsi_";
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
ServiceDiscoveryManager manager = ServiceDiscoveryManager
|
||||
.getInstanceFor(connection);
|
||||
|
||||
List<String> namespaces = new ArrayList<String>();
|
||||
List<String> namespaces = new ArrayList<>();
|
||||
namespaces.addAll(Arrays.asList(NAMESPACE));
|
||||
namespaces.add(DataPacketExtension.NAMESPACE);
|
||||
if (!IBB_ONLY) {
|
||||
|
|
@ -132,7 +132,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
ServiceDiscoveryManager manager = ServiceDiscoveryManager
|
||||
.getInstanceFor(connection);
|
||||
|
||||
List<String> namespaces = new ArrayList<String>();
|
||||
List<String> namespaces = new ArrayList<>();
|
||||
namespaces.addAll(Arrays.asList(NAMESPACE));
|
||||
namespaces.add(DataPacketExtension.NAMESPACE);
|
||||
if (!IBB_ONLY) {
|
||||
|
|
@ -153,7 +153,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
* @return Returns a collection of the supported transfer protocols.
|
||||
*/
|
||||
public static Collection<String> getSupportedProtocols() {
|
||||
List<String> protocols = new ArrayList<String>();
|
||||
List<String> protocols = new ArrayList<>();
|
||||
protocols.add(DataPacketExtension.NAMESPACE);
|
||||
if (!IBB_ONLY) {
|
||||
protocols.add(Bytestream.NAMESPACE);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import org.jxmpp.jid.Jid;
|
|||
*/
|
||||
public class IBBTransferNegotiator extends StreamNegotiator {
|
||||
|
||||
private InBandBytestreamManager manager;
|
||||
private final InBandBytestreamManager manager;
|
||||
|
||||
/**
|
||||
* The default constructor for the In-Band Bytestream Negotiator.
|
||||
|
|
|
|||
|
|
@ -22,12 +22,10 @@ import java.io.OutputStream;
|
|||
import java.io.PushbackInputStream;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
||||
|
|
@ -45,7 +43,7 @@ import org.jxmpp.jid.Jid;
|
|||
*/
|
||||
public class Socks5TransferNegotiator extends StreamNegotiator {
|
||||
|
||||
private Socks5BytestreamManager manager;
|
||||
private final Socks5BytestreamManager manager;
|
||||
|
||||
Socks5TransferNegotiator(XMPPConnection connection) {
|
||||
super(connection);
|
||||
|
|
@ -53,7 +51,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OutputStream createOutgoingStream(String streamID, Jid initiator, Jid target) throws NoResponseException, SmackException, XMPPException
|
||||
public OutputStream createOutgoingStream(String streamID, Jid initiator, Jid target) throws SmackException, XMPPException
|
||||
{
|
||||
try {
|
||||
return this.manager.establishSession(target, streamID).getOutputStream();
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public abstract class StreamNegotiator extends Manager {
|
|||
|
||||
|
||||
abstract InputStream negotiateIncomingStream(Stanza streamInitiation) throws XMPPErrorException,
|
||||
InterruptedException, NoResponseException, SmackException;
|
||||
InterruptedException, SmackException;
|
||||
|
||||
/**
|
||||
* This method handles the file stream download negotiation process. The
|
||||
|
|
@ -156,7 +156,7 @@ public abstract class StreamNegotiator extends Manager {
|
|||
* @throws SmackException
|
||||
*/
|
||||
public abstract InputStream createIncomingStream(StreamInitiation initiation)
|
||||
throws XMPPErrorException, InterruptedException, NoResponseException, SmackException;
|
||||
throws XMPPErrorException, InterruptedException, SmackException;
|
||||
|
||||
/**
|
||||
* This method handles the file upload stream negotiation process. The
|
||||
|
|
@ -169,14 +169,12 @@ public abstract class StreamNegotiator extends Manager {
|
|||
* @param target The fully-qualified JID of the target or receiver of the file
|
||||
* transfer.
|
||||
* @return The negotiated stream ready for data.
|
||||
* @throws XMPPErrorException If an error occurs during the negotiation process an
|
||||
* exception will be thrown.
|
||||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract OutputStream createOutgoingStream(String streamID,
|
||||
Jid initiator, Jid target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException, InterruptedException;
|
||||
Jid initiator, Jid target) throws SmackException, XMPPException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Returns the XMPP namespace reserved for this particular type of file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue