24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-09-29 14:37:44 +02:00

Send authorization messages outside of get-pending transaction (thanks to Brian Cully)(EJAB-1090)

SVN Revision: 2719
This commit is contained in:
Badlop 2009-11-04 17:38:51 +00:00
parent 4aec8dda48
commit 64bc97d471

View File

@ -1424,17 +1424,12 @@ send_pending_auth_events(Host, Node, Owner) ->
?DEBUG("Sending pending auth events for ~s on ~s:~s", ?DEBUG("Sending pending auth events for ~s on ~s:~s",
[jlib:jid_to_string(Owner), Host, node_to_string(Node)]), [jlib:jid_to_string(Owner), Host, node_to_string(Node)]),
Action = Action =
fun (#pubsub_node{id = NodeID, type = Type} = N) -> fun (#pubsub_node{id = NodeID, type = Type}) ->
case lists:member("get-pending", features(Type)) of case lists:member("get-pending", features(Type)) of
true -> true ->
case node_call(Type, get_affiliation, [NodeID, Owner]) of case node_call(Type, get_affiliation, [NodeID, Owner]) of
{result, owner} -> {result, owner} ->
{result, Subscriptions} = node_call(Type, get_node_subscriptions, [NodeID]), node_call(Type, get_node_subscriptions, [NodeID]);
lists:foreach(fun({J, pending, _SubID}) -> send_authorization_request(N, jlib:make_jid(J));
({J, pending}) -> send_authorization_request(N, jlib:make_jid(J));
(_) -> ok
end, Subscriptions),
{result, ok};
_ -> _ ->
{error, ?ERR_FORBIDDEN} {error, ?ERR_FORBIDDEN}
end; end;
@ -1443,7 +1438,11 @@ send_pending_auth_events(Host, Node, Owner) ->
end end
end, end,
case transaction(Host, Node, Action, sync_dirty) of case transaction(Host, Node, Action, sync_dirty) of
{result, _} -> {result, {N, Subscriptions}} ->
lists:foreach(fun({J, pending, _SubID}) -> send_authorization_request(N, jlib:make_jid(J));
({J, pending}) -> send_authorization_request(N, jlib:make_jid(J));
(_) -> ok
end, Subscriptions),
#adhoc_response{}; #adhoc_response{};
Err -> Err ->
Err Err