Software /
code /
prosody
Changeset
1604:5097583259e0
mod_console: Show status and priority of clients
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 26 Jul 2009 17:05:18 +0100 |
parents | 1603:d11606859400 |
children | 1605:f6bd13fe1cb1 |
files | plugins/mod_console.lua |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_console.lua Sun Jul 26 18:22:10 2009 +0500 +++ b/plugins/mod_console.lua Sun Jul 26 17:05:18 2009 +0100 @@ -325,10 +325,19 @@ function def_env.c2s:show(match_jid) local print, count = self.session.print, 0; - show_c2s(function (jid) + show_c2s(function (jid, session) if (not match_jid) or jid:match(match_jid) then count = count + 1; - print(jid); + local status, priority = "unavailable", tostring(session.priority or "-"); + if session.presence then + status = session.presence:child_with_name("show"); + if status then + status = status:get_text() or "[invalid!]"; + else + status = "available"; + end + end + print(jid.." - "..status.."("..priority..")"); end end); return true, "Total: "..count.." clients";