Skip to content

Commit

Permalink
wip: Convert remote roomid to federated roomid in received messages
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Jul 17, 2024
1 parent be5d609 commit a86a894
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,38 @@ Signaling.Standalone.prototype.connect = function() {
delete this.callbacks[id]
cb(data)
}

if (this.settings.federation?.roomId) {
const remoteRoomId = this.settings.federation.roomId

let roomIdConverted = false

if (data.room?.roomid === remoteRoomId) {
data.room.roomid = this.signalingRoomJoined
roomIdConverted = true
}
if (data.event?.message?.roomid === remoteRoomId) {
data.event.message.roomid = this.signalingRoomJoined
roomIdConverted = true
}
if (data.event?.update?.roomid === remoteRoomId) {
data.event.update.roomid = this.signalingRoomJoined
roomIdConverted = true
}
if (data.event?.disinvite?.roomid === remoteRoomId) {
data.event.disinvite.roomid = this.signalingRoomJoined
roomIdConverted = true
}
if (data.event?.switchto?.roomid === remoteRoomId) {
data.event.switchto.roomid = this.signalingRoomJoined
roomIdConverted = true
}

if (OC.debug && roomIdConverted) {
console.debug('Received, roomid converted', data)
}
}

this._trigger('onBeforeReceiveMessage', [data])
const message = {}
switch (data.type) {
Expand Down

0 comments on commit a86a894

Please sign in to comment.