From: plugd Date: Wed, 21 Aug 2024 12:44:53 +0000 (+0200) Subject: Duplicate REP detection implemented. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=555e70facaa91c82e830dae3022355ed5cee6faf;p=qwikboard.git Duplicate REP detection implemented. --- diff --git a/qwikboard b/qwikboard index edb9d1d..4c91169 100755 --- a/qwikboard +++ b/qwikboard @@ -459,7 +459,7 @@ local function store_nncp_userdata() for uid,tab in pairs(nncp_userdata) do fh:write("nncp_userdata[" .. string.format("%q",uid) .. "] = {\n") for k,v in pairs(tab) do - fh:write(k .. ": " string.format(%q, v) .. ",\n") + fh:write("\t" .. k .. "=" .. string.format("%q", v) .. ",\n") end fh:write("}\n") end @@ -483,6 +483,9 @@ exec: { end restore_nncp_userdata() + if not nncp_userdata[node_id] then + nncp_userdata[node_id] = {} + end local input_string = io.stdin:read("*all") @@ -490,10 +493,10 @@ exec: { local handle = string.match(input_string, "^%s*get%s+(%w+)%s*$") if handle then - nncp_userdata[node_id].handle = user_name + nncp_userdata[node_id].handle = handle store_nncp_userdata() else - handle = nncp_userdata.handle[node_id] + handle = nncp_userdata[node_id].handle end if not handle then @@ -510,8 +513,11 @@ exec: { qwk.build_qwk(handle, out_file_name) + print(qb.nncp_file .. " " .. out_file_name .. " " .. + node_id .. ":" .. qb.bbsid .. ".QWK") os.execute(qb.nncp_file .. " " .. out_file_name .. " " .. node_id .. ":" .. qb.bbsid .. ".QWK") + -- fs.copy(out_file_name, qb.path .. "/blah.qwk") fs.rmfile(out_file_name) @@ -539,7 +545,7 @@ exec: { local md5 = fs.getmd5(rep_file_name) local stored_md5 = nncp_userdata[node_id].md5 - if stored_md5 and (md5 ~= stored_md5) then + if stored_md5 and md5 == stored_md5 then print("Error: Duplicate REP submission detected. Skipping.") return false end