Skip to content

Commit

Permalink
Merge pull request #3231 from esl/mu-fix-get_subhosts-in-mam-muc
Browse files Browse the repository at this point in the history
Properly handle get_subhosts in mod_mam_muc_rdbms_arch
  • Loading branch information
chrzaszcz authored Aug 27, 2021
2 parents cda4a60 + 98e05f5 commit 6afa847
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/mam/mod_mam_muc_rdbms_arch.erl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ remove_archive(Acc, HostType, ArcID, _ArcJID) ->
mongooseim:host_type(), jid:lserver()) ->
mongoose_hooks:simple_acc().
remove_domain(Acc, HostType, Domain) ->
SubHosts = get_subhosts(Domain),
SubHosts = get_subhosts(HostType, Domain),
{atomic, _} = mongoose_rdbms:sql_transaction(HostType, fun() ->
[remove_domain_trans(HostType, SubHost) || SubHost <- SubHosts]
end),
Expand All @@ -313,11 +313,13 @@ remove_domain_trans(HostType, MucHost) ->
mongoose_rdbms:execute_successfully(HostType, mam_muc_remove_domain, [MucHost]),
mongoose_rdbms:execute_successfully(HostType, mam_muc_remove_domain_users, [MucHost]).

get_subhosts(Domain) ->
MucHost = gen_mod:get_module_opt_subhost(Domain, mod_muc_light,
mod_muc_light:default_host()),
LightHost = gen_mod:get_module_opt_subhost(Domain, mod_muc,
mod_muc:default_host()),
get_subhosts(HostType, Domain) ->
MucHostPattern = gen_mod:get_module_opt(HostType, mod_muc, host,
mod_muc:default_host()),
LightHostPattern = gen_mod:get_module_opt(HostType, mod_muc_light, host,
mod_muc_light:default_host()),
MucHost = mongoose_subdomain_utils:get_fqdn(MucHostPattern, Domain),
LightHost = mongoose_subdomain_utils:get_fqdn(LightHostPattern, Domain),
lists:usort([MucHost, LightHost]).

%% GDPR logic
Expand Down

0 comments on commit 6afa847

Please sign in to comment.