plugins/mod_console.lua

changeset 1798
4c8f3fa9d926
parent 1616
80ea744f2643
child 1799
c9c1987430c6
child 1821
05ed826da89b
equal deleted inserted replaced
1796:5f7b2f940816 1798:4c8f3fa9d926
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

mercurial