diff options
-rwxr-xr-x | telem.lua | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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 |