From 33945cbe35587a6624ba82ef4fdcdcf822f54950 Mon Sep 17 00:00:00 2001 From: plugd Date: Thu, 22 Aug 2024 10:18:46 +0200 Subject: [PATCH] Message tables no longer indexed by msg.number. --- qwikboard | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/qwikboard b/qwikboard index 0a85a2b..238088e 100755 --- a/qwikboard +++ b/qwikboard @@ -133,9 +133,17 @@ end --- Message database --- function Message(msg) - msgs[msg.number] = msg + msgs[msg_index] = msg + msg_index = msg_index + 1 end +local function load_messages(conf_name) + msg_index = 1 + msgs = {} + dofile(qb.path .. "/conferences/" .. conf_name .. ".msgs") +end + + local function get_next_msg_number(conf_num) local msgnum_filename = qb.path .. "/conferences/" .. qb.conferences[conf_num+1] .. ".next" @@ -179,8 +187,9 @@ local function export_messages(handle, output_file_name) local fh = assert(io.open(output_file_name, "w")) for cnum,cname in ipairs(qb.conferences) do - msgs = {} - dofile(qb.path .. "/conferences/" .. cname .. ".msgs") + -- msgs = {} + -- dofile(qb.path .. "/conferences/" .. cname .. ".msgs") + load_messages(cname) for i,msg in ipairs(msgs) do if string.match(string.lower(msg.from), "^%s*" .. string.lower(handle) .. "%s*$") then fh:write("MessageArea: " .. cname .. "\n") @@ -271,8 +280,9 @@ function qwk.write_message (target_dir, first_unseen_msgs) mf:write(space_pad("Produced by QWiKBoard.", 128)) for cnum,cname in ipairs(qb.conferences) do - msgs = {} - dofile(qb.path .. "/conferences/" .. cname .. ".msgs") + -- msgs = {} + -- dofile(qb.path .. "/conferences/" .. cname .. ".msgs") + load_messages(cname) for i,msg in ipairs(msgs) do pkt_msg_num = pkt_msg_num + 1 -- 2.20.1