diff options
author | Yargo <yargo@macmini.local> | 2019-04-27 18:44:51 +0200 |
---|---|---|
committer | Yargo <yargo@macmini.local> | 2019-04-27 18:44:51 +0200 |
commit | 9227b199d884149d2249f11f6055beaac278d511 (patch) | |
tree | 40803104323a0d79c4c7bfeee79c3ec9fe5a4720 | |
parent | Permit board names to consist of alphanumeric characters, not just letters. (diff) |
add possibility to revert message sort order
Diffstat (limited to '')
-rwxr-xr-x | telem.lua | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,5 +1,5 @@ #!/usr/bin/env lua -telemver = "0.3 // 2018-05-04" +telemver = "0.4 // 2019-04-27" require("pl.strict") file = require("pl.file") @@ -44,6 +44,7 @@ current_thread = {} -- Active thread table, always an element of current_board_ current_thread_posts = {} -- Array of post tables, containing posts associated with current_thread 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 -- Setuid stuff @@ -147,7 +148,11 @@ function get_threads(board) table.insert(threads, thread) ::continue:: end - table.sort(threads, function(x,y) return x.updated > y.updated end) + if reversemessages then + table.sort(threads, function(x,y) return x.updated < y.updated end) + else + table.sort(threads, function(x,y) return x.updated > y.updated end) + end return threads end @@ -247,6 +252,16 @@ function do_colour() end end +function do_setmessageorder() + if reversemessages then + reversemessages = false + print("Newest messages displayed at top.") + else + reversemessages = true + print("Newest messages displayed at bottom.") + end +end + function do_go() io.write("Go to which board? (use name or index) ") local board = string.upper(io.read()) @@ -624,6 +639,7 @@ dispatch["?"] = do_help2 dispatch["!"] = do_rules dispatch["w"] = do_who dispatch["s"] = do_scan +dispatch["S"] = do_setmessageorder dispatch["="] = do_unimplemented dispatch["M"] = do_unimplemented dispatch["n"] = do_new |