25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Remove unused functions from old get_items api

This commit is contained in:
Christophe Romain 2015-09-04 12:36:33 +02:00
parent a1a7beb24d
commit ec1969ddca
2 changed files with 16 additions and 29 deletions

View File

@ -46,8 +46,7 @@
get_entity_subscriptions/2, get_node_subscriptions/1, get_entity_subscriptions/2, get_node_subscriptions/1,
get_subscriptions/2, set_subscriptions/4, get_subscriptions/2, set_subscriptions/4,
get_pending_nodes/2, get_states/1, get_state/2, get_pending_nodes/2, get_states/1, get_state/2,
set_state/1, get_items/6, get_items/2, set_state/1, get_items/7, get_items/3, get_item/7,
get_items/7, get_items/3, get_item/7,
get_item/2, set_item/1, get_item_name/3, node_to_path/1, get_item/2, set_item/1, get_item_name/3, node_to_path/1,
path_to_node/1, can_fetch_item/2, is_subscribed/1]). path_to_node/1, can_fetch_item/2, is_subscribed/1]).
@ -698,19 +697,11 @@ del_state(Nidx, Key) ->
%% mod_pubsub module.</p> %% mod_pubsub module.</p>
%% <p>PubSub plugins can store the items where they wants (for example in a %% <p>PubSub plugins can store the items where they wants (for example in a
%% relational database), or they can even decide not to persist any items.</p> %% relational database), or they can even decide not to persist any items.</p>
%% <p>If a PubSub plugin wants to delegate the item storage to the default node,
%% they can implement this function like this:
%% ```get_items(Nidx, From) ->
%% node_default:get_items(Nidx, From).'''</p>
get_items(Nidx, From) ->
get_items(Nidx, From, none).
get_items(Nidx, _From, _RSM) -> get_items(Nidx, _From, _RSM) ->
Items = mnesia:match_object(#pubsub_item{itemid = {'_', Nidx}, _ = '_'}), Items = mnesia:match_object(#pubsub_item{itemid = {'_', Nidx}, _ = '_'}),
{result, {lists:reverse(lists:keysort(#pubsub_item.modification, Items)), none}}. {result, {lists:reverse(lists:keysort(#pubsub_item.modification, Items)), none}}.
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) -> get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, RSM) ->
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, SubId, none).
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, _RSM) ->
SubKey = jlib:jid_tolower(JID), SubKey = jlib:jid_tolower(JID),
GenKey = jlib:jid_remove_resource(SubKey), GenKey = jlib:jid_remove_resource(SubKey),
GenState = get_state(Nidx, GenKey), GenState = get_state(Nidx, GenKey),
@ -743,7 +734,7 @@ get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, _RS
%% % Payment is required for a subscription %% % Payment is required for a subscription
%% {error, ?ERR_PAYMENT_REQUIRED}; %% {error, ?ERR_PAYMENT_REQUIRED};
true -> true ->
get_items(Nidx, JID) get_items(Nidx, JID, RSM)
end. end.
%% @doc <p>Returns an item (one item list), given its reference.</p> %% @doc <p>Returns an item (one item list), given its reference.</p>

View File

@ -46,8 +46,7 @@
get_entity_subscriptions/2, get_node_subscriptions/1, get_entity_subscriptions/2, get_node_subscriptions/1,
get_subscriptions/2, set_subscriptions/4, get_subscriptions/2, set_subscriptions/4,
get_pending_nodes/2, get_states/1, get_state/2, get_pending_nodes/2, get_states/1, get_state/2,
set_state/1, get_items/6, get_items/2, set_state/1, get_items/7, get_items/3, get_item/7,
get_items/7, get_items/3, get_item/7,
get_item/2, set_item/1, get_item_name/3, node_to_path/1, get_item/2, set_item/1, get_item_name/3, node_to_path/1,
path_to_node/1, path_to_node/1,
get_entity_subscriptions_for_send_last/2, get_last_items/3]). get_entity_subscriptions_for_send_last/2, get_last_items/3]).
@ -623,18 +622,18 @@ del_state(Nidx, JID) ->
J, <<"' and nodeid='">>, Nidx, <<"';">>]), J, <<"' and nodeid='">>, Nidx, <<"';">>]),
ok. ok.
get_items(Nidx, _From) -> %get_items(Nidx, _From) ->
case catch % case catch
ejabberd_odbc:sql_query_t([<<"select itemid, publisher, creation, modification, payload " % ejabberd_odbc:sql_query_t([<<"select itemid, publisher, creation, modification, payload "
"from pubsub_item where nodeid='">>, Nidx, % "from pubsub_item where nodeid='">>, Nidx,
<<"' order by modification desc;">>]) % <<"' order by modification desc;">>])
of % of
{selected, % {selected,
[<<"itemid">>, <<"publisher">>, <<"creation">>, <<"modification">>, <<"payload">>], RItems} -> % [<<"itemid">>, <<"publisher">>, <<"creation">>, <<"modification">>, <<"payload">>], RItems} ->
{result, [raw_to_item(Nidx, RItem) || RItem <- RItems]}; % {result, [raw_to_item(Nidx, RItem) || RItem <- RItems]};
_ -> % _ ->
{result, []} % {result, []}
end. % end.
get_items(Nidx, From, none) -> get_items(Nidx, From, none) ->
MaxItems = case catch MaxItems = case catch
@ -719,9 +718,6 @@ get_items(Nidx, _From,
{result, {[], none}} {result, {[], none}}
end. end.
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, SubId, none).
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, RSM) -> get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, RSM) ->
SubKey = jlib:jid_tolower(JID), SubKey = jlib:jid_tolower(JID),
GenKey = jlib:jid_remove_resource(SubKey), GenKey = jlib:jid_remove_resource(SubKey),