Search in sources :

Example 6 with Jingle

use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.

the class JingleUtil method createSessionAccept.

public Jingle createSessionAccept(FullJid recipient, String sessionId, JingleContent.Creator contentCreator, String contentName, JingleContent.Senders contentSenders, JingleContentDescription description, JingleContentTransport transport) {
    Jingle.Builder jb = Jingle.builder(connection);
    jb.setResponder(connection.getUser()).setAction(JingleAction.session_accept).setSessionId(sessionId);
    JingleContent.Builder cb = JingleContent.getBuilder();
    cb.setCreator(contentCreator).setName(contentName).setSenders(contentSenders).setDescription(description).setTransport(transport);
    Jingle jingle = jb.addJingleContent(cb.build()).build();
    jingle.setTo(recipient);
    jingle.setFrom(connection.getUser());
    return jingle;
}
Also used : Jingle(org.jivesoftware.smackx.jingle.element.Jingle) JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent)

Example 7 with Jingle

use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.

the class JingleS5BTransportManager method createProxyError.

public Jingle createProxyError(FullJid remote, FullJid initiator, String sessionId, JingleContent.Senders senders, JingleContent.Creator creator, String name, String streamId) {
    Jingle.Builder jb = Jingle.builder(connection());
    jb.setSessionId(sessionId).setAction(JingleAction.transport_info).setInitiator(initiator);
    JingleContent.Builder cb = JingleContent.getBuilder();
    cb.setSenders(senders).setCreator(creator).setName(name);
    JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder();
    tb.setStreamId(sessionId).setProxyError().setStreamId(streamId);
    Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
    jingle.setTo(remote);
    jingle.setFrom(getConnection().getUser().asFullJidOrThrow());
    return jingle;
}
Also used : Jingle(org.jivesoftware.smackx.jingle.element.Jingle) JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent) JingleS5BTransport(org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport)

Example 8 with Jingle

use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.

the class JingleS5BTransportManager method createCandidateActivated.

public Jingle createCandidateActivated(FullJid remote, FullJid initiator, String sessionId, JingleContent.Senders senders, JingleContent.Creator creator, String name, String streamId, String candidateId) {
    Jingle.Builder jb = Jingle.builder(connection());
    jb.setInitiator(initiator).setSessionId(sessionId).setAction(JingleAction.transport_info);
    JingleContent.Builder cb = JingleContent.getBuilder();
    cb.setName(name).setCreator(creator).setSenders(senders);
    JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder();
    tb.setStreamId(streamId).setCandidateActivated(candidateId);
    Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
    jingle.setFrom(getConnection().getUser().asFullJidOrThrow());
    jingle.setTo(remote);
    return jingle;
}
Also used : Jingle(org.jivesoftware.smackx.jingle.element.Jingle) JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent) JingleS5BTransport(org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport)

Example 9 with Jingle

use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.

the class JingleS5BTransportManager method createCandidateError.

public Jingle createCandidateError(FullJid remote, FullJid initiator, String sessionId, JingleContent.Senders senders, JingleContent.Creator creator, String name, String streamId) {
    Jingle.Builder jb = Jingle.builder(connection());
    jb.setSessionId(sessionId).setInitiator(initiator).setAction(JingleAction.transport_info);
    JingleContent.Builder cb = JingleContent.getBuilder();
    cb.setName(name).setCreator(creator).setSenders(senders);
    JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder();
    tb.setCandidateError().setStreamId(streamId);
    Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
    jingle.setFrom(getConnection().getUser().asFullJidOrThrow());
    jingle.setTo(remote);
    return jingle;
}
Also used : Jingle(org.jivesoftware.smackx.jingle.element.Jingle) JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent) JingleS5BTransport(org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport)

Example 10 with Jingle

use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.

the class JingleTest method parserTest.

@Test
public void parserTest() throws XmppStringprepException {
    String sessionId = "testSessionId";
    Jingle.Builder builder = Jingle.builder("id");
    builder.setSessionId(sessionId);
    builder.setAction(JingleAction.session_initiate);
    FullJid romeo = JidCreate.fullFrom("romeo@montague.lit/orchard");
    FullJid juliet = JidCreate.fullFrom("juliet@capulet.lit/balcony");
    builder.setInitiator(romeo);
    builder.setResponder(juliet);
    Jingle jingle = builder.build();
    assertNotNull(jingle);
    assertEquals(romeo, jingle.getInitiator());
    assertEquals(juliet, jingle.getResponder());
    assertEquals(jingle.getAction(), JingleAction.session_initiate);
    assertEquals(sessionId, jingle.getSid());
    String xml = "<jingle xmlns='urn:xmpp:jingle:1' " + "initiator='romeo@montague.lit/orchard' " + "responder='juliet@capulet.lit/balcony' " + "action='session-initiate' " + "sid='" + sessionId + "'>" + "</jingle>";
    assertTrue(jingle.toXML().toString().contains(xml));
}
Also used : Jingle(org.jivesoftware.smackx.jingle.element.Jingle) FullJid(org.jxmpp.jid.FullJid) Test(org.junit.jupiter.api.Test)

Aggregations

Jingle (org.jivesoftware.smackx.jingle.element.Jingle)19 JingleContent (org.jivesoftware.smackx.jingle.element.JingleContent)13 JingleS5BTransport (org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 EnumSource (org.junit.jupiter.params.provider.EnumSource)3 JingleReason (org.jivesoftware.smackx.jingle.element.JingleReason)2 FullJid (org.jxmpp.jid.FullJid)2 IOException (java.io.IOException)1 TimeoutException (java.util.concurrent.TimeoutException)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 StandardExtensionElement (org.jivesoftware.smack.packet.StandardExtensionElement)1 XmlElement (org.jivesoftware.smack.packet.XmlElement)1 Socks5BytestreamSession (org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession)1 Bytestream (org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream)1 JingleAction (org.jivesoftware.smackx.jingle.element.JingleAction)1 JingleContentDescription (org.jivesoftware.smackx.jingle.element.JingleContentDescription)1 JingleContentTransport (org.jivesoftware.smackx.jingle.element.JingleContentTransport)1 Test (org.junit.jupiter.api.Test)1