mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Some bugfixes
This commit is contained in:
parent
04e898083c
commit
daa6b6b999
5 changed files with 35 additions and 9 deletions
|
@ -90,7 +90,10 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
||||||
|
|
||||||
state = State.pending;
|
state = State.pending;
|
||||||
|
|
||||||
jutil.sendSessionInitiateFileOffer(getResponder(), getSessionId(), creator, name, file, transportSession.createTransport());
|
Jingle initiate = jutil.createSessionInitiateFileOffer(getResponder(), getSessionId(), creator, name, file, transportSession.createTransport());
|
||||||
|
this.contents.addAll(initiate.getContents());
|
||||||
|
|
||||||
|
connection.sendStanza(initiate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,7 @@ 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.JingleContentDescription;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.JingleIBBTransportManager;
|
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.JingleIBBTransportManager;
|
||||||
|
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.JingleS5BTransportManager;
|
||||||
|
|
||||||
import org.jxmpp.jid.FullJid;
|
import org.jxmpp.jid.FullJid;
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ public final class JingleManager extends Manager {
|
||||||
//Register transports.
|
//Register transports.
|
||||||
JingleTransportMethodManager transportMethodManager = JingleTransportMethodManager.getInstanceFor(connection);
|
JingleTransportMethodManager transportMethodManager = JingleTransportMethodManager.getInstanceFor(connection);
|
||||||
transportMethodManager.registerTransportManager(JingleIBBTransportManager.getInstanceFor(connection));
|
transportMethodManager.registerTransportManager(JingleIBBTransportManager.getInstanceFor(connection));
|
||||||
//transportMethodManager.registerTransportManager(JingleS5BTransportManager.getInstanceFor(connection));
|
transportMethodManager.registerTransportManager(JingleS5BTransportManager.getInstanceFor(connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
public JingleHandler registerDescriptionHandler(String namespace, JingleHandler handler) {
|
public JingleHandler registerDescriptionHandler(String namespace, JingleHandler handler) {
|
||||||
|
|
|
@ -8,10 +8,10 @@ public abstract class JingleTransportInitiationException extends Exception {
|
||||||
|
|
||||||
|
|
||||||
public static class ProxyError extends JingleTransportInitiationException {
|
public static class ProxyError extends JingleTransportInitiationException {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CandidateError extends JingleTransportInitiationException {
|
public static class CandidateError extends JingleTransportInitiationException {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public final class JingleS5BTransportManager extends JingleTransportManager<Jing
|
||||||
cb.setName(name).setCreator(creator).setSenders(senders);
|
cb.setName(name).setCreator(creator).setSenders(senders);
|
||||||
|
|
||||||
JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder();
|
JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder();
|
||||||
tb.setCandidateError();
|
tb.setCandidateError().setStreamId(streamId);
|
||||||
|
|
||||||
Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
|
Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
|
||||||
jingle.setFrom(getConnection().getUser().asFullJidOrThrow());
|
jingle.setFrom(getConnection().getUser().asFullJidOrThrow());
|
||||||
|
|
|
@ -107,7 +107,9 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
||||||
builder.setStreamId(sid);
|
builder.setStreamId(sid);
|
||||||
builder.setMode(mode);
|
builder.setMode(mode);
|
||||||
builder.setDestinationAddress(Socks5Utils.createDigest(sid, jSession.getLocal(), jSession.getRemote()));
|
builder.setDestinationAddress(Socks5Utils.createDigest(sid, jSession.getLocal(), jSession.getRemote()));
|
||||||
return builder.build();
|
localTransport = builder.build();
|
||||||
|
|
||||||
|
return (JingleS5BTransport) localTransport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -311,6 +313,23 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ handleCandidateActivated(Jingle candidateActivated) {
|
public IQ handleCandidateActivated(Jingle candidateActivated) {
|
||||||
|
JingleContent content = candidateActivated.getContents().get(0);
|
||||||
|
JingleS5BTransportInfo info = (JingleS5BTransportInfo) content.getJingleTransport().getInfos().get(0);
|
||||||
|
if (!info.getElementName().equals(JingleS5BTransportInfo.CandidateActivated.ELEMENT)) {
|
||||||
|
throw new AssertionError("Element mus be candidateActivated.");
|
||||||
|
}
|
||||||
|
|
||||||
|
JingleS5BTransportInfo.CandidateActivated activated = (JingleS5BTransportInfo.CandidateActivated) info;
|
||||||
|
if (!localUsedCandidate.getCandidateId().equals(activated.getCandidateId())) {
|
||||||
|
throw new AssertionError("CandidateID must be equal.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connectedSocket == null) {
|
||||||
|
throw new AssertionError("connected Socket must not be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
callback.onSessionInitiated(new Socks5BytestreamSession(connectedSocket,
|
||||||
|
jingleSession.get().getRemote().asBareJid().equals(localUsedCandidate.getJid().asBareJid())));
|
||||||
|
|
||||||
return IQ.createResultIQ(candidateActivated);
|
return IQ.createResultIQ(candidateActivated);
|
||||||
}
|
}
|
||||||
|
@ -322,10 +341,13 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
||||||
return IQ.createResultIQ(candidateError);
|
return IQ.createResultIQ(candidateError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localUsedCandidate.getType() != JingleS5BTransportCandidate.Type.proxy) {
|
if (localUsedCandidate != null) {
|
||||||
//TODO: Connect
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (localUsedCandidate.getType() != JingleS5BTransportCandidate.Type.proxy) {
|
||||||
|
//TODO: Connect
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return IQ.createResultIQ(candidateError);
|
return IQ.createResultIQ(candidateError);
|
||||||
|
|
Loading…
Reference in a new issue