diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java index 824dcd771..8b6f02db4 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java @@ -57,6 +57,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smackx.jingle.listeners.JingleMediaListener; import org.jivesoftware.smackx.jingle.listeners.JingleTransportListener; +import org.jivesoftware.smackx.jingle.listeners.JingleSessionStateListener; import org.jivesoftware.smackx.jingle.media.JingleMediaManager; import org.jivesoftware.smackx.jingle.media.MediaNegotiator; import org.jivesoftware.smackx.jingle.media.PayloadType; @@ -68,12 +69,13 @@ import org.jivesoftware.smackx.packet.JingleContentDescription; import org.jivesoftware.smackx.packet.JingleContentDescription.JinglePayloadType; import org.jivesoftware.smackx.packet.JingleError; +import javax.swing.*; import java.util.List; /** * An incoming Jingle Session implementation. * This class has especific bahavior to accept and establish a received Jingle Session Request. - * + *
* This class is not directly used by users. Instead, users should refer to the * JingleManager class, that will create the appropiate instance... * @@ -90,6 +92,8 @@ public class IncomingJingleSession extends JingleSession { private JingleSessionRequest initialSessionRequest; + private boolean accepted = false; + /** * Constructor for a Jingle incoming session * @@ -98,7 +102,7 @@ public class IncomingJingleSession extends JingleSession { * @param resolver The transport resolver */ protected IncomingJingleSession(XMPPConnection conn, String responder, - List payloadTypes, TransportResolver resolver) { + List payloadTypes, TransportResolver resolver) { super(conn, responder, conn.getUser()); @@ -115,6 +119,7 @@ public class IncomingJingleSession extends JingleSession { if (resolver.getType().equals(TransportResolver.Type.ice)) { setTransportNeg(new TransportNegotiator.Ice(this, resolver)); } + } /** @@ -126,7 +131,7 @@ public class IncomingJingleSession extends JingleSession { * @param jingleMediaManager The Media Manager for this Session */ protected IncomingJingleSession(XMPPConnection conn, String responder, - List payloadTypes, TransportResolver resolver, JingleMediaManager jingleMediaManager) { + List payloadTypes, TransportResolver resolver, JingleMediaManager jingleMediaManager) { this(conn, responder, payloadTypes, resolver); this.jingleMediaManager = jingleMediaManager; } @@ -151,11 +156,13 @@ public class IncomingJingleSession extends JingleSession { updatePacketListener(); respond(packet); - } else { + } + else { throw new IllegalStateException( "Session request with null Jingle packet."); } - } else { + } + else { throw new IllegalStateException("Starting session without null state."); } } @@ -249,7 +256,7 @@ public class IncomingJingleSession extends JingleSession { jingleTransportListener = new JingleTransportListener() { public void transportEstablished(TransportCandidate local, - TransportCandidate remote) { + TransportCandidate remote) { checkFullyEstablished(); } @@ -340,7 +347,8 @@ public class IncomingJingleSession extends JingleSession { .getAcceptedLocalCandidate())) { setState(active); } - } else { + } + else { throw new JingleException(JingleError.MALFORMED_STANZA); } } @@ -374,6 +382,7 @@ public class IncomingJingleSession extends JingleSession { * "Active" state: we have an agreement about the session. */ public class Active extends JingleNegotiator.State { + public Active(JingleNegotiator neg) { super(neg); } diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java index ef5580d12..b8b219b85 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java @@ -93,7 +93,8 @@ public abstract class JingleNegotiator { public Class getStateClass() { if (state != null) { return state.getClass(); - } else { + } + else { return Object.class; } } @@ -122,6 +123,7 @@ public abstract class JingleNegotiator { /** * Add expected ID + * * @param id */ public void addExpectedId(String id) { @@ -130,19 +132,22 @@ public abstract class JingleNegotiator { /** * Check if the passed ID is the expected ID + * * @param id * @return */ public boolean isExpectedId(String id) { if (id != null) { return id.equals(expectedAckId); - } else { + } + else { return false; } } /** * Remove and expected ID + * * @param id */ public void removeExpectedId(String id) { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java index f8182eb8b..10abb74f6 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java @@ -60,10 +60,7 @@ import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.XMPPError; -import org.jivesoftware.smackx.jingle.listeners.JingleListener; -import org.jivesoftware.smackx.jingle.listeners.JingleMediaListener; -import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener; -import org.jivesoftware.smackx.jingle.listeners.JingleTransportListener; +import org.jivesoftware.smackx.jingle.listeners.*; import org.jivesoftware.smackx.jingle.media.*; import org.jivesoftware.smackx.jingle.nat.TransportCandidate; import org.jivesoftware.smackx.jingle.nat.TransportNegotiator; @@ -74,10 +71,7 @@ import org.jivesoftware.smackx.packet.JingleContentInfo; import org.jivesoftware.smackx.packet.JingleError; import org.jivesoftware.smackx.packet.JingleTransport.JingleTransportCandidate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; +import java.util.*; /** * An abstract Jingle session. @@ -116,10 +110,10 @@ public abstract class JingleSession extends JingleNegotiator { protected JingleMediaSession jingleMediaSession = null; - static int ccc = 0; - private boolean closed = false; + private List