set jingle file transfer to offer after iq offer has returned

This commit is contained in:
iNPUTmice 2015-01-25 16:32:59 +01:00
parent e5700f075c
commit 82a74fabc9
1 changed files with 17 additions and 6 deletions

View File

@ -36,8 +36,6 @@ public class JingleConnection implements Downloadable {
protected static final int JINGLE_STATUS_INITIATED = 0; protected static final int JINGLE_STATUS_INITIATED = 0;
protected static final int JINGLE_STATUS_ACCEPTED = 1; 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_FINISHED = 4;
protected static final int JINGLE_STATUS_TRANSMITTING = 5; protected static final int JINGLE_STATUS_TRANSMITTING = 5;
protected static final int JINGLE_STATUS_FAILED = 99; protected static final int JINGLE_STATUS_FAILED = 99;
@ -360,7 +358,6 @@ public class JingleConnection implements Downloadable {
} }
private void sendInitRequest() { private void sendInitRequest() {
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_OFFERED);
JinglePacket packet = this.bootstrapPacket("session-initiate"); JinglePacket packet = this.bootstrapPacket("session-initiate");
Content content = new Content(this.contentCreator, this.contentName); Content content = new Content(this.contentCreator, this.contentName);
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE) { 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.setTransportId(this.transportId);
content.socks5transport().setChildren(getCandidatesAsElements()); content.socks5transport().setChildren(getCandidatesAsElements());
packet.setContent(content); packet.setContent(content);
this.sendJinglePacket(packet); this.sendJinglePacket(packet,new OnIqPacketReceived() {
this.mJingleStatus = JINGLE_STATUS_INITIATED;
@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) { private void sendJinglePacket(JinglePacket packet) {
// Log.d(Config.LOGTAG,packet.toString());
account.getXmppConnection().sendIqPacket(packet, responseListener); account.getXmppConnection().sendIqPacket(packet, responseListener);
} }
private void sendJinglePacket(JinglePacket packet, OnIqPacketReceived callback) {
account.getXmppConnection().sendIqPacket(packet,callback);
}
private boolean receiveAccept(JinglePacket packet) { private boolean receiveAccept(JinglePacket packet) {
Content content = packet.getJingleContent(); Content content = packet.getJingleContent();
mergeCandidates(JingleCandidate.parse(content.socks5transport() mergeCandidates(JingleCandidate.parse(content.socks5transport()