aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2018-12-07 19:12:42 +0000
committerSolderpunk <solderpunk@sdf.org>2018-12-07 19:12:42 +0000
commit4cb9f06ae945d344c1fedd9dad49b397442313df (patch)
tree15da7c44b6f1f081cd65d4b83144f78371616db4
parentAdd new thread support. (diff)
Add new board support.
-rwxr-xr-xtelem.lua24
1 files changed, 23 insertions, 1 deletions
diff --git a/telem.lua b/telem.lua
index 36dfb02..10f10db 100755
--- a/telem.lua
+++ b/telem.lua
@@ -95,6 +95,28 @@ function get_posts(thread)
return posts
end
+function do_board()
+ -- Creates a new (empty) board
+
+ -- Get details
+ print("New board name? Max 19 chars") -- TODO: Check and enforce 19 chars
+ board = string.upper(io.read())
+ print("Description?")
+ desc = io.read()
+ -- Create directory
+ board_dir = path.join("/home/solderpunk/bbs/boards/", board)
+ lfs.mkdir(board_dir)
+ -- Write topic file
+ topic_file = path.join(board_dir, "topic")
+ file.write(topic_file, desc)
+ -- Update representation of BBS
+ boards[board] = true
+ table.insert(board_names, board)
+ table.sort(board_names)
+ -- Done!
+ print("Board created.")
+end
+
function do_go()
print("Which board?")
board = string.upper(io.read())
@@ -306,7 +328,7 @@ dispatch["="] = do_unimplemented
dispatch["M"] = do_unimplemented
dispatch["n"] = do_new
dispatch["r"] = do_unimplemented
-dispatch["b"] = do_unimplemented
+dispatch["b"] = do_board
dispatch["c"] = do_unimplemented
-- Infinite loop of command dispatch