summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-06 00:14:02 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-06 00:14:02 +0100
commitc03c25530487e5051affb9685f6f7b0c37abf8e5 (patch)
treefa1d0826c145bd082589c51117d1551262899bec /webclient/components
parentAdd m.roo.aliases (diff)
downloadsynapse-c03c25530487e5051affb9685f6f7b0c37abf8e5.tar.xz
Better call bar (visually: still lacks ring[back] tones).
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/matrix-call.js5
-rw-r--r--webclient/components/matrix/matrix-service.js9
2 files changed, 12 insertions, 2 deletions
diff --git a/webclient/components/matrix/matrix-call.js b/webclient/components/matrix/matrix-call.js
index 3e13e4e81f..3cb5e8b693 100644
--- a/webclient/components/matrix/matrix-call.js
+++ b/webclient/components/matrix/matrix-call.js
@@ -41,6 +41,7 @@ angular.module('MatrixCall', [])
         this.room_id = room_id;
         this.call_id = "c" + new Date().getTime();
         this.state = 'fledgling';
+        this.didConnect = false;
     }
 
     navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
@@ -52,6 +53,7 @@ angular.module('MatrixCall', [])
         matrixPhoneService.callPlaced(this);
         navigator.getUserMedia({audio: true, video: false}, function(s) { self.gotUserMediaForInvite(s); }, function(e) { self.getUserMediaFailed(e); });
         self.state = 'wait_local_media';
+        this.direction = 'outbound';
     };
 
     MatrixCall.prototype.initWithInvite = function(msg) {
@@ -64,6 +66,7 @@ angular.module('MatrixCall', [])
         this.peerConn.onaddstream = function(s) { self.onAddStream(s); };
         this.peerConn.setRemoteDescription(new RTCSessionDescription(this.msg.offer), self.onSetRemoteDescriptionSuccess, self.onSetRemoteDescriptionError);
         this.state = 'ringing';
+        this.direction = 'inbound';
     };
 
     MatrixCall.prototype.answer = function() {
@@ -204,10 +207,12 @@ angular.module('MatrixCall', [])
     };
 
     MatrixCall.prototype.onIceConnectionStateChanged = function() {
+        if (this.state == 'ended') return; // because ICE can still complete as we're ending the call
         console.trace("Ice connection state changed to: "+this.peerConn.iceConnectionState);
         // ideally we'd consider the call to be connected when we get media but chrome doesn't implement nay of the 'onstarted' events yet
         if (this.peerConn.iceConnectionState == 'completed' || this.peerConn.iceConnectionState == 'connected') {
             this.state = 'connected';
+            this.didConnect = true;
             $rootScope.$apply();
         }
     };
diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js
index 8a0223979c..55cbd4bc14 100644
--- a/webclient/components/matrix/matrix-service.js
+++ b/webclient/components/matrix/matrix-service.js
@@ -295,6 +295,11 @@ angular.module('matrixService', [])
             return doRequest("GET", path);
         },
         
+        // get a user's profile
+        getProfile: function(userId) {
+            return this.getProfileInfo(userId);
+        },
+
         // get a display name for this user ID
         getDisplayName: function(userId) {
             return this.getProfileInfo(userId, "displayname");
@@ -328,8 +333,8 @@ angular.module('matrixService', [])
         },
 
         getProfileInfo: function(userId, info_segment) {
-            var path = "/profile/$user_id/" + info_segment;
-            path = path.replace("$user_id", userId);
+            var path = "/profile/"+userId
+            if (info_segment) path += '/' + info_segment;
             return doRequest("GET", path);
         },