Comparison

plugins/mod_admin_adhoc.lua @ 6457:ddcb29a35409

mod_admin_adhoc: Show IP in detailed version of online user listing
author Florian Zeitz <florob@babelmonkeys.de>
date Sun, 28 Sep 2014 21:06:50 +0200
parent 5818:5733a277237a
child 6458:f906b803dc42
comparison
equal deleted inserted replaced
6455:b6514e691a70 6457:ddcb29a35409
343 end 343 end
344 users[#users+1] = username.."@"..module_host; 344 users[#users+1] = username.."@"..module_host;
345 count = count + 1; 345 count = count + 1;
346 if fields.details then 346 if fields.details then
347 for resource, session in pairs(user.sessions or {}) do 347 for resource, session in pairs(user.sessions or {}) do
348 local status, priority = "unavailable", tostring(session.priority or "-"); 348 local status, priority, ip = "unavailable", tostring(session.priority or "-"), session.ip or "<unknown>";
349 if session.presence then 349 if session.presence then
350 status = session.presence:child_with_name("show"); 350 status = session.presence:child_with_name("show");
351 if status then 351 if status then
352 status = status:get_text() or "[invalid!]"; 352 status = status:get_text() or "[invalid!]";
353 else 353 else
354 status = "available"; 354 status = "available";
355 end 355 end
356 end 356 end
357 users[#users+1] = " - "..resource..": "..status.."("..priority..")"; 357 users[#users+1] = " - "..resource..": "..status.."("..priority.."), IP: ["..ip.."]";
358 end 358 end
359 end 359 end
360 end 360 end
361 return { status = "completed", result = {layout = get_online_users_result_layout, values = {onlineuserjids=t_concat(users, "\n")}} }; 361 return { status = "completed", result = {layout = get_online_users_result_layout, values = {onlineuserjids=t_concat(users, "\n")}} };
362 end); 362 end);