25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

improve remove_user (EJAB-1172)

This commit is contained in:
Christophe Romain 2010-03-11 16:07:56 +01:00
parent c316bfae25
commit d50fc6728e
3 changed files with 52 additions and 48 deletions

View File

@ -786,18 +786,20 @@ remove_user(User, Server) ->
LServer = exmpp_stringprep:nameprep(Server), LServer = exmpp_stringprep:nameprep(Server),
Entity = exmpp_jid:make(LUser, LServer), Entity = exmpp_jid:make(LUser, LServer),
Host = host(LServer), Host = host(LServer),
HomeTreeBase = string_to_node("/home/"++LServer++"/"++LUser),
spawn(fun() -> spawn(fun() ->
%% remove user's subscriptions %% remove user's subscriptions
lists:foreach(fun(PType) -> lists:foreach(fun(PType) ->
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]), {result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
lists:foreach(fun lists:foreach(fun
({#pubsub_node{id = NodeId}, subscribed, _, JID}) -> node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]); ({#pubsub_node{id = NodeId}, _, _, JID}) -> node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all])
(_) -> ok
end, Subscriptions), end, Subscriptions),
{result, Affiliations} = node_action(Host, PType, get_entity_affiliations, [Host, Entity]), {result, Affiliations} = node_action(Host, PType, get_entity_affiliations, [Host, Entity]),
lists:foreach(fun lists:foreach(fun
({#pubsub_node{nodeid = {H, N}}, owner}) -> delete_node(H, N, Entity); ({#pubsub_node{nodeid = {H, N}, parents = []}, owner}) -> delete_node(H, N, Entity);
({#pubsub_node{id = NodeId}, _}) -> node_action(Host, PType, set_affiliation, [NodeId, Entity, none]) ({#pubsub_node{nodeid = {H, N}, type = "hometree"}, owner}) when N == HomeTreeBase -> delete_node(H, N, Entity);
({#pubsub_node{id = NodeId}, publisher}) -> node_action(Host, PType, set_affiliation, [NodeId, Entity, none]);
(_) -> ok
end, Affiliations) end, Affiliations)
end, plugins(Host)) end, plugins(Host))
end). end).

View File

@ -591,18 +591,20 @@ remove_user(User, Server) ->
LServer = exmpp_stringprep:nameprep(Server), LServer = exmpp_stringprep:nameprep(Server),
Entity = exmpp_jid:make(LUser, LServer), Entity = exmpp_jid:make(LUser, LServer),
Host = host(LServer), Host = host(LServer),
HomeTreeBase = string_to_node("/home/"++LServer++"/"++LUser),
spawn(fun() -> spawn(fun() ->
%% remove user's subscriptions %% remove user's subscriptions
lists:foreach(fun(PType) -> lists:foreach(fun(PType) ->
{result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]), {result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),
lists:foreach(fun lists:foreach(fun
({#pubsub_node{id = NodeId}, subscribed, _, JID}) -> node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]); ({#pubsub_node{id = NodeId}, _, _, JID}) -> node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all])
(_) -> ok
end, Subscriptions), end, Subscriptions),
{result, Affiliations} = node_action(Host, PType, get_entity_affiliations, [Host, Entity]), {result, Affiliations} = node_action(Host, PType, get_entity_affiliations, [Host, Entity]),
lists:foreach(fun lists:foreach(fun
({#pubsub_node{nodeid = {H, N}}, owner}) -> delete_node(H, N, Entity); ({#pubsub_node{nodeid = {H, N}, parents = []}, owner}) -> delete_node(H, N, Entity);
({#pubsub_node{id = NodeId}, _}) -> node_action(Host, PType, set_affiliation, [NodeId, Entity, none]) ({#pubsub_node{nodeid = {H, N}, type = "hometree"}, owner}) when N == HomeTreeBase -> delete_node(H, N, Entity);
({#pubsub_node{id = NodeId}, publisher}) -> node_action(Host, PType, set_affiliation, [NodeId, Entity, none]);
(_) -> ok
end, Affiliations) end, Affiliations)
end, plugins(Host)) end, plugins(Host))
end). end).

View File

@ -1,5 +1,5 @@
--- mod_pubsub.erl 2010-03-08 15:25:53.000000000 +0100 --- mod_pubsub.erl 2010-03-11 16:04:43.000000000 +0100
+++ mod_pubsub_odbc.erl 2010-03-08 15:26:10.000000000 +0100 +++ mod_pubsub_odbc.erl 2010-03-11 16:07:23.000000000 +0100
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
%%% XEP-0060 section 12.18. %%% XEP-0060 section 12.18.
@ -315,7 +315,7 @@
true -> true ->
node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]); node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all]);
false -> false ->
@@ -935,10 +740,11 @@ @@ -937,10 +742,11 @@
end, end,
ejabberd_router:route(To, From, Res); ejabberd_router:route(To, From, Res);
#iq{type = get, ns = ?NS_DISCO_ITEMS, #iq{type = get, ns = ?NS_DISCO_ITEMS,
@ -329,7 +329,7 @@
{result, IQRes} -> {result, IQRes} ->
Result = #xmlel{ns = ?NS_DISCO_ITEMS, Result = #xmlel{ns = ?NS_DISCO_ITEMS,
name = 'query', attrs = QAttrs, name = 'query', attrs = QAttrs,
@@ -1058,7 +864,7 @@ @@ -1060,7 +866,7 @@
[] -> [] ->
["leaf"]; %% No sub-nodes: it's a leaf node ["leaf"]; %% No sub-nodes: it's a leaf node
_ -> _ ->
@ -338,7 +338,7 @@
{result, []} -> ["collection"]; {result, []} -> ["collection"];
{result, _} -> ["leaf", "collection"]; {result, _} -> ["leaf", "collection"];
_ -> [] _ -> []
@@ -1074,8 +880,9 @@ @@ -1076,8 +882,9 @@
[]; [];
true -> true ->
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} | [#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
@ -350,7 +350,7 @@
end, features(Type))] end, features(Type))]
end, end,
%% TODO: add meta-data info (spec section 5.4) %% TODO: add meta-data info (spec section 5.4)
@@ -1104,8 +911,9 @@ @@ -1106,8 +913,9 @@
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]}, #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]}, #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++ #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
@ -362,7 +362,7 @@
end, features(Host, Node))}; end, features(Host, Node))};
?NS_ADHOC_b -> ?NS_ADHOC_b ->
command_disco_info(Host, Node, From); command_disco_info(Host, Node, From);
@@ -1115,7 +923,7 @@ @@ -1117,7 +925,7 @@
node_disco_info(Host, Node, From) node_disco_info(Host, Node, From)
end. end.
@ -371,7 +371,7 @@
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
Nodes when is_list(Nodes) -> Nodes when is_list(Nodes) ->
{result, lists:map( {result, lists:map(
@@ -1132,7 +940,7 @@ @@ -1134,7 +942,7 @@
Other -> Other ->
Other Other
end; end;
@ -380,7 +380,7 @@
%% TODO: support localization of this string %% TODO: support localization of this string
CommandItems = [ CommandItems = [
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
@@ -1141,10 +949,10 @@ @@ -1143,10 +951,10 @@
?XMLATTR('name', "Get Pending") ?XMLATTR('name', "Get Pending")
]}], ]}],
{result, CommandItems}; {result, CommandItems};
@ -393,7 +393,7 @@
case string:tokens(Item, "!") of case string:tokens(Item, "!") of
[_SNode, _ItemID] -> [_SNode, _ItemID] ->
{result, []}; {result, []};
@@ -1152,10 +960,10 @@ @@ -1154,10 +962,10 @@
Node = string_to_node(SNode), Node = string_to_node(SNode),
Action = Action =
fun(#pubsub_node{type = Type, id = NodeId}) -> fun(#pubsub_node{type = Type, id = NodeId}) ->
@ -407,7 +407,7 @@
end, end,
Nodes = lists:map( Nodes = lists:map(
fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) -> fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) ->
@@ -1171,9 +979,10 @@ @@ -1173,9 +981,10 @@
Items = lists:map( Items = lists:map(
fun(#pubsub_item{itemid = {RN, _}}) -> fun(#pubsub_item{itemid = {RN, _}}) ->
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]), {result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
@ -420,7 +420,7 @@
end, end,
case transaction(Host, Node, Action, sync_dirty) of case transaction(Host, Node, Action, sync_dirty) of
{result, {_, Result}} -> {result, Result}; {result, {_, Result}} -> {result, Result};
@@ -1304,7 +1113,8 @@ @@ -1306,7 +1115,8 @@
(_, Acc) -> (_, Acc) ->
Acc Acc
end, [], exmpp_xml:remove_cdata_from_list(Els)), end, [], exmpp_xml:remove_cdata_from_list(Els)),
@ -430,7 +430,7 @@
{get, 'subscriptions'} -> {get, 'subscriptions'} ->
get_subscriptions(Host, Node, From, Plugins); get_subscriptions(Host, Node, From, Plugins);
{get, 'affiliations'} -> {get, 'affiliations'} ->
@@ -1326,8 +1136,9 @@ @@ -1328,8 +1138,9 @@
end. end.
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) -> iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
@ -442,7 +442,7 @@
case Action of case Action of
[#xmlel{name = Name, attrs = Attrs, children = Els}] -> [#xmlel{name = Name, attrs = Attrs, children = Els}] ->
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")), Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")),
@@ -1461,7 +1272,8 @@ @@ -1463,7 +1274,8 @@
_ -> [] _ -> []
end end
end, end,
@ -452,7 +452,7 @@
sync_dirty) of sync_dirty) of
{result, Res} -> Res; {result, Res} -> Res;
Err -> Err Err -> Err
@@ -1505,7 +1317,7 @@ @@ -1507,7 +1319,7 @@
%%% authorization handling %%% authorization handling
@ -461,7 +461,7 @@
Lang = "en", %% TODO fix Lang = "en", %% TODO fix
{U, S, R} = Subscriber, {U, S, R} = Subscriber,
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children = Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
@@ -1535,7 +1347,7 @@ @@ -1537,7 +1349,7 @@
lists:foreach(fun(Owner) -> lists:foreach(fun(Owner) ->
{U, S, R} = Owner, {U, S, R} = Owner,
ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza) ejabberd_router:route(service_jid(Host), exmpp_jid:make(U, S, R), Stanza)
@ -470,7 +470,7 @@
find_authorization_response(Packet) -> find_authorization_response(Packet) ->
Els = Packet#xmlel.children, Els = Packet#xmlel.children,
@@ -1577,7 +1389,7 @@ @@ -1579,7 +1391,7 @@
end, end,
Stanza = event_stanza( Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs = [#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
@ -479,7 +479,7 @@
}]), }]),
ejabberd_router:route(service_jid(Host), JID, Stanza). ejabberd_router:route(service_jid(Host), JID, Stanza).
@@ -1588,14 +1400,14 @@ @@ -1590,14 +1402,14 @@
{{value, {_, [SNode]}}, {value, {_, [SSubscriber]}}, {{value, {_, [SNode]}}, {value, {_, [SSubscriber]}},
{value, {_, [SAllow]}}} -> {value, {_, [SAllow]}}} ->
Node = string_to_node(SNode), Node = string_to_node(SNode),
@ -497,7 +497,7 @@
{result, Subscriptions} = node_call(Type, get_subscriptions, [NodeId, Subscriber]), {result, Subscriptions} = node_call(Type, get_subscriptions, [NodeId, Subscriber]),
if if
not IsApprover -> not IsApprover ->
@@ -1790,7 +1602,7 @@ @@ -1792,7 +1604,7 @@
end, end,
Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = Reply = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
[#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]}, [#xmlel{ns = ?NS_PUBSUB, name = 'create', attrs = nodeAttr(Node)}]},
@ -506,7 +506,7 @@
{result, {Result, broadcast}} -> {result, {Result, broadcast}} ->
%%Lang = "en", %% TODO: fix %%Lang = "en", %% TODO: fix
%%OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)), %%OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
@@ -1899,7 +1711,7 @@ @@ -1901,7 +1713,7 @@
%%<li>The node does not exist.</li> %%<li>The node does not exist.</li>
%%</ul> %%</ul>
subscribe_node(Host, Node, From, JID, Configuration) -> subscribe_node(Host, Node, From, JID, Configuration) ->
@ -515,7 +515,7 @@
{result, GoodSubOpts} -> GoodSubOpts; {result, GoodSubOpts} -> GoodSubOpts;
_ -> invalid _ -> invalid
end, end,
@@ -1909,7 +1721,7 @@ @@ -1911,7 +1723,7 @@
_:_ -> _:_ ->
{undefined, undefined, undefined} {undefined, undefined, undefined}
end, end,
@ -524,7 +524,7 @@
Features = features(Type), Features = features(Type),
SubscribeFeature = lists:member("subscribe", Features), SubscribeFeature = lists:member("subscribe", Features),
OptionsFeature = lists:member("subscription-options", Features), OptionsFeature = lists:member("subscription-options", Features),
@@ -1928,9 +1740,13 @@ @@ -1930,9 +1742,13 @@
{"", "", ""} -> {"", "", ""} ->
{false, false}; {false, false};
_ -> _ ->
@ -541,7 +541,7 @@
end end
end, end,
if if
@@ -2263,7 +2079,7 @@ @@ -2265,7 +2081,7 @@
%% <p>The permission are not checked in this function.</p> %% <p>The permission are not checked in this function.</p>
%% @todo We probably need to check that the user doing the query has the right %% @todo We probably need to check that the user doing the query has the right
%% to read the items. %% to read the items.
@ -550,7 +550,7 @@
MaxItems = MaxItems =
if if
SMaxItems == "" -> get_max_items_node(Host); SMaxItems == "" -> get_max_items_node(Host);
@@ -2302,11 +2118,11 @@ @@ -2304,11 +2120,11 @@
node_call(Type, get_items, node_call(Type, get_items,
[NodeId, From, [NodeId, From,
AccessModel, PresenceSubscription, RosterGroup, AccessModel, PresenceSubscription, RosterGroup,
@ -564,7 +564,7 @@
SendItems = case ItemIDs of SendItems = case ItemIDs of
[] -> [] ->
Items; Items;
@@ -2319,7 +2135,7 @@ @@ -2321,7 +2137,7 @@
%% number of items sent to MaxItems: %% number of items sent to MaxItems:
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = {result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
[#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children = [#xmlel{ns = ?NS_PUBSUB, name = 'items', attrs = nodeAttr(Node), children =
@ -573,7 +573,7 @@
Error -> Error ->
Error Error
end end
@@ -2351,17 +2167,29 @@ @@ -2353,17 +2169,29 @@
%% @doc <p>Resend the items of a node to the user.</p> %% @doc <p>Resend the items of a node to the user.</p>
%% @todo use cache-last-item feature %% @todo use cache-last-item feature
send_items(Host, Node, NodeId, Type, LJID, last) -> send_items(Host, Node, NodeId, Type, LJID, last) ->
@ -610,7 +610,7 @@
send_items(Host, Node, NodeId, Type, {LU, LS, LR} = LJID, Number) -> send_items(Host, Node, NodeId, Type, {LU, LS, LR} = LJID, Number) ->
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
{result, []} -> {result, []} ->
@@ -2491,29 +2319,12 @@ @@ -2493,29 +2321,12 @@
error -> error ->
{error, 'bad-request'}; {error, 'bad-request'};
_ -> _ ->
@ -643,7 +643,7 @@
end, Entities), end, Entities),
{result, []}; {result, []};
_ -> _ ->
@@ -2568,11 +2379,11 @@ @@ -2570,11 +2381,11 @@
end. end.
read_sub(Subscriber, Node, NodeID, SubID, Lang) -> read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
@ -657,7 +657,7 @@
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options', OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)), attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
?XMLATTR('Subid', SubID) | nodeAttr(Node)], ?XMLATTR('Subid', SubID) | nodeAttr(Node)],
@@ -2599,7 +2410,7 @@ @@ -2601,7 +2412,7 @@
end. end.
set_options_helper(Configuration, JID, NodeID, SubID, Type) -> set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
@ -666,7 +666,7 @@
{result, GoodSubOpts} -> GoodSubOpts; {result, GoodSubOpts} -> GoodSubOpts;
_ -> invalid _ -> invalid
end, end,
@@ -2629,7 +2440,7 @@ @@ -2631,7 +2442,7 @@
write_sub(_Subscriber, _NodeID, _SubID, invalid) -> write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
{error, extended_error('bad-request', "invalid-options")}; {error, extended_error('bad-request', "invalid-options")};
write_sub(Subscriber, NodeID, SubID, Options) -> write_sub(Subscriber, NodeID, SubID, Options) ->
@ -675,7 +675,7 @@
{error, notfound} -> {error, notfound} ->
{error, extended_error('not-acceptable', "invalid-subid")}; {error, extended_error('not-acceptable', "invalid-subid")};
{result, _} -> {result, _} ->
@@ -2802,8 +2613,8 @@ @@ -2804,8 +2615,8 @@
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]}, ?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
ejabberd_router:route(service_jid(Host), JID, Stanza) ejabberd_router:route(service_jid(Host), JID, Stanza)
end, end,
@ -686,7 +686,7 @@
true -> true ->
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) -> Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
@@ -3092,7 +2903,7 @@ @@ -3094,7 +2905,7 @@
{Depth, [{N, get_node_subs(N)} || N <- Nodes]} {Depth, [{N, get_node_subs(N)} || N <- Nodes]}
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))} end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
end, end,
@ -695,7 +695,7 @@
{result, CollSubs} -> CollSubs; {result, CollSubs} -> CollSubs;
_ -> [] _ -> []
end. end.
@@ -3106,9 +2917,9 @@ @@ -3108,9 +2919,9 @@
get_options_for_subs(NodeID, Subs) -> get_options_for_subs(NodeID, Subs) ->
lists:foldl(fun({JID, subscribed, SubID}, Acc) -> lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
@ -707,7 +707,7 @@
_ -> Acc _ -> Acc
end; end;
(_, Acc) -> (_, Acc) ->
@@ -3116,6 +2927,7 @@ @@ -3118,6 +2929,7 @@
end, [], Subs). end, [], Subs).
% TODO: merge broadcast code that way % TODO: merge broadcast code that way
@ -715,7 +715,7 @@
%broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) -> %broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) ->
% case (get_option(NodeOptions, Feature) or Force) of % case (get_option(NodeOptions, Feature) or Force) of
% true -> % true ->
@@ -3323,6 +3135,30 @@ @@ -3325,6 +3137,30 @@
Result Result
end. end.
@ -746,7 +746,7 @@
%% @spec (Host, Options) -> MaxItems %% @spec (Host, Options) -> MaxItems
%% Host = host() %% Host = host()
%% Options = [Option] %% Options = [Option]
@@ -3721,7 +3557,13 @@ @@ -3723,7 +3559,13 @@
tree_action(Host, Function, Args) -> tree_action(Host, Function, Args) ->
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]), ?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
Fun = fun() -> tree_call(Host, Function, Args) end, Fun = fun() -> tree_call(Host, Function, Args) end,
@ -761,7 +761,7 @@
%% @doc <p>node plugin call.</p> %% @doc <p>node plugin call.</p>
node_call(Type, Function, Args) -> node_call(Type, Function, Args) ->
@@ -3741,13 +3583,13 @@ @@ -3743,13 +3585,13 @@
node_action(Host, Type, Function, Args) -> node_action(Host, Type, Function, Args) ->
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]), ?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
@ -777,7 +777,7 @@
case tree_call(Host, get_node, [Host, Node]) of case tree_call(Host, get_node, [Host, Node]) of
N when is_record(N, pubsub_node) -> N when is_record(N, pubsub_node) ->
case Action(N) of case Action(N) of
@@ -3760,8 +3602,15 @@ @@ -3762,8 +3604,15 @@
end end
end, Trans). end, Trans).
@ -795,7 +795,7 @@
{result, Result} -> {result, Result}; {result, Result} -> {result, Result};
{error, Error} -> {error, Error}; {error, Error} -> {error, Error};
{atomic, {result, Result}} -> {result, Result}; {atomic, {result, Result}} -> {result, Result};
@@ -3769,6 +3618,15 @@ @@ -3771,6 +3620,15 @@
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]), ?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
{error, 'internal-server-error'}; {error, 'internal-server-error'};
@ -811,7 +811,7 @@
{'EXIT', Reason} -> {'EXIT', Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]), ?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
{error, 'internal-server-error'}; {error, 'internal-server-error'};
@@ -3777,6 +3635,16 @@ @@ -3779,6 +3637,16 @@
{error, 'internal-server-error'} {error, 'internal-server-error'}
end. end.