Search in sources :

Example 11 with JinglePacket

use of de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket in project Pix-Art-Messenger by kriztan.

the class JingleConnection method sendCancel.

private void sendCancel() {
    JinglePacket packet = bootstrapPacket("session-terminate");
    Reason reason = new Reason();
    reason.addChild("cancel");
    packet.setReason(reason);
    this.sendJinglePacket(packet);
}
Also used : JinglePacket(de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket) Reason(de.pixart.messenger.xmpp.jingle.stanzas.Reason)

Example 12 with JinglePacket

use of de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket in project Pix-Art-Messenger by kriztan.

the class JingleConnection method sendCandidateError.

private void sendCandidateError() {
    JinglePacket packet = bootstrapPacket("transport-info");
    Content content = new Content(this.contentCreator, this.contentName);
    content.setTransportId(this.transportId);
    content.socks5transport().addChild("candidate-error");
    packet.setContent(content);
    this.sentCandidate = true;
    if (receivedCandidate && mJingleStatus == JINGLE_STATUS_ACCEPTED) {
        connect();
    }
    this.sendJinglePacket(packet);
}
Also used : JinglePacket(de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket) Content(de.pixart.messenger.xmpp.jingle.stanzas.Content)

Example 13 with JinglePacket

use of de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket in project Pix-Art-Messenger by kriztan.

the class JingleConnection method receiveFallbackToIbb.

private boolean receiveFallbackToIbb(JinglePacket packet) {
    Log.d(Config.LOGTAG, "receiving fallack to ibb");
    String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
    if (receivedBlockSize != null) {
        int bs = Integer.parseInt(receivedBlockSize);
        if (bs > this.ibbBlockSize) {
            this.ibbBlockSize = bs;
        }
    }
    this.transportId = packet.getJingleContent().getTransportId();
    this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
    JinglePacket answer = bootstrapPacket("transport-accept");
    Content content = new Content("initiator", "a-file-offer");
    content.setTransportId(this.transportId);
    content.ibbTransport().setAttribute("block-size", this.ibbBlockSize);
    answer.setContent(content);
    if (initiating()) {
        this.sendJinglePacket(answer, new OnIqPacketReceived() {

            @Override
            public void onIqPacketReceived(Account account, IqPacket packet) {
                if (packet.getType() == IqPacket.TYPE.RESULT) {
                    Log.d(Config.LOGTAG, account.getJid().toBareJid() + " recipient ACKed our transport-accept. creating ibb");
                    transport.connect(onIbbTransportConnected);
                }
            }
        });
    } else {
        this.transport.receive(file, onFileTransmissionStatusChanged);
        this.sendJinglePacket(answer);
    }
    return true;
}
Also used : Account(de.pixart.messenger.entities.Account) JinglePacket(de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket) OnIqPacketReceived(de.pixart.messenger.xmpp.OnIqPacketReceived) Content(de.pixart.messenger.xmpp.jingle.stanzas.Content) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Aggregations

JinglePacket (de.pixart.messenger.xmpp.jingle.stanzas.JinglePacket)13 Content (de.pixart.messenger.xmpp.jingle.stanzas.Content)7 IqPacket (de.pixart.messenger.xmpp.stanzas.IqPacket)4 Account (de.pixart.messenger.entities.Account)2 OnIqPacketReceived (de.pixart.messenger.xmpp.OnIqPacketReceived)2 Reason (de.pixart.messenger.xmpp.jingle.stanzas.Reason)2 Conversation (de.pixart.messenger.entities.Conversation)1 Element (de.pixart.messenger.xml.Element)1 Tag (de.pixart.messenger.xml.Tag)1 MessagePacket (de.pixart.messenger.xmpp.stanzas.MessagePacket)1 PresencePacket (de.pixart.messenger.xmpp.stanzas.PresencePacket)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1