diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index b70dab72f..2e6436b3d 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -162,6 +162,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe break; case RINGING: binding.status.setText(R.string.rtp_state_ringing); + break; + case DECLINED_OR_BUSY: + binding.status.setText(R.string.rtp_state_declined_or_busy); + break; } } @@ -174,13 +178,25 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe this.binding.rejectCall.hide(); this.binding.endCall.hide(); this.binding.acceptCall.hide(); + } else if (state == RtpEndUserState.DECLINED_OR_BUSY) { + this.binding.rejectCall.hide(); + this.binding.endCall.setImageResource(R.drawable.ic_clear_white_48dp); + this.binding.endCall.show(); + this.binding.endCall.setOnClickListener(this::exit); + this.binding.acceptCall.hide(); } else { this.binding.rejectCall.hide(); + this.binding.endCall.setImageResource(R.drawable.ic_call_end_white_48dp); this.binding.endCall.show(); + this.binding.endCall.setOnClickListener(this::endCall); this.binding.acceptCall.hide(); } } + private void exit(View view) { + finish(); + } + private Contact getWith() { final AbstractJingleConnection.Id id = requireRtpConnection().getId(); final Account account = id.account; @@ -197,7 +213,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe @Override public void onJingleRtpConnectionUpdate(Account account, Jid with, final String sessionId, RtpEndUserState state) { - Log.d(Config.LOGTAG,"onJingleRtpConnectionUpdate("+state+")"); + Log.d(Config.LOGTAG, "onJingleRtpConnectionUpdate(" + state + ")"); if (with.isBareJid()) { updateRtpSessionProposalState(with, state); return; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 2c306816f..f0928dfb7 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -77,6 +77,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { if (sessionId == null) { return; } + final boolean carbonCopy = from.asBareJid().equals(account.getJid().asBareJid()); final Jid with; if (account.getJid().asBareJid().equals(from.asBareJid())) { with = to; @@ -103,7 +104,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to react to proposed " + namespace + " session"); } } else if ("proceed".equals(message.getName())) { - if (!with.equals(from)) { + if (carbonCopy) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignore carbon copied proceed"); return; } @@ -115,7 +116,20 @@ public class JingleConnectionManager extends AbstractConnectionManager { rtpConnection.transitionOrThrow(AbstractJingleConnection.State.PROPOSED); rtpConnection.deliveryMessage(from, message); } else { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with + " to deliver proceed"); + } + } + } else if ("reject".equals(message.getName())) { + if (carbonCopy) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignore carbon copied reject"); + return; + } + final RtpSessionProposal proposal = new RtpSessionProposal(account, with.asBareJid(), sessionId); + synchronized (rtpSessionProposals) { + if (rtpSessionProposals.remove(proposal) != null) { + mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, proposal.with, proposal.sessionId, RtpEndUserState.DECLINED_OR_BUSY); + } else { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with + " to deliver reject"); } } } else { diff --git a/src/main/res/drawable-hdpi/ic_clear_white_48dp.png b/src/main/res/drawable-hdpi/ic_clear_white_48dp.png new file mode 100644 index 000000000..6b717e0dd Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_clear_white_48dp.png differ diff --git a/src/main/res/drawable-mdpi/ic_clear_white_48dp.png b/src/main/res/drawable-mdpi/ic_clear_white_48dp.png new file mode 100644 index 000000000..b7c7ffd0e Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_clear_white_48dp.png differ diff --git a/src/main/res/drawable-xhdpi/ic_clear_white_48dp.png b/src/main/res/drawable-xhdpi/ic_clear_white_48dp.png new file mode 100644 index 000000000..396419219 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_clear_white_48dp.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_clear_white_48dp.png b/src/main/res/drawable-xxhdpi/ic_clear_white_48dp.png new file mode 100644 index 000000000..4927bc242 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_clear_white_48dp.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_clear_white_48dp.png b/src/main/res/drawable-xxxhdpi/ic_clear_white_48dp.png new file mode 100644 index 000000000..bb21ce03a Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_clear_white_48dp.png differ diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 47e635368..0a1d6f78c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -896,6 +896,7 @@ Dismiss Locating devices Ringing + Busy View %1$d Participant View %1$d Participants