diff options
author | Solderpunk <solderpunk@sdf.org> | 2019-05-06 20:13:05 +0000 |
---|---|---|
committer | Solderpunk <solderpunk@sdf.org> | 2019-05-06 20:13:05 +0000 |
commit | 812c306824420483cf41ec249a8f5e2ed5a9ef75 (patch) | |
tree | 19969cf7e5207e9b38dbc0b3fb95468b6083485d /telem.lua | |
parent | Add (R)ecent function to show 10 most recently active threads. (diff) |
Add (H)ide function to hold threads which haven't been updated in 90 days.
Diffstat (limited to 'telem.lua')
-rwxr-xr-x | telem.lua | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -45,6 +45,7 @@ current_thread_posts = {} -- Array of post tables, containing posts associated w current_post_index = nil -- Integer index into current_thread_posts colours = true -- Boolean, controls whether to use ANSI colours reversemessages = false -- Boolean, controls message sort order +hideold = false -- Boolean, controls whether to hide old threads -- Setuid stuff @@ -145,7 +146,14 @@ function get_threads(board) thread.updated_by = post.author end end - table.insert(threads, thread) + if hideold then + local age = os.time() - thread.updated + if age < 7776000 then -- 90 days, in seconds + table.insert(threads, thread) + end + else + table.insert(threads, thread) + end ::continue:: end if reversemessages then @@ -262,6 +270,16 @@ function do_setmessageorder() end end +function do_sethideold() + if hideold then + hideold = false + print("Showing old threads.") + else + hideold = true + print("Hiding old threads.") + end +end + function do_go() io.write("Go to which board? (use name or index) ") local board = string.upper(io.read()) @@ -664,6 +682,7 @@ load_scan_times() -- Build dispatch table mapping chars to functions dispatch = {} dispatch["h"] = do_help +dispatch["H"] = do_sethideold dispatch["g"] = do_go dispatch["l"] = do_list dispatch["m"] = do_messages |