diff options
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r-- | webclient/room/room-controller.js | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index e54751ef6d..5d1c65641e 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -1,3 +1,19 @@ +/* +Copyright 2014 matrix.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + angular.module('RoomController', []) .controller('RoomController', ['$scope', '$http', '$timeout', '$routeParams', '$location', 'matrixService', function($scope, $http, $timeout, $routeParams, $location, matrixService) { @@ -11,7 +27,8 @@ angular.module('RoomController', []) $scope.messages = []; $scope.members = {}; $scope.stopPoll = false; - + + $scope.imageURLToSend = ""; $scope.userIDToInvite = ""; var shortPoll = function() { @@ -106,17 +123,14 @@ angular.module('RoomController', []) var member = $scope.members[chunk.content.user_id]; if ("state" in chunk.content) { - var ONLINE = 2; - var AWAY = 1; - var OFFLINE = 0; - if (chunk.content.state === ONLINE) { + if (chunk.content.state === "online") { member.presenceState = "online"; } - else if (chunk.content.state === OFFLINE) { + else if (chunk.content.state === "offline") { member.presenceState = "offline"; } - else if (chunk.content.state === AWAY) { - member.presenceState = "away"; + else if (chunk.content.state === "unavailable") { + member.presenceState = "unavailable"; } } @@ -208,6 +222,16 @@ angular.module('RoomController', []) }); }; + $scope.sendImage = function(url) { + matrixService.sendImageMessage($scope.room_id, url).then( + function() { + console.log("Image sent"); + }, + function(reason) { + $scope.feedback = "Failed to send image: " + reason; + }); + }; + $scope.$on('$destroy', function(e) { console.log("onDestroyed: Stopping poll."); $scope.stopPoll = true; |