summary refs log tree commit diff
path: root/webclient/room
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room')
-rw-r--r--webclient/room/room-controller.js40
-rw-r--r--webclient/room/room.html17
2 files changed, 47 insertions, 10 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;
diff --git a/webclient/room/room.html b/webclient/room/room.html
index 5e947a03e1..87d3458af5 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -14,7 +14,7 @@
                     <img class="userAvatarGradient" src="img/gradient.png" width="80" height="24"/>
                     <div class="userName">{{ info.displayname || name }}</div>
                 </td>
-                <td class="userPresence" ng-class="info.presenceState === 'online' ? 'online' : (info.presenceState === 'away' ? 'away' : '')" />
+                <td class="userPresence" ng-class="info.presenceState === 'online' ? 'online' : (info.presenceState === 'unavailable' ? 'unavailable' : '')" />
         </table>
     </div>
     
@@ -32,7 +32,8 @@
                 <td ng-class="!msg.content.membership_target ? (msg.content.msgtype === 'm.emote' ? 'emote text' : 'text') : ''">
                     <div class="bubble">
                         {{ msg.content.msgtype === "m.emote" ? ("* " + (members[msg.user_id].displayname || msg.user_id) + " ") : "" }}
-                        {{ msg.content.body }}
+                        {{ msg.content.msgtype === "m.text" ? msg.content.body : "" }}
+                        <img class="image" ng-hide='msg.content.msgtype !== "m.image"' src="{{ msg.content.url }}" alt="{{ msg.content.body }}"/>
                     </div>
                 </td>
                 <td class="rightBlock">
@@ -62,6 +63,18 @@
                         {{ feedback }}
                     </td>
                 </tr>
+                <tr>
+                    <td>
+                    </td>
+                    <td>
+                        <input class="mainInput" ng-model="imageURLToSend" ng-enter="sendImage()" placeholder="Image URL"/>
+                    </td>
+                    <td  width="100px">
+                        <button ng-click="sendImage(imageURLToSend)">Send Image</button>
+                    </td>
+                    <td>
+                    </td>
+                </tr>
             </table>
 
             <span>