Change call signalling messages to be their own types of room events rather than room messages with different msgtypes: room messages should be things that the client can display as a unit message to the user.

This commit is contained in:
David Baker 2014-08-29 13:23:01 +01:00
parent 171d8b032f
commit 5308e3026a
5 changed files with 27 additions and 18 deletions

View file

@ -31,6 +31,7 @@ angular.module('eventHandlerService', [])
var MSG_EVENT = "MSG_EVENT";
var MEMBER_EVENT = "MEMBER_EVENT";
var PRESENCE_EVENT = "PRESENCE_EVENT";
var CALL_EVENT = "CALL_EVENT";
var InitialSyncDeferred = $q.defer();
@ -94,11 +95,16 @@ angular.module('eventHandlerService', [])
$rootScope.presence[event.content.user_id] = event;
$rootScope.$broadcast(PRESENCE_EVENT, event, isLiveEvent);
};
var handleCallEvent = function(event, isLiveEvent) {
$rootScope.$broadcast(CALL_EVENT, event, isLiveEvent);
};
return {
MSG_EVENT: MSG_EVENT,
MEMBER_EVENT: MEMBER_EVENT,
PRESENCE_EVENT: PRESENCE_EVENT,
CALL_EVENT: CALL_EVENT,
handleEvent: function(event, isLiveEvent) {
@ -116,6 +122,9 @@ angular.module('eventHandlerService', [])
console.log("Unable to handle event type " + event.type);
break;
}
if (event.type.indexOf('m.call.') == 0) {
handleCallEvent(event, isLiveEvent);
}
},
// isLiveEvents determines whether notifications should be shown, whether