# HG changeset patch
# User João Duarte <jvsDuarte08@gmail.com>
# Date 1555521082 25200
#      Wed Apr 17 10:11:22 2019 -0700
# Node ID b93eaf41ecbe766742e9056f2b49243030932e42
# Parent  737483a4b2e6823ecf65987c2cc03c565fc46698
mod_admin_telnet: Adds c2s:closeall() (Fixes #1315)

diff -r 737483a4b2e6 -r b93eaf41ecbe plugins/mod_admin_telnet.lua
--- a/plugins/mod_admin_telnet.lua	Sun Apr 14 02:11:52 2019 +0200
+++ b/plugins/mod_admin_telnet.lua	Wed Apr 17 10:11:22 2019 -0700
@@ -250,6 +250,7 @@
 		print [[c2s:show_secure() - Show all encrypted client connections]]
 		print [[c2s:show_tls() - Show TLS cipher info for encrypted sessions]]
 		print [[c2s:close(jid) - Close all sessions for the specified JID]]
+		print [[c2s:closeall() - Close all active c2s connections ]]
 	elseif section == "s2s" then
 		print [[s2s:show(domain) - Show all s2s connections for the given domain (or all if no domain given)]]
 		print [[s2s:show_tls(domain) - Show TLS cipher info for encrypted sessions]]
@@ -661,6 +662,16 @@
 	return true, "Total: "..count.." sessions closed";
 end
 
+function def_env.c2s:closeall()
+        local count = 0;
+	--luacheck: ignore 212/jid
+        show_c2s(function (jid, session)
+                count = count + 1;
+                session:close();
+        end);
+        return true, "Total: "..count.." sessions closed";
+end
+
 
 def_env.s2s = {};
 function def_env.s2s:show(match_jid, annotate)
