make rtp proposal tracked by SM. fixes #3983
This commit is contained in:
parent
9f869d3895
commit
6cab0ad496
|
@ -152,6 +152,7 @@ import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||||
import eu.siacs.conversations.xmpp.forms.Data;
|
import eu.siacs.conversations.xmpp.forms.Data;
|
||||||
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
|
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
||||||
|
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
|
||||||
import eu.siacs.conversations.xmpp.jingle.Media;
|
import eu.siacs.conversations.xmpp.jingle.Media;
|
||||||
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
|
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
|
||||||
import eu.siacs.conversations.xmpp.mam.MamReference;
|
import eu.siacs.conversations.xmpp.mam.MamReference;
|
||||||
|
@ -251,10 +252,23 @@ public class XmppConnectionService extends Service {
|
||||||
private final OnMessageAcknowledged mOnMessageAcknowledgedListener = new OnMessageAcknowledged() {
|
private final OnMessageAcknowledged mOnMessageAcknowledgedListener = new OnMessageAcknowledged() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMessageAcknowledged(Account account, String uuid) {
|
public boolean onMessageAcknowledged(final Account account, final Jid to, final String id) {
|
||||||
|
if (id.startsWith(JingleRtpConnection.JINGLE_MESSAGE_PROPOSE_ID_PREFIX)) {
|
||||||
|
final String sessionId = id.substring(JingleRtpConnection.JINGLE_MESSAGE_PROPOSE_ID_PREFIX.length());
|
||||||
|
mJingleConnectionManager.updateProposedSessionDiscovered(
|
||||||
|
account,
|
||||||
|
to,
|
||||||
|
sessionId,
|
||||||
|
JingleConnectionManager.DeviceDiscoveryState.SEARCHING_ACKNOWLEDGED
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
final Jid bare = to.asBareJid();
|
||||||
|
|
||||||
for (final Conversation conversation : getConversations()) {
|
for (final Conversation conversation : getConversations()) {
|
||||||
if (conversation.getAccount() == account) {
|
if (conversation.getAccount() == account && conversation.getJid().asBareJid().equals(bare)) {
|
||||||
Message message = conversation.findUnsentMessageWithUuid(uuid);
|
final Message message = conversation.findUnsentMessageWithUuid(id);
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
message.setErrorMessage(null);
|
message.setErrorMessage(null);
|
||||||
|
@ -4281,7 +4295,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessagePacket(Account account, MessagePacket packet) {
|
public void sendMessagePacket(Account account, MessagePacket packet) {
|
||||||
XmppConnection connection = account.getXmppConnection();
|
final XmppConnection connection = account.getXmppConnection();
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.sendMessagePacket(packet);
|
connection.sendMessagePacket(packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
|
||||||
public interface OnMessageAcknowledged {
|
public interface OnMessageAcknowledged {
|
||||||
boolean onMessageAcknowledged(Account account, String id);
|
boolean onMessageAcknowledged(Account account, Jid to, String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,10 +661,14 @@ public class XmppConnection implements Runnable {
|
||||||
if (Config.EXTENDED_SM_LOGGING) {
|
if (Config.EXTENDED_SM_LOGGING) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": server acknowledged stanza #" + mStanzaQueue.keyAt(i));
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": server acknowledged stanza #" + mStanzaQueue.keyAt(i));
|
||||||
}
|
}
|
||||||
AbstractAcknowledgeableStanza stanza = mStanzaQueue.valueAt(i);
|
final AbstractAcknowledgeableStanza stanza = mStanzaQueue.valueAt(i);
|
||||||
if (stanza instanceof MessagePacket && acknowledgedListener != null) {
|
if (stanza instanceof MessagePacket && acknowledgedListener != null) {
|
||||||
MessagePacket packet = (MessagePacket) stanza;
|
final MessagePacket packet = (MessagePacket) stanza;
|
||||||
acknowledgedMessages |= acknowledgedListener.onMessageAcknowledged(account, packet.getId());
|
final String id = packet.getId();
|
||||||
|
final Jid to = packet.getTo();
|
||||||
|
if (id != null && to != null) {
|
||||||
|
acknowledgedMessages |= acknowledgedListener.onMessageAcknowledged(account, to, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mStanzaQueue.removeAt(i);
|
mStanzaQueue.removeAt(i);
|
||||||
i--;
|
i--;
|
||||||
|
|
|
@ -133,7 +133,9 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (this.rtpSessionProposals) {
|
synchronized (this.rtpSessionProposals) {
|
||||||
return this.rtpSessionProposals.containsValue(DeviceDiscoveryState.DISCOVERED) || this.rtpSessionProposals.containsValue(DeviceDiscoveryState.SEARCHING);
|
return this.rtpSessionProposals.containsValue(DeviceDiscoveryState.DISCOVERED)
|
||||||
|
|| this.rtpSessionProposals.containsValue(DeviceDiscoveryState.SEARCHING)
|
||||||
|
|| this.rtpSessionProposals.containsValue(DeviceDiscoveryState.SEARCHING_ACKNOWLEDGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +156,9 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
for (Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry : this.rtpSessionProposals.entrySet()) {
|
for (Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry : this.rtpSessionProposals.entrySet()) {
|
||||||
final RtpSessionProposal proposal = entry.getKey();
|
final RtpSessionProposal proposal = entry.getKey();
|
||||||
final DeviceDiscoveryState state = entry.getValue();
|
final DeviceDiscoveryState state = entry.getValue();
|
||||||
final boolean openProposal = state == DeviceDiscoveryState.DISCOVERED || state == DeviceDiscoveryState.SEARCHING;
|
final boolean openProposal = state == DeviceDiscoveryState.DISCOVERED
|
||||||
|
|| state == DeviceDiscoveryState.SEARCHING
|
||||||
|
|| state == DeviceDiscoveryState.SEARCHING_ACKNOWLEDGED;
|
||||||
if (openProposal
|
if (openProposal
|
||||||
&& proposal.account == account
|
&& proposal.account == account
|
||||||
&& proposal.with.equals(with.asBareJid())
|
&& proposal.with.equals(with.asBareJid())
|
||||||
|
@ -772,11 +776,12 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DeviceDiscoveryState {
|
public enum DeviceDiscoveryState {
|
||||||
SEARCHING, DISCOVERED, FAILED;
|
SEARCHING, SEARCHING_ACKNOWLEDGED, DISCOVERED, FAILED;
|
||||||
|
|
||||||
public RtpEndUserState toEndUserState() {
|
public RtpEndUserState toEndUserState() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case SEARCHING:
|
case SEARCHING:
|
||||||
|
case SEARCHING_ACKNOWLEDGED:
|
||||||
return RtpEndUserState.FINDING_DEVICE;
|
return RtpEndUserState.FINDING_DEVICE;
|
||||||
case DISCOVERED:
|
case DISCOVERED:
|
||||||
return RtpEndUserState.RINGING;
|
return RtpEndUserState.RINGING;
|
||||||
|
|
Loading…
Reference in New Issue