1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 20:42:06 +01:00

JIBB works

This commit is contained in:
vanitasvitae 2017-06-24 12:14:05 +02:00
parent c4ef2c9552
commit a101de29fd
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 37 additions and 38 deletions

View file

@ -135,16 +135,15 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
return; return;
} }
queued.add(threadPool.submit(new Runnable() {
@Override
public void run() {
try {
state = State.active; state = State.active;
transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() { transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() {
@Override @Override
public void onSessionInitiated(BytestreamSession bytestreamSession) { public void onSessionInitiated(BytestreamSession bytestreamSession) {
LOGGER.log(Level.INFO, "BEFORE THREAD START!");
receivingThread = new ReceiveTask(bytestreamSession, file, target); receivingThread = new ReceiveTask(bytestreamSession, file, target);
queued.add(threadPool.submit(receivingThread)); queued.add(threadPool.submit(receivingThread));
LOGGER.log(Level.INFO,"AFTER THREAD START!");
} }
@Override @Override
@ -152,13 +151,13 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
} }
}); });
try {
jutil.sendSessionAccept(getInitiator(), sid, creator, name, JingleContent.Senders.initiator, file, transportSession.createTransport()); jutil.sendSessionAccept(getInitiator(), sid, creator, name, JingleContent.Senders.initiator, file, transportSession.createTransport());
} catch (SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException e) { } catch (SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException e) {
LOGGER.log(Level.SEVERE, "Could not send session-accept: " + e, e); e.printStackTrace();
} }
} }
}));
}
@Override @Override
public void declineIncomingFileOffer(Jingle request) { public void declineIncomingFileOffer(Jingle request) {

View file

@ -103,9 +103,9 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
LOGGER.log(Level.INFO, "Session was accepted. Initiate Bytestream."); LOGGER.log(Level.INFO, "Session was accepted. Initiate Bytestream.");
state = State.active; state = State.active;
queued.add(threadPool.submit(new Runnable() {
@Override transportSession.processJingle(sessionAccept);
public void run() {
transportSession.initiateOutgoingSession(new JingleTransportInitiationCallback() { transportSession.initiateOutgoingSession(new JingleTransportInitiationCallback() {
@Override @Override
public void onSessionInitiated(final BytestreamSession session) { public void onSessionInitiated(final BytestreamSession session) {
@ -119,8 +119,6 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
LOGGER.log(Level.SEVERE, "Cannot create outgoing Bytestream session: ", e); LOGGER.log(Level.SEVERE, "Cannot create outgoing Bytestream session: ", e);
} }
}); });
}
}));
return jutil.createAck(sessionAccept); return jutil.createAck(sessionAccept);
} }

View file

@ -89,7 +89,7 @@ public class JingleIBBTransportSession extends JingleTransportSession<JingleIBBT
public void incomingBytestreamRequest(BytestreamRequest request) { public void incomingBytestreamRequest(BytestreamRequest request) {
if (request.getFrom().asFullJidIfPossible().equals(jingleSession.get().getRemote()) if (request.getFrom().asFullJidIfPossible().equals(jingleSession.get().getRemote())
&& request.getSessionID().equals(ibbTransport.getSessionId())) { && request.getSessionID().equals(ibbTransport.getSessionId())) {
LOGGER.log(Level.INFO,"MATCH! Create bytesteam session.");
BytestreamSession session; BytestreamSession session;
try { try {
@ -99,6 +99,8 @@ public class JingleIBBTransportSession extends JingleTransportSession<JingleIBBT
return; return;
} }
callback.onSessionInitiated(session); callback.onSessionInitiated(session);
} else {
LOGGER.log(Level.SEVERE, "MISSMATCH");
} }
} }
}); });