mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-31 15:21:38 +01:00
Merge branch '3.0.x' of git+ssh://git@gitorious.process-one.net/+ejabberd-developers/ejabberd/maincustomers.git into 3.0.x
This commit is contained in:
commit
a15e689386
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
--- mod_pubsub.erl 2012-08-14 17:49:41.509238095 +0200
|
||||
+++ mod_pubsub_odbc.erl 2012-08-14 17:52:17.599227806 +0200
|
||||
--- mod_pubsub.erl 2012-10-01 10:05:28.172445600 +0200
|
||||
+++ mod_pubsub_odbc.erl 2012-10-01 11:47:29.225239163 +0200
|
||||
@@ -41,7 +41,7 @@
|
||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||
%%% XEP-0060 section 12.18.
|
||||
@ -530,28 +530,32 @@
|
||||
true ->
|
||||
% resource not concerned about that subscription
|
||||
ok
|
||||
@@ -1006,7 +589,8 @@
|
||||
@@ -1032,8 +615,11 @@
|
||||
children = []}];
|
||||
disco_identity(Host, Node, From) ->
|
||||
Action = fun (#pubsub_node{id = Idx, type = Type,
|
||||
- options = Options, owners = Owners}) ->
|
||||
- case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
+ options = Options}) ->
|
||||
+ Owners = node_owners_call(Type, Idx),
|
||||
case get_allowed_items_call(Host, Idx, From, Type,
|
||||
Options, Owners)
|
||||
of
|
||||
@@ -1054,7 +638,8 @@
|
||||
|| Feature <- features(<<"pep">>)]];
|
||||
+ case get_allowed_items_call(Host, Idx, From, Type,
|
||||
+ Options, Owners)
|
||||
+ of
|
||||
{result, _} ->
|
||||
{result,
|
||||
[#xmlel{name = <<"identity">>,
|
||||
@@ -1084,7 +670,8 @@
|
||||
|| Feature <- features(<<"pep">>)]];
|
||||
disco_features(Host, Node, From) ->
|
||||
Action = fun (#pubsub_node{id = Idx, type = Type,
|
||||
- options = Options, owners = Owners}) ->
|
||||
+ options = Options}) ->
|
||||
+ Owners = node_owners_call(Type, Idx),
|
||||
case get_allowed_items_call(Host, Idx, From, Type,
|
||||
Options, Owners)
|
||||
of
|
||||
@@ -1087,9 +672,9 @@
|
||||
|
||||
+ Owners = node_owners_call(Type, Idx),
|
||||
case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
{result, _} ->
|
||||
{result,
|
||||
@@ -1129,9 +716,9 @@
|
||||
).
|
||||
disco_items(Host, <<>>, From) ->
|
||||
Action = fun (#pubsub_node{nodeid = {_, NodeID},
|
||||
- options = Options, type = Type, id = Idx,
|
||||
@ -559,10 +563,10 @@
|
||||
+ options = Options, type = Type, id = Idx},
|
||||
Acc) ->
|
||||
+ Owners = node_owners_call(Type, Idx),
|
||||
case get_allowed_items_call(Host, Idx, From, Type,
|
||||
Options, Owners)
|
||||
of
|
||||
@@ -1112,13 +697,14 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
{result, _} ->
|
||||
[#xmlel{name = <<"item">>,
|
||||
@@ -1152,13 +739,14 @@
|
||||
_ -> Acc
|
||||
end
|
||||
end,
|
||||
@ -579,7 +583,7 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type,
|
||||
Options, Owners)
|
||||
of
|
||||
@@ -1231,9 +817,6 @@
|
||||
@@ -1262,9 +850,6 @@
|
||||
lists:foreach(fun ({#pubsub_node{options
|
||||
=
|
||||
Options,
|
||||
@ -589,7 +593,7 @@
|
||||
id =
|
||||
NodeId},
|
||||
subscribed, _,
|
||||
@@ -1245,7 +828,9 @@
|
||||
@@ -1276,7 +861,9 @@
|
||||
presence ->
|
||||
case
|
||||
lists:member(BJID,
|
||||
@ -600,7 +604,7 @@
|
||||
of
|
||||
true ->
|
||||
node_action(Host,
|
||||
@@ -1316,7 +901,7 @@
|
||||
@@ -1347,7 +934,7 @@
|
||||
{H,
|
||||
N},
|
||||
type =
|
||||
@ -609,7 +613,7 @@
|
||||
owner})
|
||||
when N ==
|
||||
HomeTreeBase ->
|
||||
@@ -1465,7 +1050,8 @@
|
||||
@@ -1495,7 +1082,8 @@
|
||||
IQ ->
|
||||
#xmlel{attrs = QAttrs} = SubEl,
|
||||
Node = xml:get_attr_s(<<"node">>, QAttrs),
|
||||
@ -619,7 +623,7 @@
|
||||
{result, IQRes} ->
|
||||
jlib:iq_to_xml(IQ#iq{type = result,
|
||||
sub_el =
|
||||
@@ -1588,7 +1174,8 @@
|
||||
@@ -1669,7 +1257,8 @@
|
||||
[] -> [<<"leaf">>];
|
||||
_ ->
|
||||
case node_call(Type, get_items,
|
||||
@ -629,7 +633,7 @@
|
||||
of
|
||||
{result, []} ->
|
||||
[<<"collection">>];
|
||||
@@ -1610,7 +1197,13 @@
|
||||
@@ -1691,7 +1280,13 @@
|
||||
F = [#xmlel{name = <<"feature">>,
|
||||
attrs = [{<<"var">>, ?NS_PUBSUB}],
|
||||
children = []}
|
||||
@ -644,7 +648,7 @@
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs =
|
||||
[{<<"var">>,
|
||||
@@ -1654,12 +1247,16 @@
|
||||
@@ -1735,10 +1330,16 @@
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs = [{<<"var">>, ?NS_VCARD}], children = []}]
|
||||
++
|
||||
@ -656,38 +660,47 @@
|
||||
+ (T) ->
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs =
|
||||
[{<<"var">>,
|
||||
<<(?NS_PUBSUB)/binary, "#",
|
||||
- Feature/binary>>}],
|
||||
- [{<<"var">>, <<(?NS_PUBSUB)/binary, "#", Feature/binary>>}],
|
||||
+ [{<<"var">>,
|
||||
+ <<(?NS_PUBSUB)/binary, "#",
|
||||
+ T/binary>>}],
|
||||
children = []}
|
||||
end,
|
||||
features(Host, Node))};
|
||||
@@ -1669,7 +1266,7 @@
|
||||
@@ -1748,14 +1349,15 @@
|
||||
_ -> node_disco_info(Host, Node, From)
|
||||
end.
|
||||
|
||||
--spec(iq_disco_items/3 ::
|
||||
+-spec(iq_disco_items/4 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
NodeId :: <<>> | mod_pubsub:nodeId(),
|
||||
- From :: jid())
|
||||
+ From :: jid(),
|
||||
+ Rsm :: none | rsm_in())
|
||||
-> {result, [xmlel()]}
|
||||
).
|
||||
-iq_disco_items(Host, <<>>, From) ->
|
||||
+iq_disco_items(Host, [], From, _RSM) ->
|
||||
case tree_action(Host, get_subnodes, [Host, <<>>, From])
|
||||
of
|
||||
Nodes when is_list(Nodes) ->
|
||||
@@ -1691,7 +1288,7 @@
|
||||
Nodes)};
|
||||
Other -> Other
|
||||
end;
|
||||
+iq_disco_items(Host, <<>>, From, _RSM) ->
|
||||
{result,
|
||||
lists:map(fun (#pubsub_node{nodeid = {_, SubNode},
|
||||
options = Options}) ->
|
||||
@@ -1792,7 +1394,7 @@
|
||||
% Nodes)};
|
||||
% Other -> Other
|
||||
% end;
|
||||
-iq_disco_items(Host, ?NS_COMMANDS, _From) ->
|
||||
+iq_disco_items(Host, ?NS_COMMANDS, _From, _RSM) ->
|
||||
CommandItems = [#xmlel{name = <<"item">>,
|
||||
attrs =
|
||||
[{<<"jid">>, Host},
|
||||
@@ -1699,23 +1296,29 @@
|
||||
@@ -1800,23 +1402,28 @@
|
||||
{<<"name">>, <<"Get Pending">>}],
|
||||
children = []}],
|
||||
{result, CommandItems};
|
||||
-iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From) ->
|
||||
+iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From,
|
||||
+ _RSM) ->
|
||||
+iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From, _RSM) ->
|
||||
CommandItems = [], {result, CommandItems};
|
||||
-iq_disco_items(Host, Item, From) ->
|
||||
+iq_disco_items(Host, Item, From, RSM) ->
|
||||
@ -722,7 +735,7 @@
|
||||
Nodes = lists:map(fun (#pubsub_node{nodeid =
|
||||
{_, SubNode},
|
||||
options =
|
||||
@@ -1757,7 +1360,7 @@
|
||||
@@ -1858,7 +1465,7 @@
|
||||
children = []}
|
||||
end,
|
||||
NodeItems),
|
||||
@ -731,55 +744,39 @@
|
||||
end,
|
||||
case transaction(Host, Node, Action, sync_dirty) of
|
||||
{result, {_, Result}} -> {result, Result};
|
||||
@@ -1906,7 +1509,9 @@
|
||||
@@ -2009,7 +1616,8 @@
|
||||
(_, Acc) -> Acc
|
||||
end,
|
||||
[], xml:remove_cdata(Els)),
|
||||
- get_items(Host, Node, From, SubId, MaxItems, ItemIDs);
|
||||
+ RSM = jlib:rsm_decode(SubEl),
|
||||
+ get_items(Host, Node, From, SubId, MaxItems, ItemIDs,
|
||||
+ RSM);
|
||||
+ get_items(Host, Node, From, SubId, MaxItems, ItemIDs, RSM);
|
||||
{get, <<"subscriptions">>} ->
|
||||
get_subscriptions(Host, Node, From, Plugins);
|
||||
{get, <<"affiliations">>} ->
|
||||
@@ -1929,7 +1534,11 @@
|
||||
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl,
|
||||
Lang) ->
|
||||
#xmlel{children = SubEls} = SubEl,
|
||||
- Action = xml:remove_cdata(SubEls),
|
||||
+ Action = lists:filter(fun (#xmlel{name = <<"set">>}) ->
|
||||
+ false;
|
||||
+ (_) -> true
|
||||
+ end,
|
||||
+ xml:remove_cdata(SubEls)),
|
||||
case Action of
|
||||
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
||||
Node = xml:get_attr_s(<<"node">>, Attrs),
|
||||
@@ -2061,9 +1670,8 @@
|
||||
@@ -2174,7 +1782,7 @@
|
||||
_ -> []
|
||||
end
|
||||
end,
|
||||
- case transaction(fun () ->
|
||||
- {result, lists:flatmap(Tr, Plugins)}
|
||||
- end,
|
||||
+ case transaction(Host,
|
||||
+ fun () -> {result, lists:flatmap(Tr, Plugins)} end,
|
||||
+ case transaction(Host, fun () ->
|
||||
{result, lists:flatmap(Tr, Plugins)}
|
||||
end,
|
||||
sync_dirty)
|
||||
of
|
||||
{result, Res} -> Res;
|
||||
@@ -2103,8 +1711,9 @@
|
||||
@@ -2216,8 +1824,10 @@
|
||||
|
||||
%%% authorization handling
|
||||
|
||||
-send_authorization_request(#pubsub_node{owners = Owners,
|
||||
- nodeid = {Host, Node}},
|
||||
-send_authorization_request(#pubsub_node{owners = Owners, nodeid = {Host, Node}},
|
||||
- Subscriber) ->
|
||||
+send_authorization_request(#pubsub_node{nodeid =
|
||||
+ {Host, Node},
|
||||
+ type = Type, id = NodeId},
|
||||
Subscriber) ->
|
||||
+ Subscriber) ->
|
||||
Lang = <<"en">>,
|
||||
Stanza = #xmlel{name = <<"message">>, attrs = [],
|
||||
@@ -2182,7 +1791,7 @@
|
||||
children =
|
||||
@@ -2294,7 +1904,7 @@
|
||||
ejabberd_router:route(service_jid(Host),
|
||||
jlib:make_jid(Owner), Stanza)
|
||||
end,
|
||||
@ -788,7 +785,7 @@
|
||||
|
||||
find_authorization_response(Packet) ->
|
||||
#xmlel{children = Els} = Packet,
|
||||
@@ -2242,11 +1851,10 @@
|
||||
@@ -2353,11 +1963,10 @@
|
||||
<<"true">> -> true;
|
||||
_ -> false
|
||||
end,
|
||||
@ -802,7 +799,7 @@
|
||||
{result, Subscriptions} = node_call(Type,
|
||||
get_subscriptions,
|
||||
[NodeId,
|
||||
@@ -2470,7 +2078,7 @@
|
||||
@@ -2597,7 +2206,7 @@
|
||||
children =
|
||||
[#xmlel{name = <<"create">>,
|
||||
attrs = nodeAttr(Node), children = []}]}],
|
||||
@ -811,8 +808,8 @@
|
||||
{result, {NodeId, {Result, broadcast}}} ->
|
||||
broadcast_created_node(Host, Node, NodeId, Type,
|
||||
NodeOptions),
|
||||
@@ -2563,7 +2171,7 @@
|
||||
|
||||
@@ -2709,7 +2318,7 @@
|
||||
).
|
||||
subscribe_node(Host, Node, From, JID, Configuration) ->
|
||||
SubOpts = case
|
||||
- pubsub_subscription:parse_options_xform(Configuration)
|
||||
@ -820,53 +817,64 @@
|
||||
of
|
||||
{result, GoodSubOpts} -> GoodSubOpts;
|
||||
_ -> invalid
|
||||
@@ -2573,7 +2181,7 @@
|
||||
J -> jlib:jid_tolower(J)
|
||||
@@ -2723,7 +2332,7 @@
|
||||
end
|
||||
end,
|
||||
Action = fun (#pubsub_node{options = Options,
|
||||
- owners = Owners, type = Type, id = NodeId}) ->
|
||||
+ type = Type, id = NodeId}) ->
|
||||
Features = features(Type),
|
||||
SubscribeFeature = lists:member(<<"subscribe">>,
|
||||
Features),
|
||||
@@ -2586,6 +2194,7 @@
|
||||
send_last_published_item),
|
||||
AllowedGroups = get_option(Options,
|
||||
roster_groups_allowed, []),
|
||||
SubscribeFeature = lists:member(<<"subscribe">>, Features),
|
||||
OptionsFeature = lists:member(<<"subscription-options">>, Features),
|
||||
@@ -2732,6 +2341,7 @@
|
||||
AccessModel = get_option(Options, access_model),
|
||||
SendLast = get_option(Options, send_last_published_item),
|
||||
AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
||||
+ Owners = node_owners_call(Type, NodeId),
|
||||
{PresenceSubscription, RosterGroup} =
|
||||
get_presence_and_roster_permissions(Host, Subscriber,
|
||||
Owners,
|
||||
@@ -2899,8 +2508,8 @@
|
||||
get_presence_and_roster_permissions(Host, Subscriber,
|
||||
Owners, AccessModel, AllowedGroups),
|
||||
@@ -3076,19 +2686,20 @@
|
||||
Error -> Error
|
||||
end.
|
||||
|
||||
-get_items(Host, Node, From, SubId, SMaxItems,
|
||||
- ItemIDs) ->
|
||||
+get_items(Host, Node, From, SubId, SMaxItems, ItemIDs,
|
||||
+ RSM) ->
|
||||
--spec(get_items/6 ::
|
||||
+-spec(get_items/7 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
Node :: mod_pubsub:nodeId(),
|
||||
From :: jid(),
|
||||
SubId :: mod_pubsub:subId(),
|
||||
SMaxItems :: binary(),
|
||||
- ItemIDs :: [mod_pubsub:itemId()])
|
||||
+ ItemIDs :: [mod_pubsub:itemId()],
|
||||
+ Rsm :: none | rsm_in())
|
||||
-> {result, [xmlel(),...]}
|
||||
%%%
|
||||
| {error, xmlel()}
|
||||
).
|
||||
-get_items(Host, Node, From, SubId, SMaxItems, ItemIDs) ->
|
||||
+get_items(Host, Node, From, SubId, SMaxItems, ItemIDs, RSM) ->
|
||||
MaxItems = if SMaxItems == <<"">> ->
|
||||
get_max_items_node(Host);
|
||||
true ->
|
||||
@@ -2913,8 +2522,7 @@
|
||||
@@ -3100,13 +2711,13 @@
|
||||
case MaxItems of
|
||||
{error, Error} -> {error, Error};
|
||||
_ ->
|
||||
Action = fun (#pubsub_node{options = Options,
|
||||
- type = Type, id = NodeId,
|
||||
- Action = fun (#pubsub_node{options = Options, type = Type, id = NodeId,
|
||||
- owners = Owners}) ->
|
||||
+ type = Type, id = NodeId}) ->
|
||||
+ Action = fun (#pubsub_node{options = Options, type = Type, id = NodeId}) ->
|
||||
Features = features(Type),
|
||||
RetreiveFeature = lists:member(<<"retrieve-items">>,
|
||||
Features),
|
||||
@@ -2924,6 +2532,7 @@
|
||||
AllowedGroups = get_option(Options,
|
||||
roster_groups_allowed,
|
||||
[]),
|
||||
RetreiveFeature = lists:member(<<"retrieve-items">>, Features),
|
||||
PersistentFeature = lists:member(<<"persistent-items">>, Features),
|
||||
AccessModel = get_option(Options, access_model),
|
||||
AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
||||
+ Owners = node_owners_call(Type, NodeId),
|
||||
{PresenceSubscription, RosterGroup} =
|
||||
get_presence_and_roster_permissions(Host, From,
|
||||
Owners,
|
||||
@@ -2943,11 +2552,11 @@
|
||||
get_presence_and_roster_permissions(Host, From, Owners,
|
||||
AccessModel, AllowedGroups),
|
||||
@@ -3124,11 +2735,11 @@
|
||||
node_call(Type, get_items,
|
||||
[NodeId, From, AccessModel,
|
||||
PresenceSubscription, RosterGroup,
|
||||
@ -880,7 +888,7 @@
|
||||
SendItems = case ItemIDs of
|
||||
[] -> Items;
|
||||
_ ->
|
||||
@@ -2966,7 +2575,8 @@
|
||||
@@ -3147,7 +2758,8 @@
|
||||
[#xmlel{name = <<"items">>, attrs = nodeAttr(Node),
|
||||
children =
|
||||
itemsEls(lists:sublist(SendItems,
|
||||
@ -890,10 +898,13 @@
|
||||
Error -> Error
|
||||
end
|
||||
end.
|
||||
@@ -2991,6 +2601,15 @@
|
||||
@@ -3170,42 +2782,68 @@
|
||||
Error -> Error
|
||||
end.
|
||||
|
||||
get_allowed_items_call(Host, NodeIdx, From, Type,
|
||||
Options, Owners) ->
|
||||
-get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) ->
|
||||
+get_allowed_items_call(Host, NodeIdx, From, Type,
|
||||
+ Options, Owners) ->
|
||||
+ case get_allowed_items_call(Host, NodeIdx, From, Type,
|
||||
+ Options, Owners, none)
|
||||
+ of
|
||||
@ -904,17 +915,20 @@
|
||||
+get_allowed_items_call(Host, NodeIdx, From, Type,
|
||||
+ Options, Owners, RSM) ->
|
||||
AccessModel = get_option(Options, access_model),
|
||||
AllowedGroups = get_option(Options,
|
||||
roster_groups_allowed, []),
|
||||
@@ -2999,36 +2618,49 @@
|
||||
AccessModel, AllowedGroups),
|
||||
- AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
||||
+ AllowedGroups = get_option(Options,
|
||||
+ roster_groups_allowed, []),
|
||||
{PresenceSubscription, RosterGroup} =
|
||||
- get_presence_and_roster_permissions(Host, From, Owners, AccessModel,
|
||||
- AllowedGroups),
|
||||
+ get_presence_and_roster_permissions(Host, From, Owners,
|
||||
+ AccessModel, AllowedGroups),
|
||||
node_call(Type, get_items,
|
||||
[NodeIdx, From, AccessModel, PresenceSubscription,
|
||||
- RosterGroup, undefined]).
|
||||
- [NodeIdx, From, AccessModel, PresenceSubscription, RosterGroup, undefined]).
|
||||
+ [NodeIdx, From, AccessModel, PresenceSubscription,
|
||||
+ RosterGroup, undefined, RSM]).
|
||||
|
||||
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
last) ->
|
||||
-send_items(Host, Node, NodeId, Type, {U, S, R} = LJID, last) ->
|
||||
- case get_cached_item(Host, NodeId) of
|
||||
- undefined ->
|
||||
- send_items(Host, Node, NodeId, Type, LJID, 1);
|
||||
@ -923,6 +937,8 @@
|
||||
- LastItem#pubsub_item.modification,
|
||||
- Stanza = event_stanza_with_delay([#xmlel{name =
|
||||
- <<"items">>,
|
||||
+send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
+ last) ->
|
||||
+ Stanza = case get_cached_item(Host, NodeId) of
|
||||
+ undefined ->
|
||||
+ case node_action(Host, Type, get_last_items,
|
||||
@ -980,99 +996,61 @@
|
||||
end
|
||||
end;
|
||||
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
@@ -3232,9 +2864,8 @@
|
||||
@@ -3436,9 +3074,8 @@
|
||||
case Entities of
|
||||
error -> {error, ?ERR_BAD_REQUEST};
|
||||
_ ->
|
||||
- Action = fun (#pubsub_node{owners = Owners, type = Type,
|
||||
- id = NodeId} =
|
||||
- N) ->
|
||||
+ Action = fun (#pubsub_node{type = Type, id = NodeId}) ->
|
||||
+ Action = fun (#pubsub_node{type = Type, id = NodeId} = N) ->
|
||||
+ Owners = node_owners_call(Type, NodeId),
|
||||
case lists:member(Owner, Owners) of
|
||||
true ->
|
||||
OwnerJID = jlib:make_jid(Owner),
|
||||
@@ -3250,39 +2881,7 @@
|
||||
node_call(Type,
|
||||
set_affiliation,
|
||||
[NodeId, JID,
|
||||
- Affiliation]),
|
||||
- case Affiliation of
|
||||
- owner ->
|
||||
- NewOwner =
|
||||
- jlib:jid_tolower(jlib:jid_remove_resource(JID)),
|
||||
- NewOwners =
|
||||
- [NewOwner
|
||||
- | Owners],
|
||||
- tree_call(Host,
|
||||
- set_node,
|
||||
- [N#pubsub_node{owners
|
||||
- =
|
||||
- NewOwners}]);
|
||||
- none ->
|
||||
- OldOwner =
|
||||
- jlib:jid_tolower(jlib:jid_remove_resource(JID)),
|
||||
- case
|
||||
- lists:member(OldOwner,
|
||||
- Owners)
|
||||
- of
|
||||
- true ->
|
||||
- NewOwners =
|
||||
- Owners --
|
||||
- [OldOwner],
|
||||
- tree_call(Host,
|
||||
- set_node,
|
||||
- [N#pubsub_node{owners
|
||||
- =
|
||||
- NewOwners}]);
|
||||
- _ -> ok
|
||||
- end;
|
||||
- _ -> ok
|
||||
- end
|
||||
+ Affiliation])
|
||||
end,
|
||||
FilteredEntities),
|
||||
{result, []};
|
||||
@@ -3342,10 +2941,13 @@
|
||||
@@ -3545,10 +3182,10 @@
|
||||
end.
|
||||
|
||||
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
||||
- case pubsub_subscription:get_subscription(Subscriber, NodeID, SubID) of
|
||||
+ case
|
||||
+ pubsub_subscription_odbc:get_subscription(Subscriber, NodeID, SubID)
|
||||
+ of
|
||||
+ case pubsub_subscription_odbc:get_subscription(Subscriber, NodeID, SubID) of
|
||||
{result, #pubsub_subscription{options = Options}} ->
|
||||
{result, XdataEl} =
|
||||
- pubsub_subscription:get_options_xform(Lang, Options),
|
||||
+ pubsub_subscription_odbc:get_options_xform(Lang,
|
||||
+ Options),
|
||||
+ pubsub_subscription_odbc:get_options_xform(Lang, Options),
|
||||
OptionsEl = #xmlel{name = <<"options">>,
|
||||
attrs =
|
||||
[{<<"jid">>, jlib:jid_to_string(Subscriber)},
|
||||
@@ -3392,7 +2994,7 @@
|
||||
set_options_helper(Configuration, JID, NodeID, SubID,
|
||||
Type) ->
|
||||
SubOpts = case
|
||||
- pubsub_subscription:parse_options_xform(Configuration)
|
||||
+ pubsub_subscription_odbc:parse_options_xform(Configuration)
|
||||
of
|
||||
@@ -3593,7 +3230,7 @@
|
||||
end.
|
||||
|
||||
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
||||
- SubOpts = case pubsub_subscription:parse_options_xform(Configuration) of
|
||||
+ SubOpts = case pubsub_subscription_odbc:parse_options_xform(Configuration) of
|
||||
{result, GoodSubOpts} -> GoodSubOpts;
|
||||
_ -> invalid
|
||||
@@ -3654,9 +3256,10 @@
|
||||
end,
|
||||
@@ -3629,7 +3266,7 @@
|
||||
write_sub(_Subscriber, _NodeID, _SubID, []) ->
|
||||
{result, []};
|
||||
write_sub(Subscriber, NodeID, SubID, Options) ->
|
||||
- case pubsub_subscription:set_subscription(Subscriber,
|
||||
+ case pubsub_subscription_odbc:set_subscription(Subscriber,
|
||||
NodeID, SubID, Options)
|
||||
of
|
||||
{result, _} -> {result, []};
|
||||
@@ -3854,8 +3491,8 @@
|
||||
ejabberd_router:route(service_jid(Host),
|
||||
jlib:make_jid(JID), Stanza)
|
||||
end,
|
||||
- Action = fun (#pubsub_node{owners = Owners, type = Type,
|
||||
- id = NodeId}) ->
|
||||
- case lists:member(Owner, Owners) of
|
||||
+ Action = fun (#pubsub_node{type = Type, id = NodeId}) ->
|
||||
+ case lists:member(Owner,
|
||||
+ node_owners_call(Type, NodeId))
|
||||
+ of
|
||||
+ Owners = node_owners_call(Type, NodeId),
|
||||
case lists:member(Owner, Owners) of
|
||||
true ->
|
||||
Result = lists:foldl(fun ({JID, Subscription,
|
||||
SubId},
|
||||
@@ -4110,7 +3713,7 @@
|
||||
@@ -4347,7 +3984,7 @@
|
||||
[{Depth, [{N, sub_with_options(N)} || N <- Nodes]}
|
||||
|| {Depth, Nodes} <- Collection]}
|
||||
end,
|
||||
@ -1081,21 +1059,20 @@
|
||||
{result, CollSubs} ->
|
||||
subscribed_nodes_by_jid(NotifyType, CollSubs);
|
||||
_ -> []
|
||||
@@ -4207,10 +3810,10 @@
|
||||
@@ -4443,10 +4080,10 @@
|
||||
end.
|
||||
|
||||
sub_with_options(JID, NodeId, SubId) ->
|
||||
- case pubsub_subscription:read_subscription(JID, NodeId,
|
||||
- SubId)
|
||||
+ case pubsub_subscription_odbc:get_subscription(JID,
|
||||
+ NodeId, SubId)
|
||||
+ case pubsub_subscription_odbc:get_subscription(JID, NodeId,
|
||||
SubId)
|
||||
of
|
||||
- #pubsub_subscription{options = Options} ->
|
||||
+ {result, #pubsub_subscription{options = Options}} ->
|
||||
{JID, SubId, Options};
|
||||
_ -> {JID, SubId, []}
|
||||
end.
|
||||
@@ -4301,6 +3904,28 @@
|
||||
@@ -4537,6 +4174,28 @@
|
||||
Result -> Result
|
||||
end.
|
||||
|
||||
@ -1124,7 +1101,7 @@
|
||||
max_items(Host, Options) ->
|
||||
case get_option(Options, persist_items) of
|
||||
true ->
|
||||
@@ -4788,7 +4413,14 @@
|
||||
@@ -5024,7 +4683,14 @@
|
||||
tree_action(Host, Function, Args) ->
|
||||
?DEBUG("tree_action ~p ~p ~p", [Host, Function, Args]),
|
||||
Fun = fun () -> tree_call(Host, Function, Args) end,
|
||||
@ -1140,24 +1117,22 @@
|
||||
|
||||
node_call(Type, Function, Args) ->
|
||||
?DEBUG("node_call ~p ~p ~p", [Type, Function, Args]),
|
||||
@@ -4812,12 +4444,13 @@
|
||||
@@ -5048,12 +4714,12 @@
|
||||
node_action(Host, Type, Function, Args) ->
|
||||
?DEBUG("node_action ~p ~p ~p ~p",
|
||||
[Host, Type, Function, Args]),
|
||||
- transaction(fun () -> node_call(Type, Function, Args)
|
||||
- end,
|
||||
+ transaction(Host,
|
||||
+ fun () -> node_call(Type, Function, Args) end,
|
||||
+ transaction(Host, fun () -> node_call(Type, Function, Args)
|
||||
end,
|
||||
sync_dirty).
|
||||
|
||||
transaction(Host, Node, Action, Trans) ->
|
||||
- transaction(fun () ->
|
||||
+ transaction(Host,
|
||||
+ fun () ->
|
||||
+ transaction(Host, fun () ->
|
||||
case tree_call(Host, get_node, [Host, Node]) of
|
||||
N when is_record(N, pubsub_node) ->
|
||||
case Action(N) of
|
||||
@@ -4831,16 +4464,24 @@
|
||||
@@ -5067,16 +4733,24 @@
|
||||
end,
|
||||
Trans).
|
||||
|
||||
@ -1186,7 +1161,7 @@
|
||||
{result, Result} -> {result, Result};
|
||||
{error, Error} -> {error, Error};
|
||||
{atomic, {result, Result}} -> {result, Result};
|
||||
@@ -4849,6 +4490,16 @@
|
||||
@@ -5085,6 +4759,16 @@
|
||||
?ERROR_MSG("transaction return internal error: ~p~n",
|
||||
[{aborted, Reason}]),
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
@ -1203,7 +1178,7 @@
|
||||
{'EXIT', Reason} ->
|
||||
?ERROR_MSG("transaction return internal error: ~p~n",
|
||||
[{'EXIT', Reason}]),
|
||||
@@ -4859,6 +4510,20 @@
|
||||
@@ -5095,6 +4779,20 @@
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user