Diff

plugins/mod_admin_shell.lua @ 12397:ddf02f2a3354

mod_admin_shell: Add session.write() method to write data to client with no \n
author Matthew Wild <mwild1@gmail.com>
date Thu, 17 Mar 2022 10:22:47 +0000
parent 12304:8210c2a52e9c
child 12398:478fff93ac37
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Thu Mar 17 10:21:43 2022 +0000
+++ b/plugins/mod_admin_shell.lua	Thu Mar 17 10:22:47 2022 +0000
@@ -83,8 +83,8 @@
 	self.data.print("Error: "..tostring(err));
 end
 
-local function send_repl_output(session, line)
-	return session.send(st.stanza("repl-output"):text(tostring(line)));
+local function send_repl_output(session, line, attr)
+	return session.send(st.stanza("repl-output", attr):text(tostring(line)));
 end
 
 function console:new_session(admin_session)
@@ -99,6 +99,9 @@
 			end
 			return send_repl_output(admin_session, table.concat(t, "\t"));
 		end;
+		write = function (t)
+			return send_repl_output(admin_session, t, { eol = "0" });
+		end;
 		serialize = tostring;
 		disconnect = function () admin_session:close(); end;
 	};