let jingle connection and manager handle message status
This commit is contained in:
parent
b6a7e56bf6
commit
4151b72a6e
|
@ -349,7 +349,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
message.setCounterpart(conversation.getNextCounterpart());
|
message.setCounterpart(conversation.getNextCounterpart());
|
||||||
message.setType(Message.TYPE_FILE);
|
message.setType(Message.TYPE_FILE);
|
||||||
message.setStatus(Message.STATUS_OFFERED);
|
|
||||||
String path = getFileBackend().getOriginalPath(uri);
|
String path = getFileBackend().getOriginalPath(uri);
|
||||||
if (path!=null) {
|
if (path!=null) {
|
||||||
message.setRelativeFilePath(path);
|
message.setRelativeFilePath(path);
|
||||||
|
@ -392,7 +391,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
message.setCounterpart(conversation.getNextCounterpart());
|
message.setCounterpart(conversation.getNextCounterpart());
|
||||||
message.setType(Message.TYPE_IMAGE);
|
message.setType(Message.TYPE_IMAGE);
|
||||||
message.setStatus(Message.STATUS_OFFERED);
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -813,7 +811,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
Presences presences = contact.getPresences();
|
Presences presences = contact.getPresences();
|
||||||
if ((message.getCounterpart() != null)
|
if ((message.getCounterpart() != null)
|
||||||
&& (presences.has(message.getCounterpart().getResourcepart()))) {
|
&& (presences.has(message.getCounterpart().getResourcepart()))) {
|
||||||
markMessage(message, Message.STATUS_OFFERED);
|
|
||||||
mJingleConnectionManager.createNewConnection(message);
|
mJingleConnectionManager.createNewConnection(message);
|
||||||
} else {
|
} else {
|
||||||
if (presences.size() == 1) {
|
if (presences.size() == 1) {
|
||||||
|
@ -823,7 +820,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
markMessage(message, Message.STATUS_OFFERED);
|
|
||||||
mJingleConnectionManager.createNewConnection(message);
|
mJingleConnectionManager.createNewConnection(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,9 @@ public class JingleConnection implements Downloadable {
|
||||||
this.mergeCandidates(JingleCandidate.parse(content.socks5transport()
|
this.mergeCandidates(JingleCandidate.parse(content.socks5transport()
|
||||||
.getChildren()));
|
.getChildren()));
|
||||||
this.fileOffer = packet.getJingleContent().getFileOffer();
|
this.fileOffer = packet.getJingleContent().getFileOffer();
|
||||||
|
|
||||||
|
mXmppConnectionService.sendIqPacket(account,packet.generateResponse(IqPacket.TYPE.RESULT),null);
|
||||||
|
|
||||||
if (fileOffer != null) {
|
if (fileOffer != null) {
|
||||||
Element fileSize = fileOffer.findChild("size");
|
Element fileSize = fileOffer.findChild("size");
|
||||||
Element fileNameElement = fileOffer.findChild("name");
|
Element fileNameElement = fileOffer.findChild("name");
|
||||||
|
@ -381,6 +384,7 @@ public class JingleConnection implements Downloadable {
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
if (packet.getType() != IqPacket.TYPE.ERROR) {
|
if (packet.getType() != IqPacket.TYPE.ERROR) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": other party received offer");
|
||||||
mJingleStatus = JINGLE_STATUS_INITIATED;
|
mJingleStatus = JINGLE_STATUS_INITIATED;
|
||||||
mXmppConnectionService.markMessage(message, Message.STATUS_OFFERED);
|
mXmppConnectionService.markMessage(message, Message.STATUS_OFFERED);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.annotation.SuppressLint;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.entities.Downloadable;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.AbstractConnectionManager;
|
import eu.siacs.conversations.services.AbstractConnectionManager;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
@ -58,7 +59,12 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public JingleConnection createNewConnection(Message message) {
|
public JingleConnection createNewConnection(Message message) {
|
||||||
|
Downloadable old = message.getDownloadable();
|
||||||
|
if (old != null) {
|
||||||
|
old.cancel();
|
||||||
|
}
|
||||||
JingleConnection connection = new JingleConnection(this);
|
JingleConnection connection = new JingleConnection(this);
|
||||||
|
mXmppConnectionService.markMessage(message,Message.STATUS_WAITING);
|
||||||
connection.init(message);
|
connection.init(message);
|
||||||
this.connections.add(connection);
|
this.connections.add(connection);
|
||||||
return connection;
|
return connection;
|
||||||
|
|
Loading…
Reference in New Issue