mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-08-05 16:59:10 +00:00
make sure messages aren't sent to unsynced channels
This commit is contained in:
parent
d701496130
commit
79a1228544
3 changed files with 8 additions and 3 deletions
|
@ -35,7 +35,7 @@ That said, it is usable for basic chatting.
|
|||
| Channel lists/searching | ⬜ | ❌ ||
|
||||
| Encrypted rooms | ❌ | ⬜ ||
|
||||
| Rich text | ❌ | ❌ ||
|
||||
| Presence | ❌ | ❌ ||
|
||||
| Presence | ❌ | ❌ | Note that not all homeservers have presence enabled |
|
||||
| Channel renaming <small>(IRCv3)</small> | 🟨 | ❌ | Only when the canonical alias changes |
|
||||
| Message replies <small>(IRCv3)</small> | ✅ | ✅ | Clients without support will still receive the reply message, but it won't be marked as a reply |
|
||||
| Message reactions <small>(IRCv3)</small> | 🟨 | 🟨 | Can't undo reactions yet |
|
||||
|
|
|
@ -30,6 +30,10 @@ export class Channel {
|
|||
this.initialSyncID = setInterval(this.checkChannelSync.bind(this), 2000);
|
||||
}
|
||||
|
||||
isSynced() {
|
||||
return this.syncLocks.size === 0;
|
||||
}
|
||||
|
||||
doInitialSync() {
|
||||
this.syncLocks.add("m.room.canonical_alias");
|
||||
axios.get(`https://${this.ircUser.homeserver}/_matrix/client/v3/rooms/${this.roomId}/event/m.room.canonical_alias?access_token=${this.ircUser.accessToken}`).then(response => {
|
||||
|
@ -69,7 +73,7 @@ export class Channel {
|
|||
}
|
||||
|
||||
checkChannelSync() {
|
||||
if (this.syncLocks.size === 0) {
|
||||
if (this.isSynced()) {
|
||||
if (this.matrixUsers.size === 2 && this.name === this.roomId) {
|
||||
const otherUser = [...this.matrixUsers.values()].filter(m => m.nick !== this.ircUser.nick);
|
||||
this.name = `&${otherUser[0].mxid.substring(1)}`
|
||||
|
|
|
@ -151,7 +151,8 @@ export class IRCUser {
|
|||
for (const roomId of Object.keys(rooms.join)) {
|
||||
const targetChannel = this.getOrCreateIRCChannel(roomId);
|
||||
rooms.join[roomId].timeline.events.forEach((nextEvent: any) => {
|
||||
this.routeMatrixEvent(nextEvent, targetChannel);
|
||||
if (targetChannel.isSynced())
|
||||
this.routeMatrixEvent(nextEvent, targetChannel);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue