|
1 |
| ---- mod_pubsub.erl 2011-08-31 16:08:42.000000000 +0200 |
2 |
| -+++ mod_pubsub_odbc.erl 2011-08-31 16:08:42.000000000 +0200 |
| 1 | +--- mod_pubsub.erl 2011-09-21 14:37:16.000000000 +0200 |
| 2 | ++++ mod_pubsub_odbc.erl 2011-09-21 14:37:36.000000000 +0200 |
3 | 3 | @@ -42,7 +42,7 @@
|
4 | 4 | %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
5 | 5 | %%% XEP-0060 section 12.18.
|
|
554 | 554 | case Result of
|
555 | 555 | default -> {result, Reply};
|
556 | 556 | _ -> {result, Result}
|
557 |
| -@@ -2241,7 +2054,7 @@ |
| 557 | +@@ -2243,7 +2056,7 @@ |
558 | 558 | %% <p>The permission are not checked in this function.</p>
|
559 | 559 | %% @todo We probably need to check that the user doing the query has the right
|
560 | 560 | %% to read the items.
|
|
563 | 563 | MaxItems =
|
564 | 564 | if
|
565 | 565 | SMaxItems == "" -> get_max_items_node(Host);
|
566 |
| -@@ -2255,12 +2068,13 @@ |
| 566 | +@@ -2257,12 +2070,13 @@ |
567 | 567 | {error, Error} ->
|
568 | 568 | {error, Error};
|
569 | 569 | _ ->
|
|
578 | 578 | {PresenceSubscription, RosterGroup} = get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups),
|
579 | 579 | if
|
580 | 580 | not RetreiveFeature ->
|
581 |
| -@@ -2273,11 +2087,11 @@ |
| 581 | +@@ -2275,11 +2089,11 @@ |
582 | 582 | node_call(Type, get_items,
|
583 | 583 | [NodeId, From,
|
584 | 584 | AccessModel, PresenceSubscription, RosterGroup,
|
|
592 | 592 | SendItems = case ItemIDs of
|
593 | 593 | [] ->
|
594 | 594 | Items;
|
595 |
| -@@ -2290,7 +2104,8 @@ |
| 595 | +@@ -2292,7 +2106,8 @@ |
596 | 596 | %% number of items sent to MaxItems:
|
597 | 597 | {result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
|
598 | 598 | [{xmlelement, "items", nodeAttr(Node),
|
|
602 | 602 | Error ->
|
603 | 603 | Error
|
604 | 604 | end
|
605 |
| -@@ -2312,10 +2127,15 @@ |
| 605 | +@@ -2314,10 +2129,15 @@ |
606 | 606 | Error -> Error
|
607 | 607 | end.
|
608 | 608 | get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) ->
|
|
619 | 619 |
|
620 | 620 |
|
621 | 621 | %% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
|
622 |
| -@@ -2327,31 +2147,29 @@ |
| 622 | +@@ -2329,31 +2149,29 @@ |
623 | 623 | %% Number = last | integer()
|
624 | 624 | %% @doc <p>Resend the items of a node to the user.</p>
|
625 | 625 | %% @todo use cache-last-item feature
|
|
670 | 670 | ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
|
671 | 671 | {result, []} ->
|
672 | 672 | [];
|
673 |
| -@@ -2374,20 +2192,7 @@ |
| 673 | +@@ -2376,20 +2194,7 @@ |
674 | 674 | [{xmlelement, "items", nodeAttr(Node),
|
675 | 675 | itemsEls(ToSend)}])
|
676 | 676 | end,
|
|
692 | 692 |
|
693 | 693 | %% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
694 | 694 | %% Host = host()
|
695 |
| -@@ -2489,7 +2294,8 @@ |
| 695 | +@@ -2491,7 +2296,8 @@ |
696 | 696 | error ->
|
697 | 697 | {error, ?ERR_BAD_REQUEST};
|
698 | 698 | _ ->
|
|
702 | 702 | case lists:member(Owner, Owners) of
|
703 | 703 | true ->
|
704 | 704 | OwnerJID = jlib:make_jid(Owner),
|
705 |
| -@@ -2499,24 +2305,7 @@ |
| 705 | +@@ -2501,24 +2307,7 @@ |
706 | 706 | end,
|
707 | 707 | lists:foreach(
|
708 | 708 | fun({JID, Affiliation}) ->
|
|
728 | 728 | end, FilteredEntities),
|
729 | 729 | {result, []};
|
730 | 730 | _ ->
|
731 |
| -@@ -2569,11 +2358,11 @@ |
| 731 | +@@ -2571,11 +2360,11 @@ |
732 | 732 | end.
|
733 | 733 |
|
734 | 734 | read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
|
742 | 742 | OptionsEl = {xmlelement, "options", [{"jid", jlib:jid_to_string(Subscriber)},
|
743 | 743 | {"subid", SubID}|nodeAttr(Node)],
|
744 | 744 | [XdataEl]},
|
745 |
| -@@ -2599,7 +2388,7 @@ |
| 745 | +@@ -2601,7 +2390,7 @@ |
746 | 746 | end.
|
747 | 747 |
|
748 | 748 | set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
|
751 | 751 | {result, GoodSubOpts} -> GoodSubOpts;
|
752 | 752 | _ -> invalid
|
753 | 753 | end,
|
754 |
| -@@ -2628,7 +2417,7 @@ |
| 754 | +@@ -2630,7 +2419,7 @@ |
755 | 755 | write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
756 | 756 | {error, extended_error(?ERR_BAD_REQUEST, "invalid-options")};
|
757 | 757 | write_sub(Subscriber, NodeID, SubID, Options) ->
|
|
760 | 760 | {error, notfound} ->
|
761 | 761 | {error, extended_error(?ERR_NOT_ACCEPTABLE, "invalid-subid")};
|
762 | 762 | {result, _} ->
|
763 |
| -@@ -2796,8 +2585,8 @@ |
| 763 | +@@ -2798,8 +2587,8 @@ |
764 | 764 | {"subscription", subscription_to_string(Sub)} | nodeAttr(Node)], []}]}]},
|
765 | 765 | ejabberd_router:route(service_jid(Host), jlib:make_jid(JID), Stanza)
|
766 | 766 | end,
|
|
771 | 771 | true ->
|
772 | 772 | Result = lists:foldl(fun({JID, Subscription, SubId}, Acc) ->
|
773 | 773 |
|
774 |
| -@@ -3152,7 +2941,7 @@ |
| 774 | +@@ -3154,7 +2943,7 @@ |
775 | 775 | {Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
776 | 776 | end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
777 | 777 | end,
|
|
780 | 780 | {result, CollSubs} -> CollSubs;
|
781 | 781 | _ -> []
|
782 | 782 | end.
|
783 |
| -@@ -3166,9 +2955,9 @@ |
| 783 | +@@ -3168,9 +2957,9 @@ |
784 | 784 |
|
785 | 785 | get_options_for_subs(NodeID, Subs) ->
|
786 | 786 | lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
|
792 | 792 | _ -> Acc
|
793 | 793 | end;
|
794 | 794 | (_, Acc) ->
|
795 |
| -@@ -3357,6 +3146,30 @@ |
| 795 | +@@ -3359,6 +3148,30 @@ |
796 | 796 | Result
|
797 | 797 | end.
|
798 | 798 |
|
|
823 | 823 | %% @spec (Host, Options) -> MaxItems
|
824 | 824 | %% Host = host()
|
825 | 825 | %% Options = [Option]
|
826 |
| -@@ -3753,7 +3566,13 @@ |
| 826 | +@@ -3755,7 +3568,13 @@ |
827 | 827 | tree_action(Host, Function, Args) ->
|
828 | 828 | ?DEBUG("tree_action ~p ~p ~p",[Host,Function,Args]),
|
829 | 829 | Fun = fun() -> tree_call(Host, Function, Args) end,
|
|
838 | 838 |
|
839 | 839 | %% @doc <p>node plugin call.</p>
|
840 | 840 | node_call(Type, Function, Args) ->
|
841 |
| -@@ -3773,13 +3592,13 @@ |
| 841 | +@@ -3775,13 +3594,13 @@ |
842 | 842 |
|
843 | 843 | node_action(Host, Type, Function, Args) ->
|
844 | 844 | ?DEBUG("node_action ~p ~p ~p ~p",[Host,Type,Function,Args]),
|
|
854 | 854 | case tree_call(Host, get_node, [Host, Node]) of
|
855 | 855 | N when is_record(N, pubsub_node) ->
|
856 | 856 | case Action(N) of
|
857 |
| -@@ -3791,13 +3610,19 @@ |
| 857 | +@@ -3793,13 +3612,19 @@ |
858 | 858 | Error
|
859 | 859 | end
|
860 | 860 | end, Trans).
|
|
878 | 878 | {result, Result} -> {result, Result};
|
879 | 879 | {error, Error} -> {error, Error};
|
880 | 880 | {atomic, {result, Result}} -> {result, Result};
|
881 |
| -@@ -3805,6 +3630,15 @@ |
| 881 | +@@ -3807,6 +3632,15 @@ |
882 | 882 | {aborted, Reason} ->
|
883 | 883 | ?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]),
|
884 | 884 | {error, ?ERR_INTERNAL_SERVER_ERROR};
|
|
894 | 894 | {'EXIT', Reason} ->
|
895 | 895 | ?ERROR_MSG("transaction return internal error: ~p~n", [{'EXIT', Reason}]),
|
896 | 896 | {error, ?ERR_INTERNAL_SERVER_ERROR};
|
897 |
| -@@ -3813,6 +3647,17 @@ |
| 897 | +@@ -3815,6 +3649,17 @@ |
898 | 898 | {error, ?ERR_INTERNAL_SERVER_ERROR}
|
899 | 899 | end.
|
900 | 900 |
|
|
0 commit comments