From 82a74fabc978d554384351aae13996059c827550 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Sun, 25 Jan 2015 16:32:59 +0100 Subject: set jingle file transfer to offer after iq offer has returned --- .../xmpp/jingle/JingleConnection.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index 843cf1e6..2d949e21 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -36,8 +36,6 @@ public class JingleConnection implements Downloadable { protected static final int JINGLE_STATUS_INITIATED = 0; protected static final int JINGLE_STATUS_ACCEPTED = 1; - protected static final int JINGLE_STATUS_TERMINATED = 2; - protected static final int JINGLE_STATUS_CANCELED = 3; protected static final int JINGLE_STATUS_FINISHED = 4; protected static final int JINGLE_STATUS_TRANSMITTING = 5; protected static final int JINGLE_STATUS_FAILED = 99; @@ -360,7 +358,6 @@ public class JingleConnection implements Downloadable { } private void sendInitRequest() { - this.mXmppConnectionService.markMessage(this.message, Message.STATUS_OFFERED); JinglePacket packet = this.bootstrapPacket("session-initiate"); Content content = new Content(this.contentCreator, this.contentName); if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE) { @@ -379,8 +376,19 @@ public class JingleConnection implements Downloadable { content.setTransportId(this.transportId); content.socks5transport().setChildren(getCandidatesAsElements()); packet.setContent(content); - this.sendJinglePacket(packet); - this.mJingleStatus = JINGLE_STATUS_INITIATED; + this.sendJinglePacket(packet,new OnIqPacketReceived() { + + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + if (packet.getType() != IqPacket.TYPE.ERROR) { + mJingleStatus = JINGLE_STATUS_INITIATED; + mXmppConnectionService.markMessage(message, Message.STATUS_OFFERED); + } else { + fail(); + } + } + }); + } } @@ -451,10 +459,13 @@ public class JingleConnection implements Downloadable { } private void sendJinglePacket(JinglePacket packet) { - // Log.d(Config.LOGTAG,packet.toString()); account.getXmppConnection().sendIqPacket(packet, responseListener); } + private void sendJinglePacket(JinglePacket packet, OnIqPacketReceived callback) { + account.getXmppConnection().sendIqPacket(packet,callback); + } + private boolean receiveAccept(JinglePacket packet) { Content content = packet.getJingleContent(); mergeCandidates(JingleCandidate.parse(content.socks5transport() -- cgit v1.2.3