summary refs log tree commit diff
path: root/webclient/app-controller.js
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-11 15:23:06 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-11 15:24:18 +0100
commitfb082cf50ff1c48f651eb46fdf7398bacb85ad16 (patch)
tree612d909a44fb86e75da3395b60a62090939d4bfa /webclient/app-controller.js
parentAdded support of copy/paste of multi lines content (diff)
downloadsynapse-fb082cf50ff1c48f651eb46fdf7398bacb85ad16.tar.xz
start towards glare support (currently not much better but no worse than before) including fixing a lot of self/var self/this fails that caused chaos when we started to have more than one call in play.
Diffstat (limited to 'webclient/app-controller.js')
-rw-r--r--webclient/app-controller.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index 8383533cfb..945f71ed20 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -135,9 +135,9 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
     });
 
     $rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) {
-        console.trace("incoming call");
+        console.log("incoming call");
         if ($rootScope.currentCall && $rootScope.currentCall.state != 'ended') {
-            console.trace("rejecting call because we're already in a call");
+            console.log("rejecting call because we're already in a call");
             call.hangup();
             return;
         }
@@ -146,6 +146,13 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
         $rootScope.currentCall = call;
     });
 
+    $rootScope.$on(matrixPhoneService.REPLACED_CALL_EVENT, function(ngEvent, oldCall, newCall) {
+        console.log("call ID "+oldCall+" has been replaced by call ID "+newCall+"!");
+        newCall.onError = $scope.onCallError;
+        newCall.onHangup = $scope.onCallHangup;
+        $rootScope.currentCall = newCall;
+    });
+
     $scope.answerCall = function() {
         $rootScope.currentCall.answer();
     };
@@ -161,7 +168,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
     $rootScope.onCallHangup = function(call) {
         if (call == $rootScope.currentCall) {
             $timeout(function(){
-                $rootScope.currentCall = undefined;
+                if (call == $rootScope.currentCall) $rootScope.currentCall = undefined;
             }, 4070);
         }
     }