mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 14:32:06 +01:00
Fix bugs. JIBB works again
This commit is contained in:
parent
7a9b819b18
commit
d4deaa2517
2 changed files with 11 additions and 10 deletions
|
@ -18,18 +18,19 @@ package org.jivesoftware.smackx.jingle_filetransfer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.jivesoftware.smack.Manager;
|
import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
import org.jivesoftware.smackx.jingle.JingleContentProviderManager;
|
||||||
import org.jivesoftware.smackx.jingle.JingleHandler;
|
import org.jivesoftware.smackx.jingle.JingleHandler;
|
||||||
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_filetransfer.callback.JingleFileTransferCallback;
|
import org.jivesoftware.smackx.jingle_filetransfer.callback.JingleFileTransferCallback;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.listener.IncomingJingleFileTransferListener;
|
import org.jivesoftware.smackx.jingle_filetransfer.listener.IncomingJingleFileTransferListener;
|
||||||
|
import org.jivesoftware.smackx.jingle_filetransfer.provider.JingleFileTransferContentDescriptionProvider;
|
||||||
import org.jivesoftware.smackx.jingle_ibb.JingleIBBTransportManager;
|
import org.jivesoftware.smackx.jingle_ibb.JingleIBBTransportManager;
|
||||||
import org.jxmpp.jid.FullJid;
|
import org.jxmpp.jid.FullJid;
|
||||||
|
|
||||||
|
@ -43,10 +44,9 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
|
|
||||||
private final ArrayList<IncomingJingleFileTransferListener> incomingJFTListeners = new ArrayList<>();
|
private final ArrayList<IncomingJingleFileTransferListener> incomingJFTListeners = new ArrayList<>();
|
||||||
|
|
||||||
private HashMap<JingleManager.FullJidAndSessionId, JingleFileTransferSession> jingleSessions = new HashMap<>();
|
|
||||||
|
|
||||||
private JingleFileTransferManager(XMPPConnection connection) {
|
private JingleFileTransferManager(XMPPConnection connection) {
|
||||||
super(connection);
|
super(connection);
|
||||||
|
JingleContentProviderManager.addJingleContentDescriptionProvider(NAMESPACE_V5, new JingleFileTransferContentDescriptionProvider());
|
||||||
JingleManager.getInstanceFor(connection).registerDescriptionHandler(NAMESPACE_V5, this);
|
JingleManager.getInstanceFor(connection).registerDescriptionHandler(NAMESPACE_V5, this);
|
||||||
JingleIBBTransportManager.getInstanceFor(connection);
|
JingleIBBTransportManager.getInstanceFor(connection);
|
||||||
//JingleS5BTransportManager.getInstanceFor(connection);
|
//JingleS5BTransportManager.getInstanceFor(connection);
|
||||||
|
@ -72,15 +72,15 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addJingleSession(JingleFileTransferSession session) {
|
public void addJingleSession(JingleFileTransferSession session) {
|
||||||
jingleSessions.put(session.getFullJidAndSessionId(), session);
|
JingleManager.FullJidAndSessionId fns = session.getFullJidAndSessionId();
|
||||||
}
|
JingleManager.getInstanceFor(connection())
|
||||||
|
.registerJingleSessionHandler(fns.getFullJid(), fns.getSessionId(), session);
|
||||||
public JingleFileTransferSession getJingleSession(JingleManager.FullJidAndSessionId fullJidAndSessionId) {
|
|
||||||
return jingleSessions.get(fullJidAndSessionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeJingleSession(JingleFileTransferSession session) {
|
public void removeJingleSession(JingleFileTransferSession session) {
|
||||||
jingleSessions.remove(session.getFullJidAndSessionId());
|
JingleManager.FullJidAndSessionId fns = session.getFullJidAndSessionId();
|
||||||
|
JingleManager.getInstanceFor(connection()).unregisterJingleSession(
|
||||||
|
fns.getFullJid(), fns.getSessionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,12 +105,13 @@ public class JingleFileTransferSession extends AbstractJingleSession {
|
||||||
*/
|
*/
|
||||||
public JingleFileTransferSession(XMPPConnection connection, Jingle initiate) {
|
public JingleFileTransferSession(XMPPConnection connection, Jingle initiate) {
|
||||||
super(connection);
|
super(connection);
|
||||||
|
LOGGER.log(Level.INFO, "Incoming session!");
|
||||||
this.sessionId = initiate.getSessionId();
|
this.sessionId = initiate.getSessionId();
|
||||||
this.remote = initiate.getInitiator();
|
this.remote = initiate.getInitiator();
|
||||||
this.source = null;
|
this.source = null;
|
||||||
this.proposedContent = initiate.getContents().get(0);
|
this.proposedContent = initiate.getContents().get(0);
|
||||||
|
|
||||||
this.state = new IncomingAccepted(connection, this);
|
this.state = new IncomingFresh(connection, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue