mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Add support for room names
This commit is contained in:
parent
7fc84c7019
commit
073a42cc95
@ -97,7 +97,12 @@ angular.module('matrixWebClient')
|
|||||||
// Else, build the name from its users
|
// Else, build the name from its users
|
||||||
var room = $rootScope.events.rooms[room_id];
|
var room = $rootScope.events.rooms[room_id];
|
||||||
if (room) {
|
if (room) {
|
||||||
if (room.members) {
|
var room_name_event = room["m.room.name"];
|
||||||
|
|
||||||
|
if (room_name_event) {
|
||||||
|
roomName = room_name_event.content.name;
|
||||||
|
}
|
||||||
|
else if (room.members) {
|
||||||
// Limit the room renaming to 1:1 room
|
// Limit the room renaming to 1:1 room
|
||||||
if (2 === Object.keys(room.members).length) {
|
if (2 === Object.keys(room.members).length) {
|
||||||
for (var i in room.members) {
|
for (var i in room.members) {
|
||||||
|
@ -34,6 +34,7 @@ angular.module('eventHandlerService', [])
|
|||||||
var PRESENCE_EVENT = "PRESENCE_EVENT";
|
var PRESENCE_EVENT = "PRESENCE_EVENT";
|
||||||
var POWERLEVEL_EVENT = "POWERLEVEL_EVENT";
|
var POWERLEVEL_EVENT = "POWERLEVEL_EVENT";
|
||||||
var CALL_EVENT = "CALL_EVENT";
|
var CALL_EVENT = "CALL_EVENT";
|
||||||
|
var NAME_EVENT = "NAME_EVENT";
|
||||||
|
|
||||||
var InitialSyncDeferred = $q.defer();
|
var InitialSyncDeferred = $q.defer();
|
||||||
|
|
||||||
@ -115,6 +116,15 @@ angular.module('eventHandlerService', [])
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var handleRoomName = function(event, isLiveEvent) {
|
||||||
|
console.log("handleRoomName " + isLiveEvent);
|
||||||
|
|
||||||
|
initRoom(event.room_id);
|
||||||
|
|
||||||
|
$rootScope.events.rooms[event.room_id][event.type] = event;
|
||||||
|
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
|
||||||
|
};
|
||||||
|
|
||||||
var handleCallEvent = function(event, isLiveEvent) {
|
var handleCallEvent = function(event, isLiveEvent) {
|
||||||
$rootScope.$broadcast(CALL_EVENT, event, isLiveEvent);
|
$rootScope.$broadcast(CALL_EVENT, event, isLiveEvent);
|
||||||
};
|
};
|
||||||
@ -126,6 +136,7 @@ angular.module('eventHandlerService', [])
|
|||||||
PRESENCE_EVENT: PRESENCE_EVENT,
|
PRESENCE_EVENT: PRESENCE_EVENT,
|
||||||
POWERLEVEL_EVENT: POWERLEVEL_EVENT,
|
POWERLEVEL_EVENT: POWERLEVEL_EVENT,
|
||||||
CALL_EVENT: CALL_EVENT,
|
CALL_EVENT: CALL_EVENT,
|
||||||
|
NAME_EVENT: NAME_EVENT,
|
||||||
|
|
||||||
|
|
||||||
handleEvent: function(event, isLiveEvent) {
|
handleEvent: function(event, isLiveEvent) {
|
||||||
@ -149,7 +160,9 @@ angular.module('eventHandlerService', [])
|
|||||||
case 'm.room.power_levels':
|
case 'm.room.power_levels':
|
||||||
handlePowerLevels(event, isLiveEvent);
|
handlePowerLevels(event, isLiveEvent);
|
||||||
break;
|
break;
|
||||||
|
case 'm.room.name':
|
||||||
|
handleRoomName(event, isLiveEvent);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Unable to handle event type " + event.type);
|
console.log("Unable to handle event type " + event.type);
|
||||||
console.log(JSON.stringify(event, undefined, 4));
|
console.log(JSON.stringify(event, undefined, 4));
|
||||||
|
Loading…
Reference in New Issue
Block a user