From 4780b9c709301a1ef04208d68cbc7f46b62a7d78 Mon Sep 17 00:00:00 2001 From: Simon Ser <contact@emersion.fr> Date: Sat, 3 Sep 2022 14:31:56 +0200 Subject: [PATCH] Fetch read marker before backlog for user targets --- components/app.js | 6 ++++++ lib/client.js | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/components/app.js b/components/app.js index 3ecf1b5..78ab59c 100644 --- a/components/app.js +++ b/components/app.js @@ -1128,6 +1128,12 @@ export default class App extends Component { from = receiptFromMessage(lastMsg); } + // Query read marker if this is a user (ie, we haven't received + // the read marker as part of a JOIN burst) + if (client.supportsReadMarker() && client.isNick(target.name)) { + client.fetchReadMarker(target.name); + } + client.fetchHistoryBetween(target.name, from, to, CHATHISTORY_MAX_SIZE).then((result) => { for (let msg of result.messages) { let destBuffers = this.routeMessage(serverID, msg); diff --git a/lib/client.js b/lib/client.js index c887d28..78c3801 100644 --- a/lib/client.js +++ b/lib/client.js @@ -720,6 +720,11 @@ export default class Client extends EventTarget { return chanTypes.indexOf(name[0]) >= 0; } + isNick(name) { + // A dollar sign is used for server-wide broadcasts + return !this.isServer(name) && !this.isChannel(name) && !name.startsWith('$'); + } + setPingInterval(sec) { clearInterval(this.pingIntervalID); this.pingIntervalID = null;