mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Fix pubsub/odbc crash on remote user unsubscribe (EJAB-1483)
This commit is contained in:
parent
b2f98099bb
commit
b83c07251c
@ -733,9 +733,18 @@ in_subscription(_, _, _, _, _, _) ->
|
|||||||
true.
|
true.
|
||||||
|
|
||||||
unsubscribe_user(Entity, Owner) ->
|
unsubscribe_user(Entity, Owner) ->
|
||||||
BJID = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
|
|
||||||
Host = host(element(2, BJID)),
|
|
||||||
spawn(fun () ->
|
spawn(fun () ->
|
||||||
|
[unsubscribe_user(ServerHost, Entity, Owner) ||
|
||||||
|
ServerHost <- lists:usort(lists:foldl(
|
||||||
|
fun(UserHost, Acc) ->
|
||||||
|
case gen_mod:is_loaded(UserHost, mod_pubsub) of
|
||||||
|
true -> [UserHost|Acc];
|
||||||
|
false -> Acc
|
||||||
|
end
|
||||||
|
end, [], [Entity#jid.lserver, Owner#jid.lserver]))]
|
||||||
|
end).
|
||||||
|
unsubscribe_user(Host, Entity, Owner) ->
|
||||||
|
BJID = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
|
||||||
lists:foreach(fun (PType) ->
|
lists:foreach(fun (PType) ->
|
||||||
{result, Subs} = node_action(Host, PType,
|
{result, Subs} = node_action(Host, PType,
|
||||||
get_entity_subscriptions,
|
get_entity_subscriptions,
|
||||||
@ -745,27 +754,21 @@ unsubscribe_user(Entity, Owner) ->
|
|||||||
owners = O,
|
owners = O,
|
||||||
id = Nidx},
|
id = Nidx},
|
||||||
subscribed, _, JID}) ->
|
subscribed, _, JID}) ->
|
||||||
case match_option(Options, access_model, presence) of
|
Unsubscribe = match_option(Options, access_model, presence)
|
||||||
true ->
|
andalso lists:member(BJID, node_owners_action(Host, PType, Nidx, O)),
|
||||||
Owners = node_owners_action(Host, PType, Nidx, O),
|
case Unsubscribe of
|
||||||
case lists:member(BJID, Owners) of
|
|
||||||
true ->
|
true ->
|
||||||
node_action(Host, PType,
|
node_action(Host, PType,
|
||||||
unsubscribe_node,
|
unsubscribe_node, [Nidx, Entity, JID, all]);
|
||||||
[Nidx, Entity, JID, all]);
|
|
||||||
false ->
|
false ->
|
||||||
{result, ok}
|
ok
|
||||||
end;
|
|
||||||
_ ->
|
|
||||||
{result, ok}
|
|
||||||
end;
|
end;
|
||||||
(_) ->
|
(_) ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
Subs)
|
Subs)
|
||||||
end,
|
end,
|
||||||
plugins(Host))
|
plugins(Host)).
|
||||||
end).
|
|
||||||
|
|
||||||
%% -------
|
%% -------
|
||||||
%% user remove hook handling function
|
%% user remove hook handling function
|
||||||
|
Loading…
Reference in New Issue
Block a user