aboutsummaryrefslogtreecommitdiff
path: root/telem.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtelem.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/telem.lua b/telem.lua
index d2fe594..8f6e5dd 100755
--- a/telem.lua
+++ b/telem.lua
@@ -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