357 end |
357 end |
358 end |
358 end |
359 |
359 |
360 function def_env.c2s:show(match_jid) |
360 function def_env.c2s:show(match_jid) |
361 local print, count = self.session.print, 0; |
361 local print, count = self.session.print, 0; |
362 show_c2s(function (jid) |
362 show_c2s(function (jid, session) |
363 if (not match_jid) or jid:match(match_jid) then |
363 if (not match_jid) or jid:match(match_jid) then |
364 count = count + 1; |
364 count = count + 1; |
365 print(jid); |
365 local status, priority = "unavailable", tostring(session.priority or "-"); |
|
366 if session.presence then |
|
367 status = session.presence:child_with_name("show"); |
|
368 if status then |
|
369 status = status:get_text() or "[invalid!]"; |
|
370 else |
|
371 status = "available"; |
|
372 end |
|
373 end |
|
374 print(jid.." - "..status.."("..priority..")"); |
366 end |
375 end |
367 end); |
376 end); |
368 return true, "Total: "..count.." clients"; |
377 return true, "Total: "..count.." clients"; |
369 end |
378 end |
370 |
379 |