From a11d506bf0f448d420f6e0ea96e71a35beed2d2d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 8 Apr 2020 10:46:26 +0200 Subject: [PATCH] support reject --- .../conversations/ui/RtpSessionActivity.java | 18 +++++++++++++++++- .../xmpp/jingle/JingleConnectionManager.java | 18 ++++++++++++++++-- .../res/drawable-hdpi/ic_clear_white_48dp.png | Bin 0 -> 347 bytes .../res/drawable-mdpi/ic_clear_white_48dp.png | Bin 0 -> 257 bytes .../drawable-xhdpi/ic_clear_white_48dp.png | Bin 0 -> 436 bytes .../drawable-xxhdpi/ic_clear_white_48dp.png | Bin 0 -> 524 bytes .../drawable-xxxhdpi/ic_clear_white_48dp.png | Bin 0 -> 702 bytes src/main/res/values/strings.xml | 1 + 8 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/main/res/drawable-hdpi/ic_clear_white_48dp.png create mode 100644 src/main/res/drawable-mdpi/ic_clear_white_48dp.png create mode 100644 src/main/res/drawable-xhdpi/ic_clear_white_48dp.png create mode 100644 src/main/res/drawable-xxhdpi/ic_clear_white_48dp.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_clear_white_48dp.png 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 0000000000000000000000000000000000000000..6b717e0dda8649aa3b5f1d6851ba0dd20cc4ea66 GIT binary patch literal 347 zcmV-h0i^zkP)vMkH8EXyh{JTRaptiwcq@D(P;=ehLbl?EMKm*m7(@7_siS}}k zNFtnck{HL4mc!ypcyUoqJV~4rM^fS3C#iAnkyJU3biCmDy`VZLOv=LXld^HVq zOA5m<3jYBNi%A&<@ZO?$P9};P4Y5CjG5$M&YXI45J{s}~# zf|&?x1_gn4B7+hS@X!l}&!voFhmZP^sujifL@~PKMMM~{6xH}^g$q7WOzwCQ5vHTU z6`v~H@rlA8e;CUh_(b84zg=+ih`wG<)HiJjzSlQx5#CnjMR;A)R^jtaTa9;7rSy)7O%~`cm?ZjXImW?6TYRT<;U^@VKiSj`soFk00000NkvXX Hu0mjfhD&W| literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..39641921925f090e33df2767a4ee5e6d5911194f GIT binary patch literal 436 zcmV;l0ZaagP)32ETvhYyB39D^lU%DgQgv&#U%8l^-CA%qY@2qA=!B5=cm zUgehujQG*l{{`@rPr!f|fEk^>KI9WteE@ilV6HEl&_rJ@p_zU*;T}RirIc{5NocNLm*7JGdV(AM zYYDFOvk5~8{Z*t_>U=!XvoehUSEh=adIga45oe)B9kGgT}7UT3Cirmr(oHPv^YQ1-p=Hlh5u;xggf zX{&yw+El-OrrKQJRl@b7x{HLmNkj95`a#LLnW{Veb2C+!`ppt#r)=g4@?c8RY{yJj~W@W|h^mU4q`i)2y~Rw@J`jIh$1%|In!~{Tb{nMqaxlgb+dq eA%qY@zJ@mriVM?qfwL0;0000u<8%L#D-{7p<|%4@n9yOn_`BhIN5Se>F5&yX=g3#NJr`MF8+b%+$B8BmnCIPndHJicwnxNiHsOkk&+*iSjJjmJe1$X)E`JjJT7)$8wm+rVMFtHWj=GUBk= z=ke_WBcq(Ni(Gt*T>KFvWMaekQTMd-+4Z${JvAkNz8{`iZ@=$N<$){y-?y+S-FBWF zc%ND6E)u%gY+Qf)aIpRD!%Emtu>HZuoi`qLflzYyjmJ==_n}6?N_~C6*PuJQ&feR6 zYOCY7g5y!UB2LPQOzopr0M`r!;Q#;t literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..bb21ce03a954236e431072961e57a9af317a68ee GIT binary patch literal 702 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE8Azrw%`pX1#sNMdu0Z-fiD3KGM@>L&0wqCy z!3?}ShmRdO`suT!jkVQ|?c1(&>uh9TVAAq*aSW-5dwa(*PbyG=?IF*RV-kihZ5`K%4WRLhrBZ|F1`7uibhLg{ZBIk7Kr&_g(j2|L0$mnjU|z+@1e% z{_2El_4Br`m;D!N@TR><^S_qFH|K*>>P3Bi{};6}`w@O{jy%`0KLG|0+M76ml3&-? zf<;^8xsLr^op5ab;s?KN7A73n|1I6-!KZJ@2XChy;+OYxY&^ivnr1J4<8MsD_u|I8 z=UL0(oIB@P+mD>LUf}ThIn(a>+;8giHvHas;2j#Ldp`HQdX>HMKz%R%#ykKTa{oN* zn{x3D_hS##RWkni%KGHH_=NlM40ZL5ch1LueXv~&ELG0<`z~BvHRI2}Fm?Z!esN5c z=lUh}w!P<1%!R`-{g>Z7Z~7PXZTY;v*R@4%{1vaTc7MP8d-tC@jSIgQI=pXZ+AELh zx+isd7H{h6tdFBR7R?*?a|M6wg*yVpML^D9);Hh9Z4TPUe30S)u`Accm+AO6Hmvuct~^wI jTJ;u6{1-oD!MDismiss Locating devices Ringing + Busy View %1$d Participant View %1$d Participants