an experimental irc client

irc: use internal timestamp for markread if no drafts/read-marker

rockorager.dev 672289cb fcdb37db

verified
+13 -11
+13 -11
src/irc.zig
··· 533 533 pub fn markRead(self: *Channel) Allocator.Error!void { 534 534 self.has_unread = false; 535 535 self.has_unread_highlight = false; 536 - const last_msg = self.messages.getLastOrNull() orelse return; 537 - if (last_msg.timestamp_s > self.last_read) { 538 - const time_tag = last_msg.getTag("time") orelse return; 539 - try self.client.print( 540 - "MARKREAD {s} timestamp={s}\r\n", 541 - .{ 542 - self.name, 543 - time_tag, 544 - }, 545 - ); 546 - } 536 + if (self.client.caps.@"draft/read-marker") { 537 + const last_msg = self.messages.getLastOrNull() orelse return; 538 + if (last_msg.timestamp_s > self.last_read) { 539 + const time_tag = last_msg.getTag("time") orelse return; 540 + try self.client.print( 541 + "MARKREAD {s} timestamp={s}\r\n", 542 + .{ 543 + self.name, 544 + time_tag, 545 + }, 546 + ); 547 + } 548 + } else self.last_read = @intCast(std.time.timestamp()); 547 549 } 548 550 549 551 pub fn contentWidget(self: *Channel) vxfw.Widget {