local posix = require "posix"
-local usage = [[Usage: obbs [-c config_file] COMMAND [arguments ...]
+local usage = [[Usage: obbs [-c config_file] COMMAND arguments
Here COMMAND is one of:
newcfg
end
while mf:read(0) do
- qwk.process_reply(mf, obbs)
+ qwk.process_reply(mf, obbs, user_name)
end
end
-function qwk.process_reply(mf, obbs)
+function qwk.process_reply(mf, obbs, user_name)
local msg = {}
mf:read(1) -- Message status (ignore for now)
msg.date = mf:read(8)
msg.time = mf:read(5)
msg.to = string.lower(string.gsub(mf:read(25), " ", ""))
- msg.from = string.lower(string.gsub(mf:read(25), " ", ""))
+ mf:read(25) -- take user name from provided user name instead
+ msg.from = string.lower(string.sub(user_name, 1, 25))
msg.subject = string.gsub(mf:read(25), " ", "")
mf:read(12) -- Password (unused)
msg.replyto = tonumber(mf:read(8))
obbs.path = "." -- Path to OBBS root
obbs.name = "My OBBS Name"
-obbs.bbsid = "MYOBBSID" -- max 8 char
+obbs.bbsid = "MYOBBSID" -- upper case, max 8 char
obbs.sysop = "Sysop Name"
--- obbs.hello_file = "hello"
--- obbs.news_file = "news"
--- obbs.goodbye_file = "goodbye"
-
obbs.conferences = {
"Announcements",
"General",
"Meta"
}
+
+-- Ensure these point to zip and unzip on your system
+obbs.zip = "/usr/bin/zip"
+obbs.unzip = "/usr/bin/unzip"
]]
end
load_config()
if fs.exists(obbs.path .. "/conferences") or
- fs.exists(obbs.path .. "/outgoing") then
+ fs.exists(obbs.path .. "/notices") then
print("One or more OBBS directories already exist. Aborting.")
return false
end
io.open(obbs.path .. "/conferences/" .. v .. ".next", "w"):write(1)
end
- fs.mkdir(obbs.path .. "/outgoing")
+ fs.mkdir(obbs.path .. "/notices")
+ fs.touch(obbs.path .. "/notices/hello")
+ fs.touch(obbs.path .. "/notices/news")
+ fs.touch(obbs.path .. "/notices/goodbye")
end
-- qwkout: generate QWK file
function cmd.qwkout ()
load_config()
- if not arg[1] then
- print "Usage: obbs qwkout USER"
+ if not arg[2] then
+ print [[Usage: obbs qwkout USER OUTFILE
+
+Here OUTFILE is is the name of the output QWK file relative to
+the current directory. The QWK file is traditionally named
+BBSID.QWK, with BBSID being the 8 character ID of the BBS.]]
return
end
local user_name = arg[1]
+ local qwk_filename = arg[2]
local work_dir = fs.mktempdir()
-- Copy BBS welcome, news and goodbye files
- if obbs.hello and fs.exists(obbs.hello) then
- fs.copy(obbs.hello, work_dir .. "/HELLO")
- else
- fs.touch(work_dir .. "/HELLO")
- end
-
- if obbs.news and fs.exists(obbs.news) then
- fs.copy(obbs.news, work_dir .. "/NEWS")
- else
- fs.touch(work_dir .. "/NEWS")
- end
-
- if obbs.news and fs.exists(obbs.goodbye) then
- fs.copy(obbs.goodbye, work_dir .. "/GOODBYE")
- else
- fs.touch(work_dir .. "/GOODBYE")
- end
+ fs.copy(obbs.path .. "/notices/hello", work_dir .. "/HELLO")
+ fs.copy(obbs.path .. "/notices/news", work_dir .. "/NEWS")
+ fs.copy(obbs.path .. "/notices/goodbye", work_dir .. "/GOODBYE")
-- Pack messages
-- Create archive in outgoing
- os.execute("zip -rj " .. obbs.path ..
- "/outgoing/" .. obbs.bbsid ..
- ".qwk " .. work_dir)
+ os.execute(obbs.zip .. " -rj " ..
+ obbs.path .. "/" .. qwk_filename ..
+ " " .. work_dir)
fs.rmdir(work_dir, true)
end
load_config()
if not arg[2] then
- print "Usage: obbs repin FILE USER"
+ print [[Usage: obbs repin INFILE USER
+
+Here INFILE is the name of the REP file to import new messages
+from. This is traditionally named BBSID.rep, where BBSID is
+the 8 character max ID of the BBS, but obbs doesn't care about this.]]
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)
+ os.execute(obbs.unzip .. " " .. work_dir .. "/repfile.rep -d " .. work_dir)
qwk.process_replies(work_dir, obbs, user_name)