diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index af411e782..b5ea5412e 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -1228,7 +1228,7 @@ iq_sm(From, To, #iq{type = Type, payload = SubEl, ns = XMLNS, lang = Lang} = IQ_ end, case Res of {result, []} -> exmpp_iq:result(IQ_Rec); - {result, [IQRes]} -> exmpp_iq:result(IQ_Rec, IQRes); + {result, IQRes} -> exmpp_iq:result(IQ_Rec, IQRes); {error, Error} -> exmpp_iq:error(IQ_Rec, Error) end. @@ -2848,12 +2848,11 @@ set_subscriptions(Host, Node, From, EntitiesEls) -> %% @spec (OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, SubscriberResource}, AllowedGroups) %% -> {PresenceSubscription, RosterGroup} get_roster_info(OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, _}, AllowedGroups) -> - OwnerServerB = list_to_binary(OwnerServer), {Subscription, Groups} = ejabberd_hooks:run_fold( - roster_get_jid_info, OwnerServerB, + roster_get_jid_info, OwnerServer, {none, []}, - [OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, undefined}]), + [OwnerUser, OwnerServer, exmpp_jid:make({SubscriberUser, SubscriberServer, undefined})]), PresenceSubscription = (Subscription == both) orelse (Subscription == from) orelse ({OwnerUser, OwnerServer} == {SubscriberUser, SubscriberServer}), RosterGroup = lists:any(fun(Group) -> diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl index 97ab54ad9..b1f96c33b 100644 --- a/src/mod_pubsub/mod_pubsub_odbc.erl +++ b/src/mod_pubsub/mod_pubsub_odbc.erl @@ -1036,7 +1036,7 @@ iq_sm(From, To, #iq{type = Type, payload = SubEl, ns = XMLNS, lang = Lang} = IQ_ end, case Res of {result, []} -> exmpp_iq:result(IQ_Rec); - {result, [IQRes]} -> exmpp_iq:result(IQ_Rec, IQRes); + {result, IQRes} -> exmpp_iq:result(IQ_Rec, IQRes); {error, Error} -> exmpp_iq:error(IQ_Rec, Error) end. @@ -2658,12 +2658,11 @@ set_subscriptions(Host, Node, From, EntitiesEls) -> %% @spec (OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, SubscriberResource}, AllowedGroups) %% -> {PresenceSubscription, RosterGroup} get_roster_info(OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, _}, AllowedGroups) -> - OwnerServerB = list_to_binary(OwnerServer), {Subscription, Groups} = ejabberd_hooks:run_fold( - roster_get_jid_info, OwnerServerB, + roster_get_jid_info, OwnerServer, {none, []}, - [OwnerUser, OwnerServer, {SubscriberUser, SubscriberServer, undefined}]), + [OwnerUser, OwnerServer, exmpp_jid:make({SubscriberUser, SubscriberServer, undefined})]), PresenceSubscription = (Subscription == both) orelse (Subscription == from) orelse ({OwnerUser, OwnerServer} == {SubscriberUser, SubscriberServer}), RosterGroup = lists:any(fun(Group) -> diff --git a/src/mod_pubsub/pubsub_odbc.patch b/src/mod_pubsub/pubsub_odbc.patch index c70d0e942..df5bf22d3 100644 --- a/src/mod_pubsub/pubsub_odbc.patch +++ b/src/mod_pubsub/pubsub_odbc.patch @@ -1,5 +1,5 @@ ---- mod_pubsub.erl 2009-11-05 18:37:16.000000000 +0100 -+++ mod_pubsub_odbc.erl 2009-11-05 18:37:21.000000000 +0100 +--- mod_pubsub.erl 2009-11-06 15:30:53.000000000 +0100 ++++ mod_pubsub_odbc.erl 2009-11-06 15:31:06.000000000 +0100 @@ -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. @@ -679,7 +679,7 @@ true -> Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) -> -@@ -3111,7 +2921,7 @@ +@@ -3110,7 +2920,7 @@ {Depth, [{N, get_node_subs(N)} || N <- Nodes]} end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))} end, @@ -688,7 +688,7 @@ {result, CollSubs} -> CollSubs; _ -> [] end. -@@ -3125,9 +2935,9 @@ +@@ -3124,9 +2934,9 @@ get_options_for_subs(NodeID, Subs) -> lists:foldl(fun({JID, subscribed, SubID}, Acc) -> @@ -700,7 +700,7 @@ _ -> Acc end; (_, Acc) -> -@@ -3135,7 +2945,7 @@ +@@ -3134,7 +2944,7 @@ end, [], Subs). % TODO: merge broadcast code that way @@ -709,7 +709,7 @@ %broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) -> % case (get_option(NodeOptions, Feature) or Force) of % true -> -@@ -3327,6 +3137,30 @@ +@@ -3326,6 +3136,30 @@ Result end. @@ -740,7 +740,7 @@ %% @spec (Host, Options) -> MaxItems %% Host = host() %% Options = [Option] -@@ -3716,7 +3550,13 @@ +@@ -3715,7 +3549,13 @@ tree_action(Host, Function, Args) -> ?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]), Fun = fun() -> tree_call(Host, Function, Args) end, @@ -755,7 +755,7 @@ %% @doc
node plugin call.
node_call(Type, Function, Args) -> -@@ -3736,13 +3576,13 @@ +@@ -3735,13 +3575,13 @@ node_action(Host, Type, Function, Args) -> ?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]), @@ -771,7 +771,7 @@ case tree_call(Host, get_node, [Host, Node]) of N when is_record(N, pubsub_node) -> case Action(N) of -@@ -3755,8 +3595,15 @@ +@@ -3754,8 +3594,15 @@ end end, Trans). @@ -789,7 +789,7 @@ {result, Result} -> {result, Result}; {error, Error} -> {error, Error}; {atomic, {result, Result}} -> {result, Result}; -@@ -3764,6 +3611,15 @@ +@@ -3763,6 +3610,15 @@ {aborted, Reason} -> ?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]), {error, 'internal-server-error'}; @@ -805,7 +805,7 @@ {'EXIT', Reason} -> ?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]), {error, 'internal-server-error'}; -@@ -3772,6 +3628,16 @@ +@@ -3771,6 +3627,16 @@ {error, 'internal-server-error'} end. diff --git a/src/mod_pubsub/pubsub_subscription.erl b/src/mod_pubsub/pubsub_subscription.erl index eacc63d16..6f881d423 100644 --- a/src/mod_pubsub/pubsub_subscription.erl +++ b/src/mod_pubsub/pubsub_subscription.erl @@ -138,20 +138,23 @@ get_options_xform(Lang, Options) -> children = [?XMLCDATA(?NS_PUBSUB_SUBSCRIBE_OPTIONS_s)]}]}] ++ XFields}}. parse_options_xform(XFields) -> - case exmpp_xml:get_child_elements(XFields) of - [] -> {result, []}; - [#xmlel{name = 'x'} = XEl] -> - case jlib:parse_xdata_submit(XEl) of - XData when is_list(XData) -> - case set_xoption(XData, []) of - Opts when is_list(Opts) -> {result, Opts}; - Other -> Other - end; - Other -> - Other - end; - Other -> - Other + case XFields of + [] -> {result, []}; + _ -> case exmpp_xml:get_child_elements(XFields) of + [] -> {result, []}; + [#xmlel{name = 'x'} = XEl] -> + case jlib:parse_xdata_submit(XEl) of + XData when is_list(XData) -> + case set_xoption(XData, []) of + Opts when is_list(Opts) -> {result, Opts}; + Other -> Other + end; + Other -> + Other + end; + Other -> + Other + end end. %%====================================================================