Search in sources :

Example 21 with Content

use of eu.siacs.conversations.xmpp.jingle.stanzas.Content in project Conversations by siacs.

the class JingleFileTransferConnection method sendFallbackToIbb.

private void sendFallbackToIbb() {
    Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": sending fallback to ibb");
    final JinglePacket packet = this.bootstrapPacket(JinglePacket.Action.TRANSPORT_REPLACE);
    final Content content = new Content(this.contentCreator, this.contentName);
    content.setSenders(this.contentSenders);
    this.transportId = JingleConnectionManager.nextRandomId();
    content.setTransport(new IbbTransportInfo(this.transportId, this.ibbBlockSize));
    packet.addJingleContent(content);
    this.sendJinglePacket(packet);
}
Also used : JinglePacket(eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket) Content(eu.siacs.conversations.xmpp.jingle.stanzas.Content) IbbTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo)

Example 22 with Content

use of eu.siacs.conversations.xmpp.jingle.stanzas.Content in project Conversations by siacs.

the class JingleFileTransferConnection method sendCandidateUsed.

private void sendCandidateUsed(final String cid) {
    JinglePacket packet = bootstrapPacket(JinglePacket.Action.TRANSPORT_INFO);
    final Content content = new Content(this.contentCreator, this.contentName);
    content.setSenders(this.contentSenders);
    content.setTransport(new S5BTransportInfo(this.transportId, new Element("candidate-used").setAttribute("cid", cid)));
    packet.addJingleContent(content);
    this.sentCandidate = true;
    if ((receivedCandidate) && (mJingleStatus == JINGLE_STATUS_ACCEPTED)) {
        connect();
    }
    this.sendJinglePacket(packet);
}
Also used : JinglePacket(eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket) Content(eu.siacs.conversations.xmpp.jingle.stanzas.Content) Element(eu.siacs.conversations.xml.Element) S5BTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.S5BTransportInfo)

Example 23 with Content

use of eu.siacs.conversations.xmpp.jingle.stanzas.Content in project Conversations by siacs.

the class JingleFileTransferConnection method sendAcceptSocks.

private void sendAcceptSocks() {
    gatherAndConnectDirectCandidates();
    this.jingleConnectionManager.getPrimaryCandidate(this.id.account, isInitiator(), (success, candidate) -> {
        final JinglePacket packet = bootstrapPacket(JinglePacket.Action.SESSION_ACCEPT);
        final Content content = new Content(contentCreator, contentName);
        content.setSenders(this.contentSenders);
        content.setDescription(this.description);
        if (success && candidate != null && !equalCandidateExists(candidate)) {
            final JingleSocks5Transport socksConnection = new JingleSocks5Transport(this, candidate);
            connections.put(candidate.getCid(), socksConnection);
            socksConnection.connect(new OnTransportConnected() {

                @Override
                public void failed() {
                    Log.d(Config.LOGTAG, "connection to our own proxy65 candidate failed");
                    content.setTransport(new S5BTransportInfo(transportId, getOurCandidates()));
                    packet.addJingleContent(content);
                    sendJinglePacket(packet);
                    connectNextCandidate();
                }

                @Override
                public void established() {
                    Log.d(Config.LOGTAG, "connected to proxy65 candidate");
                    mergeCandidate(candidate);
                    content.setTransport(new S5BTransportInfo(transportId, getOurCandidates()));
                    packet.addJingleContent(content);
                    sendJinglePacket(packet);
                    connectNextCandidate();
                }
            });
        } else {
            Log.d(Config.LOGTAG, "did not find a proxy65 candidate for ourselves");
            content.setTransport(new S5BTransportInfo(transportId, getOurCandidates()));
            packet.addJingleContent(content);
            sendJinglePacket(packet);
            connectNextCandidate();
        }
    });
}
Also used : JinglePacket(eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket) Content(eu.siacs.conversations.xmpp.jingle.stanzas.Content) S5BTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.S5BTransportInfo)

Example 24 with Content

use of eu.siacs.conversations.xmpp.jingle.stanzas.Content in project Conversations by siacs.

the class JingleFileTransferConnection method sendCandidateError.

private void sendCandidateError() {
    Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": sending candidate error");
    JinglePacket packet = bootstrapPacket(JinglePacket.Action.TRANSPORT_INFO);
    Content content = new Content(this.contentCreator, this.contentName);
    content.setSenders(this.contentSenders);
    content.setTransport(new S5BTransportInfo(this.transportId, new Element("candidate-error")));
    packet.addJingleContent(content);
    this.sentCandidate = true;
    this.sendJinglePacket(packet);
    if (receivedCandidate && mJingleStatus == JINGLE_STATUS_ACCEPTED) {
        connect();
    }
}
Also used : JinglePacket(eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket) Content(eu.siacs.conversations.xmpp.jingle.stanzas.Content) Element(eu.siacs.conversations.xml.Element) S5BTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.S5BTransportInfo)

Example 25 with Content

use of eu.siacs.conversations.xmpp.jingle.stanzas.Content in project Conversations by siacs.

the class RtpContentMap method toJinglePacket.

JinglePacket toJinglePacket(final JinglePacket.Action action, final String sessionId) {
    final JinglePacket jinglePacket = new JinglePacket(action, sessionId);
    if (this.group != null) {
        jinglePacket.addGroup(this.group);
    }
    for (Map.Entry<String, DescriptionTransport> entry : this.contents.entrySet()) {
        final Content content = new Content(Content.Creator.INITIATOR, entry.getKey());
        if (entry.getValue().description != null) {
            content.addChild(entry.getValue().description);
        }
        content.addChild(entry.getValue().transport);
        jinglePacket.addJingleContent(content);
    }
    return jinglePacket;
}
Also used : JinglePacket(eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket) Content(eu.siacs.conversations.xmpp.jingle.stanzas.Content) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map)

Aggregations

Content (eu.siacs.conversations.xmpp.jingle.stanzas.Content)25 JinglePacket (eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket)18 S5BTransportInfo (eu.siacs.conversations.xmpp.jingle.stanzas.S5BTransportInfo)9 Element (eu.siacs.conversations.xml.Element)7 IbbTransportInfo (eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo)7 GenericTransportInfo (eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo)4 Conversation (eu.siacs.conversations.entities.Conversation)3 FileNotFoundException (java.io.FileNotFoundException)3 XmppAxolotlMessage (eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage)2 Account (eu.siacs.conversations.entities.Account)2 Message (eu.siacs.conversations.entities.Message)2 OnIqPacketReceived (eu.siacs.conversations.xmpp.OnIqPacketReceived)2 IqPacket (eu.siacs.conversations.xmpp.stanzas.IqPacket)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 AbstractConnectionManager (eu.siacs.conversations.services.AbstractConnectionManager)1 Jid (eu.siacs.conversations.xmpp.Jid)1 Jid (eu.siacs.conversations.xmpp.jid.Jid)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1