Comparison

plugins/mod_admin_telnet.lua @ 6260:6986ca575568

mod_admin_telnet: Add command to list MUC rooms
author Matthew Wild <mwild1@gmail.com>
date Wed, 28 May 2014 12:43:34 +0100
parent 6176:02d366be7c2f
child 6270:ee2d5b2a263d
child 6312:1940a014aeca
comparison
equal deleted inserted replaced
6259:36f611624987 6260:6986ca575568
962 return nil, "No such room: "..room_jid; 962 return nil, "No such room: "..room_jid;
963 end 963 end
964 return setmetatable({ room = room_obj }, console_room_mt); 964 return setmetatable({ room = room_obj }, console_room_mt);
965 end 965 end
966 966
967 function def_env.muc:list(host)
968 local host_session = hosts[host];
969 if not host_session or not host_session.modules.muc then
970 return nil, "Please supply the address of a local MUC component";
971 end
972 local c = 0;
973 for name in keys(host_session.modules.muc.rooms) do
974 print(name);
975 c = c + 1;
976 end
977 return true, c.." rooms";
978 end
979
967 local um = require"core.usermanager"; 980 local um = require"core.usermanager";
968 981
969 def_env.user = {}; 982 def_env.user = {};
970 function def_env.user:create(jid, password) 983 function def_env.user:create(jid, password)
971 local username, host = jid_split(jid); 984 local username, host = jid_split(jid);