diff --git a/README.md b/README.md index b0a61e1..bbf989d 100644 --- a/README.md +++ b/README.md @@ -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 (IRCv3) | 🟨 | ❌ | Only when the canonical alias changes | | Message replies (IRCv3) | ✅ | ✅ | Clients without support will still receive the reply message, but it won't be marked as a reply | | Message reactions (IRCv3) | 🟨 | 🟨 | Can't undo reactions yet | diff --git a/src/Channel.ts b/src/Channel.ts index 758737b..d4e96a3 100644 --- a/src/Channel.ts +++ b/src/Channel.ts @@ -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)}` diff --git a/src/IRCUser.ts b/src/IRCUser.ts index f76c3dd..6d9d495 100644 --- a/src/IRCUser.ts +++ b/src/IRCUser.ts @@ -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); }); } }