diff options
Diffstat (limited to 'src/pubsub_odbc.patch')
-rw-r--r-- | src/pubsub_odbc.patch | 133 |
1 files changed, 62 insertions, 71 deletions
diff --git a/src/pubsub_odbc.patch b/src/pubsub_odbc.patch index fdde477c0..b29804d09 100644 --- a/src/pubsub_odbc.patch +++ b/src/pubsub_odbc.patch @@ -1,5 +1,5 @@ ---- mod_pubsub.erl 2013-06-06 11:08:12.333599362 +0200 -+++ mod_pubsub_odbc.erl 2013-06-06 11:31:06.640173557 +0200 +--- mod_pubsub.erl 2013-06-13 23:58:13.380824021 +0200 ++++ mod_pubsub_odbc.erl 2013-06-14 00:01:11.907478941 +0200 @@ -43,7 +43,7 @@ %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see %%% XEP-0060 section 12.18. @@ -9,7 +9,7 @@ -author('christophe.romain@process-one.net'). -@@ -61,11 +61,11 @@ +@@ -62,11 +62,11 @@ -include("pubsub.hrl"). @@ -24,7 +24,7 @@ %% exports for hooks -export([presence_probe/3, caps_update/3, -@@ -100,7 +100,7 @@ +@@ -101,7 +101,7 @@ -export([subscription_to_string/1, affiliation_to_string/1, string_to_subscription/1, string_to_affiliation/1, extended_error/2, extended_error/3, @@ -33,7 +33,7 @@ %% API and gen_server callbacks -export([start_link/2, start/2, stop/1, init/1, -@@ -110,7 +110,7 @@ +@@ -111,7 +111,7 @@ %% calls for parallel sending of last items -export([send_loop/1]). @@ -42,7 +42,7 @@ -define(LOOPNAME, ejabberd_mod_pubsub_loop). -@@ -349,8 +349,6 @@ +@@ -350,8 +350,6 @@ false -> ok end, ejabberd_router:register_route(Host), @@ -51,7 +51,7 @@ put(server_host, ServerHost), init_nodes(Host, ServerHost, NodeTree, Plugins), State = #state{host = Host, server_host = ServerHost, -@@ -423,359 +421,14 @@ +@@ -424,359 +422,14 @@ ok. init_nodes(Host, ServerHost, _NodeTree, Plugins) -> @@ -414,7 +414,7 @@ send_loop(State) -> receive {presence, JID, Pid} -> -@@ -784,11 +437,13 @@ +@@ -785,11 +438,13 @@ LJID = jlib:jid_tolower(JID), BJID = jlib:jid_remove_resource(LJID), lists:foreach(fun (PType) -> @@ -432,7 +432,7 @@ lists:foreach(fun ({Node, subscribed, _, SubJID}) -> if (SubJID == LJID) or -@@ -800,24 +455,14 @@ +@@ -801,24 +456,14 @@ type = Type, id = @@ -459,7 +459,7 @@ true -> % resource not concerned about that subscription ok -@@ -1008,7 +653,8 @@ +@@ -1009,7 +654,8 @@ children = []}]; disco_identity(Host, Node, From) -> Action = fun (#pubsub_node{id = Idx, type = Type, @@ -469,7 +469,7 @@ case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of {result, _} -> {result, -@@ -1060,7 +706,8 @@ +@@ -1061,7 +707,8 @@ || Feature <- features(<<"pep">>)]]; disco_features(Host, Node, From) -> Action = fun (#pubsub_node{id = Idx, type = Type, @@ -479,7 +479,7 @@ case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of {result, _} -> {result, -@@ -1105,9 +752,9 @@ +@@ -1106,9 +753,9 @@ ). disco_items(Host, <<>>, From) -> Action = fun (#pubsub_node{nodeid = {_, NodeID}, @@ -491,7 +491,7 @@ case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of {result, _} -> [#xmlel{name = <<"item">>, -@@ -1128,13 +775,14 @@ +@@ -1129,13 +776,14 @@ _ -> Acc end end, @@ -508,7 +508,7 @@ case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of -@@ -1238,9 +886,6 @@ +@@ -1239,9 +887,6 @@ lists:foreach(fun ({#pubsub_node{options = Options, @@ -518,7 +518,7 @@ id = NodeId}, subscribed, _, -@@ -1252,7 +897,7 @@ +@@ -1253,7 +898,7 @@ presence -> case lists:member(BJID, @@ -527,7 +527,7 @@ of true -> node_action(Host, -@@ -1512,7 +1157,8 @@ +@@ -1503,7 +1148,8 @@ IQ -> #xmlel{attrs = QAttrs} = SubEl, Node = xml:get_attr_s(<<"node">>, QAttrs), @@ -537,7 +537,7 @@ {result, IQRes} -> jlib:iq_to_xml(IQ#iq{type = result, sub_el = -@@ -1639,7 +1285,7 @@ +@@ -1630,7 +1276,7 @@ % [] -> % [<<"leaf">>]; %% No sub-nodes: it's a leaf node % _ -> @@ -546,7 +546,7 @@ % {result, []} -> [<<"collection">>]; % {result, _} -> [<<"leaf">>, <<"collection">>]; % _ -> [] -@@ -1661,7 +1307,11 @@ +@@ -1652,7 +1298,11 @@ % [#xmlel{name = <<"feature">>, % attrs = [{<<"var">>, ?NS_PUBSUB}], % children = []} @@ -559,7 +559,7 @@ % #xmlel{name = <<"feature">>, % attrs = % [{<<"var">>, -@@ -1686,7 +1336,7 @@ +@@ -1677,7 +1327,7 @@ [] -> [<<"leaf">>]; _ -> case node_call(Type, get_items, @@ -568,7 +568,7 @@ of {result, []} -> [<<"collection">>]; -@@ -1708,7 +1358,11 @@ +@@ -1699,7 +1349,11 @@ F = [#xmlel{name = <<"feature">>, attrs = [{<<"var">>, ?NS_PUBSUB}], children = []} @@ -581,7 +581,7 @@ #xmlel{name = <<"feature">>, attrs = [{<<"var">>, -@@ -1752,7 +1406,11 @@ +@@ -1743,7 +1397,11 @@ #xmlel{name = <<"feature">>, attrs = [{<<"var">>, ?NS_VCARD}], children = []}] ++ @@ -594,7 +594,7 @@ #xmlel{name = <<"feature">>, attrs = [{<<"var">>, <<(?NS_PUBSUB)/binary, "#", Feature/binary>>}], -@@ -1765,14 +1423,15 @@ +@@ -1756,14 +1414,15 @@ _ -> node_disco_info(Host, Node, From) end. @@ -613,7 +613,7 @@ {result, lists:map(fun (#pubsub_node{nodeid = {_, SubNode}, options = Options}) -> -@@ -1809,7 +1468,7 @@ +@@ -1800,7 +1459,7 @@ % Nodes)}; % Other -> Other % end; @@ -622,7 +622,7 @@ CommandItems = [#xmlel{name = <<"item">>, attrs = [{<<"jid">>, Host}, -@@ -1817,22 +1476,19 @@ +@@ -1808,22 +1467,19 @@ {<<"name">>, <<"Get Pending">>}], children = []}], {result, CommandItems}; @@ -651,7 +651,7 @@ end, Nodes = lists:map(fun (#pubsub_node{nodeid = {_, SubNode}, -@@ -1875,7 +1531,7 @@ +@@ -1866,7 +1522,7 @@ children = []} end, NodeItems), @@ -660,7 +660,7 @@ end, case transaction(Host, Node, Action, sync_dirty) of {result, {_, Result}} -> {result, Result}; -@@ -2026,7 +1682,8 @@ +@@ -2017,7 +1673,8 @@ (_, Acc) -> Acc end, [], xml:remove_cdata(Els)), @@ -670,7 +670,7 @@ {get, <<"subscriptions">>} -> get_subscriptions(Host, Node, From, Plugins); {get, <<"affiliations">>} -> -@@ -2061,7 +1718,9 @@ +@@ -2052,7 +1709,9 @@ ). iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) -> #xmlel{children = SubEls} = SubEl, @@ -681,7 +681,7 @@ case Action of [#xmlel{name = Name, attrs = Attrs, children = Els}] -> Node = xml:get_attr_s(<<"node">>, Attrs), -@@ -2195,7 +1854,8 @@ +@@ -2186,7 +1845,8 @@ _ -> [] end end, @@ -691,7 +691,7 @@ {result, lists:flatmap(Tr, Plugins)} end, sync_dirty) -@@ -2240,7 +1900,8 @@ +@@ -2231,7 +1891,8 @@ %%% authorization handling @@ -701,7 +701,7 @@ Subscriber) -> Lang = <<"en">>, Stanza = #xmlel{name = <<"message">>, attrs = [], -@@ -2318,7 +1979,7 @@ +@@ -2309,7 +1970,7 @@ ejabberd_router:route(service_jid(Host), jlib:make_jid(Owner), Stanza) end, @@ -710,7 +710,7 @@ find_authorization_response(Packet) -> #xmlel{children = Els} = Packet, -@@ -2383,11 +2044,11 @@ +@@ -2374,11 +2035,11 @@ <<"true">> -> true; _ -> false end, @@ -724,7 +724,7 @@ {result, Subscriptions} = node_call(Type, get_subscriptions, [NodeId, -@@ -2642,7 +2303,7 @@ +@@ -2633,7 +2294,7 @@ children = [#xmlel{name = <<"create">>, attrs = nodeAttr(Node), children = []}]}], @@ -733,7 +733,7 @@ {result, {NodeId, SubsByDepth, {Result, broadcast}}} -> broadcast_created_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth), ejabberd_hooks:run(pubsub_create_node, ServerHost, [ServerHost, Host, Node, NodeId, NodeOptions]), -@@ -2779,7 +2440,7 @@ +@@ -2770,7 +2431,7 @@ %%</ul> subscribe_node(Host, Node, From, JID, Configuration) -> SubOpts = case @@ -742,7 +742,7 @@ of {result, GoodSubOpts} -> GoodSubOpts; _ -> invalid -@@ -2793,7 +2454,7 @@ +@@ -2784,7 +2445,7 @@ end end, Action = fun (#pubsub_node{options = Options, @@ -751,7 +751,7 @@ Features = features(Type), SubscribeFeature = lists:member(<<"subscribe">>, Features), OptionsFeature = lists:member(<<"subscription-options">>, Features), -@@ -2802,6 +2463,7 @@ +@@ -2793,6 +2454,7 @@ AccessModel = get_option(Options, access_model), SendLast = get_option(Options, send_last_published_item), AllowedGroups = get_option(Options, roster_groups_allowed, []), @@ -759,7 +759,7 @@ {PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, Subscriber, Owners, AccessModel, AllowedGroups), -@@ -2956,12 +2618,9 @@ +@@ -2947,12 +2609,9 @@ Features = features(Type), PublishFeature = lists:member(<<"publish">>, Features), PublishModel = get_option(Options, publish_model), @@ -773,7 +773,7 @@ PayloadCount = payload_xmlelements(Payload), PayloadSize = byte_size(term_to_binary(Payload)) - 2, PayloadMaxSize = get_option(Options, max_payload_size), -@@ -3017,7 +2676,7 @@ +@@ -3008,7 +2667,7 @@ false -> ok end, @@ -782,7 +782,7 @@ case Result of default -> {result, Reply}; _ -> {result, Result} -@@ -3210,19 +2869,20 @@ +@@ -3201,19 +2860,20 @@ %% <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 %% to read the items. @@ -806,7 +806,7 @@ MaxItems = if SMaxItems == <<"">> -> get_max_items_node(Host); true -> -@@ -3234,13 +2894,13 @@ +@@ -3225,13 +2885,13 @@ case MaxItems of {error, Error} -> {error, Error}; _ -> @@ -822,7 +822,7 @@ {PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups), -@@ -3258,11 +2918,11 @@ +@@ -3249,11 +2909,11 @@ node_call(Type, get_items, [NodeId, From, AccessModel, PresenceSubscription, RosterGroup, @@ -836,7 +836,7 @@ SendItems = case ItemIDs of [] -> Items; _ -> -@@ -3280,8 +2940,8 @@ +@@ -3271,8 +2931,8 @@ children = [#xmlel{name = <<"items">>, attrs = nodeAttr(Node), children = @@ -847,7 +847,7 @@ Error -> Error end end. -@@ -3305,13 +2965,18 @@ +@@ -3296,13 +2956,18 @@ end. get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) -> @@ -867,7 +867,7 @@ %% @spec (Host, Node, NodeId, Type, LJID, Number) -> any() %% Host = pubsubHost() -@@ -3322,35 +2987,32 @@ +@@ -3313,35 +2978,32 @@ %% Number = last | integer() %% @doc <p>Resend the items of a node to the user.</p> %% @todo use cache-last-item feature @@ -922,20 +922,11 @@ send_items(Host, Node, NodeId, Type, {U, S, R} = LJID, Number) -> ToSend = case node_action(Host, Type, get_items, -@@ -3378,7 +3040,8 @@ +@@ -3369,20 +3031,7 @@ attrs = nodeAttr(Node), children = itemsEls(ToSend)}]) end, - case is_tuple(Host) of -+ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza). -+ - %% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response} - %% Host = host() - %% JID = jid() -@@ -3386,20 +3049,6 @@ - %% Reason = stanzaError() - %% Response = [pubsubIQResponse()] - %% @doc <p>Return the list of affiliations as an XMPP response.</p> - false -> - ejabberd_router:route(service_jid(Host), - jlib:make_jid(LJID), Stanza); @@ -949,11 +940,11 @@ - _ -> ok - end - end. -- - -spec(get_affiliations/4 :: - ( - Host :: mod_pubsub:host(), -@@ -3586,9 +3235,10 @@ ++ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza). + + %% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response} + %% Host = host() +@@ -3577,9 +3226,10 @@ case Entities of error -> {error, ?ERR_BAD_REQUEST}; _ -> @@ -965,7 +956,7 @@ case lists:member(Owner, Owners) of true -> OwnerJID = jlib:make_jid(Owner), -@@ -3601,42 +3251,7 @@ +@@ -3592,42 +3242,7 @@ _ -> Entities end, lists:foreach(fun ({JID, Affiliation}) -> @@ -1009,7 +1000,7 @@ end, FilteredEntities), {result, []}; -@@ -3695,11 +3310,11 @@ +@@ -3686,11 +3301,11 @@ end. read_sub(Subscriber, Node, NodeID, SubID, Lang) -> @@ -1023,7 +1014,7 @@ OptionsEl = #xmlel{name = <<"options">>, attrs = [{<<"jid">>, jlib:jid_to_string(Subscriber)}, -@@ -3733,7 +3348,7 @@ +@@ -3724,7 +3339,7 @@ end. set_options_helper(Configuration, JID, NodeID, SubID, Type) -> @@ -1032,7 +1023,7 @@ {result, GoodSubOpts} -> GoodSubOpts; _ -> invalid end, -@@ -3765,7 +3380,7 @@ +@@ -3756,7 +3371,7 @@ write_sub(_Subscriber, _NodeID, _SubID, invalid) -> {error, extended_error(?ERR_BAD_REQUEST, <<"invalid-options">>)}; write_sub(Subscriber, NodeID, SubID, Options) -> @@ -1041,7 +1032,7 @@ {error, notfound} -> {error, extended_error(?ERR_NOT_ACCEPTABLE, <<"invalid-subid">>)}; {result, _} -> -@@ -3986,9 +3601,9 @@ +@@ -3977,9 +3592,9 @@ ejabberd_router:route(service_jid(Host), jlib:make_jid(JID), Stanza) end, @@ -1053,7 +1044,7 @@ true -> Result = lists:foldl(fun ({JID, Subscription, SubId}, -@@ -4405,7 +4020,7 @@ +@@ -4373,7 +3988,7 @@ {Depth, [{N, get_node_subs(N)} || N <- Nodes]} end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))} end, @@ -1062,7 +1053,7 @@ {result, CollSubs} -> CollSubs; _ -> [] end. -@@ -4419,9 +4034,9 @@ +@@ -4387,9 +4002,9 @@ get_options_for_subs(NodeID, Subs) -> lists:foldl(fun({JID, subscribed, SubID}, Acc) -> @@ -1074,7 +1065,7 @@ _ -> Acc end; (_, Acc) -> -@@ -5121,6 +4736,30 @@ +@@ -5089,6 +4704,30 @@ _ -> features() end. @@ -1105,7 +1096,7 @@ %% @doc <p>node tree plugin call.</p> tree_call({_User, Server, _Resource}, Function, Args) -> tree_call(Server, Function, Args); -@@ -5140,7 +4779,13 @@ +@@ -5108,7 +4747,13 @@ tree_action(Host, Function, Args) -> ?DEBUG("tree_action ~p ~p ~p", [Host, Function, Args]), Fun = fun () -> tree_call(Host, Function, Args) end, @@ -1120,7 +1111,7 @@ %% @doc <p>node plugin call.</p> node_call(Type, Function, Args) -> -@@ -5165,13 +4810,12 @@ +@@ -5133,13 +4778,12 @@ node_action(Host, Type, Function, Args) -> ?DEBUG("node_action ~p ~p ~p ~p", [Host, Type, Function, Args]), @@ -1136,7 +1127,7 @@ case tree_call(Host, get_node, [Host, Node]) of N when is_record(N, pubsub_node) -> case Action(N) of -@@ -5185,16 +4829,22 @@ +@@ -5153,16 +4797,22 @@ end, Trans). @@ -1163,7 +1154,7 @@ {result, Result} -> {result, Result}; {error, Error} -> {error, Error}; {atomic, {result, Result}} -> {result, Result}; -@@ -5203,6 +4853,15 @@ +@@ -5171,6 +4821,15 @@ ?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]), {error, ?ERR_INTERNAL_SERVER_ERROR}; @@ -1179,7 +1170,7 @@ {'EXIT', Reason} -> ?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]), -@@ -5213,6 +4872,16 @@ +@@ -5181,6 +4840,16 @@ {error, ?ERR_INTERNAL_SERVER_ERROR} end. |