From 5dda027d1b5ed3848749883b001ce273e03dd3e6 Mon Sep 17 00:00:00 2001 From: plugd Date: Mon, 30 Sep 2024 14:24:41 +0200 Subject: [PATCH] Added QWK-based phlog publishing. --- qwikboard | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/qwikboard b/qwikboard index 238088e..29797f8 100755 --- a/qwikboard +++ b/qwikboard @@ -208,6 +208,19 @@ local function export_messages(handle, output_file_name) fh:close() end +local function mirror_new_msg(mirror_dir, msg) + local fname = msg.number .. "--" .. msg.date .. "-" .. + msg.from .. ".txt" + local fh = assert(io.open(mirror_dir .. "/" .. fname, "w")) + + local header = msg.subject .. " (" .. msg.from .. ", " .. msg.date .. ")" + fh:write(header .. "\n") + fh:write(string.rep("-",#header) .. "\n\n") + fh:write(msg.text .. "\n") + fh:close() +end + + --- QWK formatting --- local qwk = {} @@ -412,7 +425,14 @@ function qwk.process_reply(mf, user_name) append_new_msg(conf_num, msg) - print("Processed message for conference " .. qb.conferences[conf_num+1] .. ".") + local conf_name = qb.conferences[conf_num+1] + + print("Processed message for conference " .. conf_name .. ".") + + if qb.conference_mirrors and qb.conference_mirrors[conf_name] then + mirror_new_msg(qb.conference_mirrors[conf_name], msg) + end + end --- Commands --- @@ -445,6 +465,13 @@ qb.conferences = { "Meta" } +-- Use the following table to specify directories +-- to mirror conference contents to in a plain text +-- format suitable for a BBS phlog: +-- qb.conference_mirrors = { +-- ["Meta"] = "/path/to/mirror" +-- } + -- Ensure these point to zip and unzip on your system qb.zip = "/usr/bin/zip" qb.unzip = "/usr/bin/unzip" @@ -552,7 +579,7 @@ be made accessible by user (node) NODENAME by adding the following to their neigh entry in the /etc/nncp.hjson file exec: { - offline: ["/usr/local/bin/qwikboard", "/var/bbs/" "nncp_handler"] + offline: ["/usr/local/bin/qwikboard", "/var/bbs/", "nncp_handler"] }]] return false end -- 2.20.1