diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-07-08 02:29:13 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-07-08 02:29:13 +0100 |
commit | 1b554164a066afbc2a1652a38e8757c816a6bb79 (patch) | |
tree | fa775ceee2b0f0f193ca6ea1cf8b040e81faf540 | |
parent | 40584eef53007604535163a3c2d2815f63151b99 (diff) | |
download | prosody-1b554164a066afbc2a1652a38e8757c816a6bb79.tar.gz prosody-1b554164a066afbc2a1652a38e8757c816a6bb79.zip |
mod_console: Add c2s:close() command
-rw-r--r-- | plugins/mod_console.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index 966156f8..9d47cbc6 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -17,6 +17,7 @@ local connlisteners_register = require "net.connlisteners".register; local console_listener = { default_port = 5582; default_mode = "*l"; }; require "util.iterators"; +local jid_bare = require "util.jid".bare; local set, array = require "util.set", require "util.array"; local commands = {}; @@ -320,6 +321,16 @@ function def_env.c2s:show_secure(match_jid) return true, "Total: "..count.." secure client connections"; end +function def_env.c2s:close(match_jid) + local print, count = self.session.print, 0; + show_c2s(function (jid, session) + if jid == match_jid or jid_bare(jid) == match_jid then + count = count + 1; + session:close(); + end + end); + return true, "Total: "..count.." sessions closed"; +end def_env.s2s = {}; function def_env.s2s:show(match_jid) |