Fixed some sending issues

This commit is contained in:
vanitasvitae 2017-06-21 18:03:31 +02:00
parent 4f03cf9a24
commit 5dc37ab239
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
4 changed files with 16 additions and 1 deletions

View File

@ -57,6 +57,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
public IncomingJingleFileOffer(XMPPConnection connection, FullJid initiator, String sid) { public IncomingJingleFileOffer(XMPPConnection connection, FullJid initiator, String sid) {
super(connection, initiator, connection.getUser().asFullJidOrThrow(), Role.responder, sid, Type.offer); super(connection, initiator, connection.getUser().asFullJidOrThrow(), Role.responder, sid, Type.offer);
state = State.fresh;
} }
public IncomingJingleFileOffer(XMPPConnection connection, Jingle request) { public IncomingJingleFileOffer(XMPPConnection connection, Jingle request) {

View File

@ -22,7 +22,9 @@ import java.util.Collections;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.jingle.JingleHandler; import org.jivesoftware.smackx.jingle.JingleHandler;
@ -32,10 +34,12 @@ import org.jivesoftware.smackx.jingle.element.Jingle;
import org.jivesoftware.smackx.jingle.element.JingleAction; import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContent; import org.jivesoftware.smackx.jingle.element.JingleContent;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback; import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
import org.jivesoftware.smackx.jingle_filetransfer.listener.JingleFileTransferOfferListener; import org.jivesoftware.smackx.jingle_filetransfer.listener.JingleFileTransferOfferListener;
import org.jivesoftware.smackx.jingle_filetransfer.provider.JingleFileTransferProvider;
import org.jxmpp.jid.FullJid; import org.jxmpp.jid.FullJid;
@ -53,6 +57,8 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
ServiceDiscoveryManager.getInstanceFor(connection).addFeature(JingleFileTransfer.NAMESPACE_V5); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(JingleFileTransfer.NAMESPACE_V5);
JingleManager jingleManager = JingleManager.getInstanceFor(connection); JingleManager jingleManager = JingleManager.getInstanceFor(connection);
jingleManager.registerDescriptionHandler(JingleFileTransfer.NAMESPACE_V5, this); jingleManager.registerDescriptionHandler(JingleFileTransfer.NAMESPACE_V5, this);
JingleContentProviderManager.addJingleContentDescriptionProvider(
JingleFileTransfer.NAMESPACE_V5, new JingleFileTransferProvider());
jutil = new JingleUtil(connection); jutil = new JingleUtil(connection);
} }
@ -65,7 +71,9 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
return manager; return manager;
} }
public void sendFile(FullJid recipient, File file) { public void sendFile(FullJid recipient, File file)
throws InterruptedException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException {
OutgoingJingleFileOffer offer = new OutgoingJingleFileOffer(connection(), recipient); OutgoingJingleFileOffer offer = new OutgoingJingleFileOffer(connection(), recipient);
offer.send(file); offer.send(file);
} }

View File

@ -27,9 +27,11 @@ import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
import org.jivesoftware.smackx.jingle.element.Jingle; import org.jivesoftware.smackx.jingle.element.Jingle;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback; import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport; import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport;
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider.JingleIBBTransportProvider;
import org.jxmpp.jid.FullJid; import org.jxmpp.jid.FullJid;
@ -42,6 +44,7 @@ public final class JingleIBBTransportManager extends JingleTransportManager<Jing
private JingleIBBTransportManager(XMPPConnection connection) { private JingleIBBTransportManager(XMPPConnection connection) {
super(connection); super(connection);
JingleContentProviderManager.addJingleContentTransportProvider(getNamespace(), new JingleIBBTransportProvider());
} }
public static JingleIBBTransportManager getInstanceFor(XMPPConnection connection) { public static JingleIBBTransportManager getInstanceFor(XMPPConnection connection) {

View File

@ -34,10 +34,12 @@ import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle.JingleManager; import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.element.Jingle; import org.jivesoftware.smackx.jingle.element.Jingle;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback; import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager; import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport; import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate; import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.provider.JingleS5BTransportProvider;
import org.jxmpp.jid.FullJid; import org.jxmpp.jid.FullJid;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@ -53,6 +55,7 @@ public final class JingleS5BTransportManager extends JingleTransportManager<Jing
private JingleS5BTransportManager(XMPPConnection connection) { private JingleS5BTransportManager(XMPPConnection connection) {
super(connection); super(connection);
JingleContentProviderManager.addJingleContentTransportProvider(getNamespace(), new JingleS5BTransportProvider());
} }
public static JingleS5BTransportManager getInstanceFor(XMPPConnection connection) { public static JingleS5BTransportManager getInstanceFor(XMPPConnection connection) {