Changeset

1056:b307b72ae527

mod_listusers: fixed banner skipping cycle
author Vadim Misbakh-Soloviov <mva@mva.name>
date Fri, 07 Jun 2013 17:54:45 +0700
parents 1055:3dd909e87143
children 1057:0b41122b19f9
files mod_listusers/mod_listusers.lua
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_listusers/mod_listusers.lua	Fri Jun 07 08:43:03 2013 +0700
+++ b/mod_listusers/mod_listusers.lua	Fri Jun 07 17:54:45 2013 +0700
@@ -43,6 +43,21 @@
     local st, conn = pcall(assert,socket.connect(console_interfaces[1], console_ports[1]));
     if (not st) then print("Error"..(conn and ": "..conn or "")); return 1; end
 
+    local banner = config.get("*", "console_banner");
+    if (
+      (not banner) or
+      (
+        (type(banner) == "string") and
+        (banner:match("^|    (.+)$"))
+      )
+    ) then
+      repeat
+        local rec_banner = conn:receive()
+      until
+        rec_banner == "" or
+        rec_banner == nil; -- skip banner
+    end
+
     conn:send("c2s:show()\n");
     conn:settimeout(1); -- Only hit in case of failure