1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-05 02:29:34 +02:00

Don't fetch subscribers list in room_unused_*

This commit is contained in:
Paweł Chmielowski 2021-01-26 11:13:23 +01:00
parent bb87b6f948
commit b977320091
2 changed files with 25 additions and 2 deletions

View file

@ -36,7 +36,7 @@
get_online_rooms/3, count_online_rooms/2, rsm_supported/0,
register_online_user/4, unregister_online_user/4,
count_online_rooms_by_user/3, get_online_rooms_by_user/3,
get_subscribed_rooms/3]).
get_subscribed_rooms/3, get_rooms_without_subscribers/2]).
-export([set_affiliation/6, set_affiliations/4, get_affiliation/5,
get_affiliations/3, search_affiliation/4]).
@ -155,6 +155,22 @@ can_use_nick(LServer, Host, JID, Nick) ->
_ -> true
end.
get_rooms_without_subscribers(LServer, Host) ->
case catch ejabberd_sql:sql_query(
LServer,
?SQL("select @(name)s, @(opts)s from muc_room"
" where host=%(Host)s")) of
{selected, RoomOpts} ->
lists:map(
fun({Room, Opts}) ->
OptsD = ejabberd_sql:decode_term(Opts),
#muc_room{name_host = {Room, Host},
opts = mod_muc:opts_to_binary(OptsD)}
end, RoomOpts);
_Err ->
[]
end.
get_rooms(LServer, Host) ->
case catch ejabberd_sql:sql_query(
LServer,