1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 16:22:06 +01:00

Terminate a session instead Decline with an Error packet

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7063 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-02-09 03:49:43 +00:00 committed by thiago
parent 5102acc985
commit 877afcd3ba
3 changed files with 22 additions and 18 deletions

View file

@ -174,7 +174,7 @@ public class IncomingJingleSession extends JingleSession {
*
* @return
*/
JingleSessionRequest getInitialSessionRequest() {
public JingleSessionRequest getInitialSessionRequest() {
return initialSessionRequest;
}
@ -183,7 +183,7 @@ public class IncomingJingleSession extends JingleSession {
*
* @param initialRequest the initial Jingle packet
*/
void setInitialSessionRequest(JingleSessionRequest initialRequest) {
public void setInitialSessionRequest(JingleSessionRequest initialRequest) {
this.initialSessionRequest = initialRequest;
}
@ -227,7 +227,7 @@ public class IncomingJingleSession extends JingleSession {
* "Pending" state: we are waiting for the transport and content
* negotiators.
*/
private class Pending extends JingleNegotiator.State {
public class Pending extends JingleNegotiator.State {
JingleMediaListener jingleMediaListener;
@ -373,7 +373,7 @@ public class IncomingJingleSession extends JingleSession {
/**
* "Active" state: we have an agreement about the session.
*/
private class Active extends JingleNegotiator.State {
public class Active extends JingleNegotiator.State {
public Active(JingleNegotiator neg) {
super(neg);
}

View file

@ -118,6 +118,8 @@ public abstract class JingleSession extends JingleNegotiator {
static int ccc = 0;
private boolean closed = false;
/**
* Full featured JingleSession constructor
*
@ -605,7 +607,7 @@ public abstract class JingleSession extends JingleNegotiator {
*
* @param iq The IQ to acknowledge
*/
private IQ sendAck(IQ iq) {
public IQ sendAck(IQ iq) {
IQ result = null;
if (iq != null) {
@ -1074,7 +1076,6 @@ public abstract class JingleSession extends JingleNegotiator {
*/
public void terminate() throws XMPPException {
System.out.println("State: " + this.getState());
if (!invalidState()) {
Jingle result = null;
Jingle jout = new Jingle(Jingle.Action.SESSIONTERMINATE);
jout.setType(IQ.Type.SET);
@ -1082,10 +1083,6 @@ public abstract class JingleSession extends JingleNegotiator {
triggerSessionClosed("Closed Locally");
close();
}
else {
throw new IllegalStateException("Session Not Started");
}
}
/**
* Terminate negotiations.
@ -1095,9 +1092,14 @@ public abstract class JingleSession extends JingleNegotiator {
destroyTransportNeg();
removePacketListener();
System.out.println("Negociation Closed");
closed=true;
super.close();
}
public boolean isClosed() {
return closed;
}
// Packet and error creation
/**
@ -1142,7 +1144,7 @@ public abstract class JingleSession extends JingleNegotiator {
XMPPError error = new XMPPError(new XMPPError.Condition(errStr));
iqError.setError(error);
System.out.println(iqError.toXML());
System.out.println("Created Error Packet:" + iqError.toXML());
return iqError;
}

View file

@ -8,7 +8,7 @@ import java.util.List;
/**
* A Jingle session request.
*
* <p/>
* This class is a facade of a received Jingle request. The user can have direct
* access to the Jingle packet (<i>JingleSessionRequest.getJingle() </i>) of
* the request or can use the convencience methods provided by this class.
@ -76,6 +76,8 @@ public class JingleSessionRequest {
session = manager.createIncomingJingleSession(this,
pts);
session.setInitialSessionRequest(this);
// Acknowledge the IQ reception
session.sendAck(this.getJingle());
}
return session;
}