Here COMMAND is one of:
newcfg
init
+ qwkout
+ repin
You can also use the -c option to specify an alternative configuration
file. (The default is the file "config.lua" in the current directory.)]]
return posix.mkdtemp("/tmp/obbs-XXXXXX")
end
---- Message parsing ---
+--- Message database parsing ---
local msgs = {}
function Message(msg)
mf:write(string.rep("\0",padding))
end
+function qwk.read_message(archive_dir, obbs, user_name)
+
+ local msg_filename = work_dir .. "/" .. obbs.bbsid .. ".MSG"
+
+ if not fs.exists(msg_filename) then
+ print("Error: MSG file not found.")
+ return
+ end
+
+ local mf = asert(io.open(msg_filename, "r"))
+
+end
+
+
--- Commands ---
local cmd = {}
load_config()
if fs.exists(obbs.path .. "/conferences") or
- fs.exists(obbs.path .. "/incoming") or
fs.exists(obbs.path .. "/outgoing") then
print("One or more OBBS directories already exist. Aborting.")
return
fs.touch(obbs.path .. "conferences/" .. v .. ".msgs")
end
- fs.mkdir(obbs.path .. "incoming")
fs.mkdir(obbs.path .. "outgoing")
end
--- Pack
-function cmd.pack ()
+-- qwkout: generate QWK file
+function cmd.qwkout ()
load_config()
if not arg[1] then
- print "Usage: obbs pack USER"
+ print "Usage: obbs qwkout USER"
return
end
local user_name = arg[1]
- local target_dir = fs.mktempdir()
+ local work_dir = fs.mktempdir()
-- CONTROL.DAT
- qwk.write_control(target_dir, obbs, user_name)
+ qwk.write_control(work_dir, obbs, user_name)
-- Copy BBS welcome, news and goodbye files
if obbs.hello and fs.exists(obbs.hello) then
- fs.copy(obbs.hello, target_dir .. "/HELLO")
+ fs.copy(obbs.hello, work_dir .. "/HELLO")
else
- fs.touch(target_dir .. "/HELLO")
+ fs.touch(work_dir .. "/HELLO")
end
if obbs.news and fs.exists(obbs.news) then
- fs.copy(obbs.news, target_dir .. "/NEWS")
+ fs.copy(obbs.news, work_dir .. "/NEWS")
else
- fs.touch(target_dir .. "/NEWS")
+ fs.touch(work_dir .. "/NEWS")
end
if obbs.news and fs.exists(obbs.goodbye) then
- fs.copy(obbs.goodbye, target_dir .. "/GOODBYE")
+ fs.copy(obbs.goodbye, work_dir .. "/GOODBYE")
else
- fs.touch(target_dir .. "/GOODBYE")
+ fs.touch(work_dir .. "/GOODBYE")
end
-- Pack messages
- qwk.write_message(target_dir, obbs)
+ qwk.write_message(work_dir, obbs)
-- Create archive in outgoing
os.execute("zip -rj " .. obbs.path ..
"/outgoing/" .. obbs.bbsid ..
- ".qwk " .. target_dir)
+ ".qwk " .. work_dir)
+
+ fs.rmdir(work_dir, true)
+end
+
+-- repin: read REP file in
- fs.rmdir(target_dir, true)
+function cmd.repin()
+ load_config()
+
+ if not arg[2] then
+ print "Usage: obbs repin FILE USER"
+ return
+ end
+
+ local rep_filename = arg[1]
+ local user_name = arg[2]
+
+ if not fs.exists(rep_filename) then
+ print("Error: reply packet file '" .. rep_filename .. "' does not exist.")
+ return
+ end
+
+ local work_dir = fs.mktempdir()
+
+ fs.copy(rep_filename, work_dir .. "/repfile.rep")
+ os.execute("unzip " .. work_dir .. "/repfile.rep -d " .. work_dir)
+
+ qwk.read_message(work_dir, obbs, user_name)
+
+ fs.rmdir(work_dir, true)
+
end
-- Main