diff options
| -rwxr-xr-x | telem.lua | 22 | 
1 files changed, 20 insertions, 2 deletions
| @@ -1,9 +1,11 @@  #!/usr/bin/lua5.2  telemver = "0.3 // 2018-05-04" +file = require("pl.file")  io = require("io") -os = require("os")  lfs = require("lfs") +os = require("os") +path = require("pl.path")  string = require("string")  table = require("table") @@ -12,6 +14,9 @@ bad_topics["."] = true  bad_topics[".."] = true  bad_topics["topic"] = true +-- This is, obvviously, not secure and will need to be updated +username = os.getenv("USER") +  current_board = ""  current_thread_index = nil @@ -163,12 +168,25 @@ function do_type_prev()  end  function do_type_reply() +	filename = os.tmpname() +	os.execute("$EDITOR " .. filename) +	timestamp = tostring(os.time()) +	newfilename = timestamp .. "-" .. username +	newpath = path.join(thread.directory, newfilename) +	ret, str = file.move(filename, newpath) +	if not ret then +		print(str) +	end +	current_thread_posts = get_posts(thread) +	current_thread_index = #current_thread_posts +	do_type_show_post(current_thread_index)  end  type_dispatch = {}  type_dispatch["f"] = do_type_first  type_dispatch["n"] = do_type_next  type_dispatch["p"] = do_type_prev +type_dispatch["r"] = do_type_reply  type_dispatch["d"] = function() return end  function do_type() @@ -198,7 +216,7 @@ function do_type()  end  function show_type_prompt() -	io.write("type prompt ([f]irst, [n]ext, [p]rev, [d]one)>") +	io.write("[f]irst, [n]ext, [p]rev, [r]eply, [d]one >")  end  function do_type_show_post(index) | 
