Keep track of people's presence and query that when we update the members list.

This commit is contained in:
Erik Johnston 2014-08-22 10:50:38 +01:00
parent 74c90f7815
commit 6118a102c1
2 changed files with 10 additions and 3 deletions

View file

@ -35,6 +35,8 @@ angular.module('eventHandlerService', [])
$rootScope.events = {
rooms: {}, // will contain roomId: { messages:[], members:{userid1: event} }
};
$rootScope.presence = {};
var initRoom = function(room_id) {
if (!(room_id in $rootScope.events.rooms)) {
@ -91,6 +93,7 @@ angular.module('eventHandlerService', [])
};
var handlePresence = function(event, isLiveEvent) {
$rootScope.presence[event.content.user_id] = event;
$rootScope.$broadcast(PRESENCE_EVENT, event, isLiveEvent);
};