c2s:sort(function(a, b)
if a.host == b.host then
if a.username == b.username then
- return a.resource or "" > b.resource or "";
+ return (a.resource or "") > (b.resource or "");
end
- return a.username or "" > b.username or "";
+ return (a.username or "") > (b.username or "");
end
- return a.host or "" > b.host or "";
+ return (a.host or "") > (b.host or "");
end):map(function (session)
callback(get_jid(session), session)
end);
end
function def_env.c2s:count(match_jid)
- local count = 0;
- show_c2s(function (jid, session)
- if (not match_jid) or jid:match(match_jid) then
- count = count + 1;
- end
- end);
- return true, "Total: "..count.." clients";
+ return true, "Total: ".. iterators.count(values(module:shared"/*/c2s/sessions")) .." clients";
end
function def_env.c2s:show(match_jid, annotate)
end
function def_env.muc:create(room_jid)
- local room, host = check_muc(room_jid);
+ local room_name, host = check_muc(room_jid);
if not room_name then
return room_name, host;
end
- if not room then return nil, host end
+ if not room_name then return nil, host end
if hosts[host].modules.muc.rooms[room_jid] then return nil, "Room exists already" end
return hosts[host].modules.muc.create_room(room_jid);
end