From 672289cb561a380e3a23c4161bc830e9b8b77099 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 12 Mar 2025 14:44:09 -0500 Subject: [PATCH] irc: use internal timestamp for markread if no drafts/read-marker --- src/irc.zig | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/irc.zig b/src/irc.zig index 84c0aa9..2d8b22f 100644 --- a/src/irc.zig +++ b/src/irc.zig @@ -533,17 +533,19 @@ pub const Channel = struct { pub fn markRead(self: *Channel) Allocator.Error!void { self.has_unread = false; self.has_unread_highlight = false; - const last_msg = self.messages.getLastOrNull() orelse return; - if (last_msg.timestamp_s > self.last_read) { - const time_tag = last_msg.getTag("time") orelse return; - try self.client.print( - "MARKREAD {s} timestamp={s}\r\n", - .{ - self.name, - time_tag, - }, - ); - } + if (self.client.caps.@"draft/read-marker") { + const last_msg = self.messages.getLastOrNull() orelse return; + if (last_msg.timestamp_s > self.last_read) { + const time_tag = last_msg.getTag("time") orelse return; + try self.client.print( + "MARKREAD {s} timestamp={s}\r\n", + .{ + self.name, + time_tag, + }, + ); + } + } else self.last_read = @intCast(std.time.timestamp()); } pub fn contentWidget(self: *Channel) vxfw.Widget { -- 2.51.2