Allow notes to be sent to other instances of the same participant on separate sockets

This commit is contained in:
Hri7566 2024-09-02 15:17:29 -04:00
parent 062c6bedea
commit 4733ca5139
2 changed files with 12 additions and 9 deletions

View File

@ -66,6 +66,7 @@ This has always been the future intention of this project.
## TODO
- Change `socketsBySocketID` to `socketsByUUID`
- Channel data saving
- Permission groups and permissions
- Probable permission groups: owner, admin, mod, trialmod, default

View File

@ -842,15 +842,17 @@ export class Channel extends EventEmitter {
let sentSocketIDs = new Array<string>();
for (const p of this.ppl) {
socketLoop: for (const socket of socketsBySocketID.values()) {
if (socket.isDestroyed()) continue socketLoop;
if (!socket.socketID) continue socketLoop;
if (socket.getParticipantID() != p.id) continue socketLoop;
if (socket.getParticipantID() == part.id) continue socketLoop;
if (sentSocketIDs.includes(socket.socketID))
continue socketLoop;
socket.sendArray([clientMsg]);
sentSocketIDs.push(socket.socketID);
socketLoop: for (const sock of socketsBySocketID.values()) {
this.logger.debug(`Socket ${sock.getUUID()}`);
if (sock.isDestroyed()) continue socketLoop;
if (!sock.socketID) continue socketLoop;
if (sock.getUUID() == socket.getUUID()) continue socketLoop;
if (sock.getParticipantID() != p.id) continue socketLoop;
//if (socket.getParticipantID() == part.id) continue socketLoop;
if (sentSocketIDs.includes(sock.socketID)) continue socketLoop;
sock.sendArray([clientMsg]);
sentSocketIDs.push(sock.socketID);
}
}
}