mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Remove MAM archives on MUC room destroy
This commit is contained in:
parent
247bd9eae5
commit
94444c87e8
@ -34,7 +34,8 @@
|
|||||||
|
|
||||||
-export([user_send_packet/4, user_receive_packet/5,
|
-export([user_send_packet/4, user_receive_packet/5,
|
||||||
process_iq_v0_2/3, process_iq_v0_3/3, remove_user/2,
|
process_iq_v0_2/3, process_iq_v0_3/3, remove_user/2,
|
||||||
mod_opt_type/1, muc_process_iq/4, muc_filter_message/5]).
|
remove_user/3, mod_opt_type/1, muc_process_iq/4,
|
||||||
|
muc_filter_message/5]).
|
||||||
|
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
|
@ -200,13 +200,16 @@ forget_room(ServerHost, Host, Name) ->
|
|||||||
forget_room(LServer, Host, Name,
|
forget_room(LServer, Host, Name,
|
||||||
gen_mod:db_type(LServer, ?MODULE)).
|
gen_mod:db_type(LServer, ?MODULE)).
|
||||||
|
|
||||||
forget_room(_LServer, Host, Name, mnesia) ->
|
forget_room(LServer, Host, Name, mnesia) ->
|
||||||
|
remove_room_mam(LServer, Host, Name),
|
||||||
F = fun () -> mnesia:delete({muc_room, {Name, Host}})
|
F = fun () -> mnesia:delete({muc_room, {Name, Host}})
|
||||||
end,
|
end,
|
||||||
mnesia:transaction(F);
|
mnesia:transaction(F);
|
||||||
forget_room(_LServer, Host, Name, riak) ->
|
forget_room(LServer, Host, Name, riak) ->
|
||||||
|
remove_room_mam(LServer, Host, Name),
|
||||||
{atomic, ejabberd_riak:delete(muc_room, {Name, Host})};
|
{atomic, ejabberd_riak:delete(muc_room, {Name, Host})};
|
||||||
forget_room(LServer, Host, Name, odbc) ->
|
forget_room(LServer, Host, Name, odbc) ->
|
||||||
|
remove_room_mam(LServer, Host, Name),
|
||||||
SName = ejabberd_odbc:escape(Name),
|
SName = ejabberd_odbc:escape(Name),
|
||||||
SHost = ejabberd_odbc:escape(Host),
|
SHost = ejabberd_odbc:escape(Host),
|
||||||
F = fun () ->
|
F = fun () ->
|
||||||
@ -216,6 +219,22 @@ forget_room(LServer, Host, Name, odbc) ->
|
|||||||
end,
|
end,
|
||||||
ejabberd_odbc:sql_transaction(LServer, F).
|
ejabberd_odbc:sql_transaction(LServer, F).
|
||||||
|
|
||||||
|
remove_room_mam(LServer, Host, Name) ->
|
||||||
|
case gen_mod:is_loaded(LServer, mod_mam) of
|
||||||
|
true ->
|
||||||
|
U = jlib:nodeprep(Name),
|
||||||
|
S = jlib:nameprep(Host),
|
||||||
|
DBType = gen_mod:db_type(LServer, mod_mam),
|
||||||
|
if DBType == odbc ->
|
||||||
|
mod_mam:remove_user(jlib:jid_to_string({U, S, <<>>}),
|
||||||
|
LServer, DBType);
|
||||||
|
true ->
|
||||||
|
mod_mam:remove_user(U, S, DBType)
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
process_iq_disco_items(Host, From, To,
|
process_iq_disco_items(Host, From, To,
|
||||||
#iq{lang = Lang} = IQ) ->
|
#iq{lang = Lang} = IQ) ->
|
||||||
Rsm = jlib:rsm_decode(IQ),
|
Rsm = jlib:rsm_decode(IQ),
|
||||||
|
Loading…
Reference in New Issue
Block a user