---- mod_pubsub.erl 2010-05-19 10:45:13.000000000 +0200
-+++ mod_pubsub_odbc.erl 2010-05-19 10:46:47.000000000 +0200
+--- mod_pubsub.erl 2010-05-19 11:03:27.000000000 +0200
++++ mod_pubsub_odbc.erl 2010-05-19 11:04:11.000000000 +0200
@@ -42,7 +42,7 @@
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
%%% XEP-0060 section 12.18.
send_items(Host, Node, NodeId, Type, LJID, Number) ->
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
{result, []} ->
-@@ -2441,8 +2267,8 @@
+@@ -2441,7 +2267,8 @@
error ->
{error, ?ERR_BAD_REQUEST};
_ ->
- Action = fun(#pubsub_node{owners = Owners, type = Type, id = NodeId}=N) ->
-- 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 ->
OwnerJID = exmpp_jid:make(Owner),
- FilteredEntities = case Owners of
-@@ -2451,24 +2277,7 @@
+@@ -2451,24 +2278,7 @@
end,
lists:foreach(
fun({JID, Affiliation}) ->
end, FilteredEntities),
{result, []};
_ ->
-@@ -2521,11 +2330,11 @@
+@@ -2521,11 +2331,11 @@
end.
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
OptionsEl = {xmlelement, "options", [{"jid", jlib:jid_to_string(Subscriber)},
{"subid", SubID}|nodeAttr(Node)],
[XdataEl]},
-@@ -2551,7 +2360,7 @@
+@@ -2551,7 +2361,7 @@
end.
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
{result, GoodSubOpts} -> GoodSubOpts;
_ -> invalid
end,
-@@ -2580,7 +2389,7 @@
+@@ -2580,7 +2390,7 @@
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
{error, extended_error(?ERR_BAD_REQUEST, "invalid-options")};
write_sub(Subscriber, NodeID, SubID, Options) ->
{error, notfound} ->
{error, extended_error(?ERR_NOT_ACCEPTABLE, "invalid-subid")};
{result, _} ->
-@@ -2748,8 +2557,8 @@
+@@ -2748,8 +2558,8 @@
{"subscription", subscription_to_string(Sub)} | nodeAttr(Node)], []}]}]},
ejabberd_router:route(service_jid(Host), jlib:make_jid(JID), Stanza)
end,
true ->
Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
-@@ -3079,7 +2888,7 @@
+@@ -3079,7 +2889,7 @@
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
end,
{result, CollSubs} -> CollSubs;
_ -> []
end.
-@@ -3093,9 +2902,9 @@
+@@ -3093,9 +2903,9 @@
get_options_for_subs(NodeID, Subs) ->
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
_ -> Acc
end;
(_, Acc) ->
-@@ -3299,6 +3108,30 @@
+@@ -3299,6 +3109,30 @@
Result
end.
%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
-@@ -3694,7 +3527,13 @@
+@@ -3694,7 +3528,13 @@
tree_action(Host, Function, Args) ->
?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
Fun = fun() -> tree_call(Host, Function, Args) end,
%% @doc <p>node plugin call.</p>
node_call(Type, Function, Args) ->
-@@ -3714,13 +3553,13 @@
+@@ -3714,13 +3554,13 @@
node_action(Host, Type, Function, Args) ->
?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
case tree_call(Host, get_node, [Host, Node]) of
N when is_record(N, pubsub_node) ->
case Action(N) of
-@@ -3733,8 +3572,14 @@
+@@ -3733,8 +3573,14 @@
end
end, Trans).
{result, Result} -> {result, Result};
{error, Error} -> {error, Error};
{atomic, {result, Result}} -> {result, Result};
-@@ -3742,6 +3587,15 @@
+@@ -3742,6 +3588,15 @@
{aborted, Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
{error, ?ERR_INTERNAL_SERVER_ERROR};
{'EXIT', Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
{error, ?ERR_INTERNAL_SERVER_ERROR};
-@@ -3750,6 +3604,17 @@
+@@ -3750,6 +3605,17 @@
{error, ?ERR_INTERNAL_SERVER_ERROR}
end.