Mercurial > prosody-modules
comparison mod_listusers/mod_listusers.lua @ 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 | 3dd909e87143 |
children |
comparison
equal
deleted
inserted
replaced
1055:3dd909e87143 | 1056:b307b72ae527 |
---|---|
41 console_ports = type(console_ports) ~= "table" and { console_ports } or console_ports; | 41 console_ports = type(console_ports) ~= "table" and { console_ports } or console_ports; |
42 | 42 |
43 local st, conn = pcall(assert,socket.connect(console_interfaces[1], console_ports[1])); | 43 local st, conn = pcall(assert,socket.connect(console_interfaces[1], console_ports[1])); |
44 if (not st) then print("Error"..(conn and ": "..conn or "")); return 1; end | 44 if (not st) then print("Error"..(conn and ": "..conn or "")); return 1; end |
45 | 45 |
46 local banner = config.get("*", "console_banner"); | |
47 if ( | |
48 (not banner) or | |
49 ( | |
50 (type(banner) == "string") and | |
51 (banner:match("^| (.+)$")) | |
52 ) | |
53 ) then | |
54 repeat | |
55 local rec_banner = conn:receive() | |
56 until | |
57 rec_banner == "" or | |
58 rec_banner == nil; -- skip banner | |
59 end | |
60 | |
46 conn:send("c2s:show()\n"); | 61 conn:send("c2s:show()\n"); |
47 conn:settimeout(1); -- Only hit in case of failure | 62 conn:settimeout(1); -- Only hit in case of failure |
48 | 63 |
49 repeat local line = conn:receive() | 64 repeat local line = conn:receive() |
50 if not line then break; end | 65 if not line then break; end |