From 6b2720653a5cc964cf519cac5ba46df47f3bc001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 1 Oct 2020 19:07:25 +0200 Subject: [PATCH] Always pass the session id in "NICK_CHANGE" PeerConnectionEvents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the NICK_CHANGE event include either the session id or the user id, depending on whether the participant was a guest or a user. However, as the session id is also known for users the event can be unified to always include the session id only. This also fixes an exception when handling the "NICK_CHANGE" event, as the session id was got from the user id given in the event, but if the event already included the session id the look up failed and the session id was replaced with an empty value. This in turn caused an exception when trying to use the view for the now invalid session id. Now the session id provided in the event is always directly used. Signed-off-by: Daniel Calviño Sánchez --- .../nextcloud/talk/controllers/CallController.java | 11 +++-------- .../talk/webrtc/MagicPeerConnectionWrapper.java | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index 2f605148f..75b3d54bc 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -2031,16 +2031,11 @@ public class CallController extends BaseController { } } - private void gotNick(String sessionOrUserId, String nick, boolean isFromAnEvent, String type) { - if (isFromAnEvent && hasExternalSignalingServer) { - // get session based on userId - sessionOrUserId = webSocketClient.getSessionForUserId(sessionOrUserId); - } - - sessionOrUserId += "+" + type; + private void gotNick(String sessionId, String nick, boolean isFromAnEvent, String type) { + sessionId += "+" + type; if (relativeLayout != null) { - RelativeLayout relativeLayout = remoteRenderersLayout.findViewWithTag(sessionOrUserId); + RelativeLayout relativeLayout = remoteRenderersLayout.findViewWithTag(sessionId); TextView textView = relativeLayout.findViewById(R.id.peer_nick_text_view); if (!textView.getText().equals(nick)) { textView.setText(nick); diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java index 103129dd5..b514fc186 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java @@ -279,7 +279,7 @@ public class MagicPeerConnectionWrapper { if (dataChannelMessage.getPayload() != null) { HashMap payloadHashMap = (HashMap) dataChannelMessage.getPayload(); EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType - .NICK_CHANGE, payloadHashMap.get("userid"), payloadHashMap.get("name"), null, videoStreamType)); + .NICK_CHANGE, sessionId, payloadHashMap.get("name"), null, videoStreamType)); } }