From 97aed916029dc974f83e72177be0709e7f57ee68 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 4 Mar 2025 08:39:16 -0600 Subject: [PATCH] lua: update how markRead works --- docs/comlink_channel.3.scd | 4 ++-- src/lua.zig | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/comlink_channel.3.scd b/docs/comlink_channel.3.scd index 02b8ff5..0b01a7e 100644 --- a/docs/comlink_channel.3.scd +++ b/docs/comlink_channel.3.scd @@ -19,8 +19,8 @@ comlink_channel - a lua type representing an IRC channel A *channel* represents an IRC channel. *channel:mark_read* - Mark this channel as read. This will set the READMARKER to the time of - the last received message. + Mark this channel as read. This will update the unread indicator to the + position of the last read message. *channel:send_msg* A method on *channel* which accepts a string (_msg_). _Msg_ is sent to diff --git a/src/lua.zig b/src/lua.zig index bb6d624..8d22a41 100644 --- a/src/lua.zig +++ b/src/lua.zig @@ -461,9 +461,7 @@ const Channel = struct { const lua_type = lua.getField(1, "_ptr"); // [table, lightuserdata] lua.argCheck(lua_type == .light_userdata, 2, "expected lightuserdata"); const channel = lua.toUserdata(irc.Channel, 2) catch unreachable; - channel.markRead() catch |err| { - std.log.err("couldn't mark channel as read: {}", .{err}); - }; + channel.last_read_indicator = channel.last_read; lua.pop(2); // [] return 0; } -- 2.51.2