assert(posix.rmdir(dirname))
end
+function fs.rmfile(filename)
+ posix.unlink(filename)
+end
+
function fs.copy(filename, destfilename)
src = assert(io.open(filename,"r"))
dest = assert(io.open(destfilename,"w"))
local qwk = {}
+function qwk.build_qwk(user_name, qwk_filename)
+ local work_dir = fs.mktempdir()
+
+ -- CONTROL.DAT
+ qwk.write_control(work_dir, user_name)
+
+ -- Copy BBS welcome, news and goodbye files
+
+ fs.copy(qb.path .. "/notices/hello", work_dir .. "/HELLO")
+ fs.copy(qb.path .. "/notices/news", work_dir .. "/NEWS")
+ fs.copy(qb.path .. "/notices/goodbye", work_dir .. "/GOODBYE")
+
+ -- Pack messages
+
+ qwk.write_message(work_dir)
+
+ -- Create archive in outgoing
+
+ os.execute(qb.zip .. " -rj " ..
+ qb.path .. "/" .. qwk_filename ..
+ " " .. work_dir)
+
+ fs.rmdir(work_dir, true)
+end
+
+
function qwk.write_control(target_dir, user_name)
local cf = assert(io.open(target_dir .. "/CONTROL.DAT", "w"))
end
msg.text = string.gsub(msg.text, "\xe3", "\n")
- msg.number = get_next_msg_number(qb, conf_num)
- set_next_msg_number(qb, conf_num, msg.number+1)
+ msg.number = get_next_msg_number(conf_num)
+ set_next_msg_number(conf_num, msg.number+1)
- append_new_msg(qb, conf_num, msg)
+ append_new_msg(conf_num, msg)
print("Processed message for conference " .. qb.conferences[conf_num+1] .. ".")
return
end
- local user_name = arg[1]
- local qwk_filename = arg[2]
-
- local work_dir = fs.mktempdir()
-
- -- CONTROL.DAT
- qwk.write_control(work_dir, qb, user_name)
-
- -- Copy BBS welcome, news and goodbye files
-
- fs.copy(qb.path .. "/notices/hello", work_dir .. "/HELLO")
- fs.copy(qb.path .. "/notices/news", work_dir .. "/NEWS")
- fs.copy(qb.path .. "/notices/goodbye", work_dir .. "/GOODBYE")
-
- -- Pack messages
-
- qwk.write_message(work_dir, qb)
-
- -- Create archive in outgoing
-
- os.execute(qb.zip .. " -rj " ..
- qb.path .. "/" .. qwk_filename ..
- " " .. work_dir)
-
- fs.rmdir(work_dir, true)
+ qwk.build_qwk(arg[1], arg[2])
end
-- repin: read REP file in
to their neigh entry in the /etc/nncp.hjson file
exec: {
- offline: ["/usr/local/bin/qwikboard /var/qb/ nncp_handler"]
+ offline: ["/usr/local/bin/qwikboard", "/var/bbs/" "nncp_handler"]
}]]
+ return false
end
+ local input_string = io.stdin:read("*all")
+
+ if string.match(string.lower(input_string), "get.*") then
+ print("Building QWK packet for user '" .. user_name .. "'")
+ -- Construct QWK packet
+
+ local out_file_name = os.tmpname()
+ qwk.build_qwk(user_name, out_file_name)
+
+ os.execute(qb.nncp-file .. " " .. out_file_name ..
+ user_name .. ":" .. qb.bbsid .. ".QWK")
+
+ fs.rmfile(out_file_name)
+
+ else
+ print("Accepting REP packet from user '" .. user_name .. "'")
+ -- Accept REP packet
+
+ -- TODO
+
+ end
end
-- Main