1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Add XMPPConnection.sendStanza(Stanza)

and deprecate sendPacket().
This commit is contained in:
Florian Schmaus 2015-03-04 21:44:43 +01:00
parent 183af99ffb
commit ed4fa3390f
58 changed files with 183 additions and 167 deletions

View file

@ -175,7 +175,7 @@ public class JingleManagerTest extends SmackTestCase {
iqSent.setType(IQ.Type.set);
System.out.println("Sending packet and waiting... ");
getConnection(1).sendPacket(iqSent);
getConnection(1).sendStanza(iqSent);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {

View file

@ -368,7 +368,7 @@ public class JingleMediaTest extends SmackTestCase {
Thread.sleep(20000);
//js0.sendFormattedError(JingleError.UNSUPPORTED_TRANSPORTS);
js0.sendPacket(js0.createJingleError(null, JingleError.UNSUPPORTED_TRANSPORTS));
js0.sendStanza(js0.createJingleError(null, JingleError.UNSUPPORTED_TRANSPORTS));
Thread.sleep(20000);

View file

@ -75,7 +75,7 @@ public class JingleProviderTest extends SmackTestCase {
System.out.println("Testing if a Jingle IQ can be sent and received...");
// Send the iq packet with an invalid namespace
getConnection(0).sendPacket(iqSent);
getConnection(0).sendStanza(iqSent);
// Receive the packet
IQ iqReceived = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

View file

@ -325,12 +325,12 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// // If the response is anything other than a RESULT then send it now.
// if ((response != null) && (!response.getType().equals(IQ.Type.result))) {
// getConnection().sendPacket(response);
// getConnection().sendStanza(response);
// }
// Loop through all of the responses and send them.
for (IQ response : responses) {
sendPacket(response);
sendStanza(response);
}
}
@ -397,7 +397,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Send section
// ----------------------------------------------------------------------------------------------------------
public void sendPacket(IQ iq) throws NotConnectedException {
public void sendStanza(IQ iq) throws NotConnectedException {
if (iq instanceof Jingle) {
@ -405,7 +405,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
} else {
getConnection().sendPacket(iq);
getConnection().sendStanza(iq);
}
}
@ -467,7 +467,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// The the packet.
if ((getConnection() != null) && (getConnection().isConnected()))
getConnection().sendPacket(jout);
getConnection().sendStanza(jout);
}
return jout;
}
@ -483,7 +483,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// updatePacketListener();
//
// // Send the actual packet.
// sendPacket(inJingle);
// sendStanza(inJingle);
//
// // Change to the PENDING state.
// setSessionState(JingleSessionStateEnum.PENDING);
@ -507,7 +507,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
IQ ack = IQ.createResultIQ(iq);
// No! Don't send it. Let it flow to the normal way IQ results get processed and sent.
// getConnection().sendPacket(ack);
// getConnection().sendStanza(ack);
result = ack;
}
}
@ -518,7 +518,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* Send a content info message.
*/
// public synchronized void sendContentInfo(ContentInfo ci) {
// sendPacket(new Jingle(new JingleContentInfo(ci)));
// sendStanza(new Jingle(new JingleContentInfo(ci)));
// }
/*
* (non-Javadoc)
@ -806,7 +806,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendPacket(jout);
sendStanza(jout);
//triggerSessionEstablished();
@ -838,7 +838,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendPacket(jout);
sendStanza(jout);
}
}
}
@ -974,7 +974,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
LOGGER.fine("Terminate " + reason);
Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE);
jout.setType(IQ.Type.set);
sendPacket(jout);
sendStanza(jout);
triggerSessionClosed(reason);
}
@ -1035,7 +1035,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// errorPacket.addExtension(jingleError);
// NO! Let the normal state machinery do all of the sending.
// getConnection().sendPacket(perror);
// getConnection().sendStanza(perror);
LOGGER.severe("Error sent: " + errorPacket.toXML());
}
return errorPacket;
@ -1094,7 +1094,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Save the session-initiate packet ID, so that we can respond to it.
sessionInitPacketID = jingle.getStanzaId();
sendPacket(jingle);
sendStanza(jingle);
// Now setup to track the media negotiators, so that we know when (if) to send a session-accept.
setupListeners();

View file

@ -613,7 +613,7 @@ public abstract class TransportCandidate {
String id = null;
byte[] send = null;
byte[] receive = null;
DatagramPacket sendPacket = null;
DatagramPacket sendStanza = null;
List<DatagramListener> listeners = new ArrayList<DatagramListener>();
List<ResultListener> resultListeners = new ArrayList<ResultListener>();
boolean enabled = true;