Comparison

plugins/mod_admin_telnet.lua @ 8876:9e72e63819dc

console: Allow passing a config when creating a room
author Kim Alvefur <zash@zash.se>
date Sat, 14 Apr 2018 16:14:55 +0200
parent 8591:0c322389f994
child 8922:47d318eeff8d
comparison
equal deleted inserted replaced
8875:be3230b42f12 8876:9e72e63819dc
989 return nil, "Host '"..host.."' is not a MUC service"; 989 return nil, "Host '"..host.."' is not a MUC service";
990 end 990 end
991 return room_name, host; 991 return room_name, host;
992 end 992 end
993 993
994 function def_env.muc:create(room_jid) 994 function def_env.muc:create(room_jid, config)
995 local room_name, host = check_muc(room_jid); 995 local room_name, host = check_muc(room_jid);
996 if not room_name then 996 if not room_name then
997 return room_name, host; 997 return room_name, host;
998 end 998 end
999 if not room_name then return nil, host end 999 if not room_name then return nil, host end
1000 if config ~= nil and type(config) ~= "table" then return nil, "Config must be a table"; end
1000 if hosts[host].modules.muc.get_room_from_jid(room_jid) then return nil, "Room exists already" end 1001 if hosts[host].modules.muc.get_room_from_jid(room_jid) then return nil, "Room exists already" end
1001 return hosts[host].modules.muc.create_room(room_jid); 1002 return hosts[host].modules.muc.create_room(room_jid, config);
1002 end 1003 end
1003 1004
1004 function def_env.muc:room(room_jid) 1005 function def_env.muc:room(room_jid)
1005 local room_name, host = check_muc(room_jid); 1006 local room_name, host = check_muc(room_jid);
1006 if not room_name then 1007 if not room_name then