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

pubsub: added configuration option in guide.tex, added last item cache, use default node type if given type is not configured, make node_flat the default node plugin. caps: improve cache handling

SVN Revision: 2112
This commit is contained in:
Christophe Romain 2009-05-28 22:30:43 +00:00
parent af32a18b4b
commit 039d5b8367
15 changed files with 378 additions and 257 deletions

View File

@ -3268,11 +3268,28 @@ Options:
\titem{access\_createnode} \ind{options!access\_createnode}
This option restricts which users are allowed to create pubsub nodes using
ACL and ACCESS. The default value is \term{pubsub\_createnode}. % Not clear enough + do not use abbreviations.
\titem{plugins} To specify which pubsub node plugins to use. If not defined, the default
\titem{plugins} \ind{options!plugins}
To specify which pubsub node plugins to use. If not defined, the default
pubsub plugin is always used.
\titem{nodetree} To specify which nodetree to use. If not defined, the default pubsub
nodetree is used. Nodetrees are default and virtual. Only one nodetree can be used
\titem{nodetree} \ind{options!nodetree}
To specify which nodetree to use. If not defined, the default pubsub
nodetree is used. Only one nodetree can be used per host,
and is shared by all node plugins.
\titem{pep\_sendlast\_offline} \ind{options!pep\_sendlast\_offline}
To specify whether or not we should get last published PEP items
from users in our roster which are offline when we connect. Value is true or false.
If not defined, pubsub assumes false so we only get last items of online contacts.
\titem{last\_item\_cache} \ind{options!last\_item\_cache}
To specify whether or not pubsub should cache last items. Value is true
or false. If not defined, pubsub do not cache last items. On systems with not so many nodes,
caching last items speeds up pubsub and allows to raise user connection rate. The cost is memory
usage, as every item is stored in memory.
\titem{pep\_mapping} \ind{pep\_mapping}
This allow to define a Key-Value list to choose defined node plugins on given PEP namespace.
The following example will use node\_tune instead of node\_pep for every PEP node with tune namespace:
\begin{verbatim}
{mod_pubsub, [{pep_mapping, [{"http://jabber.org/protocol/tune", "tune"}]}]}
\end{verbatim}
%\titem{served\_hosts} \ind{options!served\_hosts}
% This option allows to create additional pubsub virtual hosts in a single module instance.
\end{description}

View File

@ -485,9 +485,11 @@
{mod_privacy, []},
{mod_private, []},
%%{mod_proxy65,[]},
{mod_pubsub, [ % requires mod_caps
{mod_pubsub, [
{access_createnode, pubsub_createnode},
{plugins, ["default", "pep"]}
{pep_sendlast_offline, false},
{last_item_cache, false},
{plugins, ["flat", "pep"]} % pep requires mod_caps
]},
{mod_register, [
%%

View File

@ -57,7 +57,8 @@
%% hook handlers
-export([receive_packet/3,
receive_packet/4,
presence_probe/3]).
presence_probe/3,
remove_connection/3]).
-include("ejabberd.hrl").
-include("jlib.hrl").
@ -209,7 +210,20 @@ receive_packet(From, To, {xmlelement, "presence", Attrs, Els}) ->
"unsubscribed" ->
ok;
"unavailable" ->
clear_caps(From);
{_, S1, _} = jlib:jid_tolower(From),
case jlib:jid_tolower(To) of
{_, S1, _} -> ok;
_ -> clear_caps(From)
end;
%% TODO: probe client, and clean only if no answers
%% as far as protocol does not allow inter-server communication to
%% let remote server handle it's own caps to decide which user is to be
%% notified, we must keep a cache of online status of external contacts
%% this is absolutely not scallable, but we have no choice for now
%% we can only use unavailable presence, but if remote user just remove a local user
%% from its roster, then it's considered as offline, so he does not receive local PEP
%% anymore until he login again.
%% This is tracked in EJAB-943
_ ->
note_caps(To#jid.lserver, From, read_caps(Els))
end;
@ -222,6 +236,10 @@ receive_packet(_JID, From, To, Packet) ->
presence_probe(From, To, _) ->
wait_caps(To#jid.lserver, From).
remove_connection(_SID, JID, _Info) ->
?INFO_MSG("clear ~p",[JID]),
clear_caps(JID).
jid_to_binary(JID) ->
list_to_binary(jlib:jid_to_string(JID)).
@ -256,6 +274,7 @@ init([Host, _Opts]) ->
ejabberd_hooks:add(user_receive_packet, Host, ?MODULE, receive_packet, 30),
ejabberd_hooks:add(s2s_receive_packet, Host, ?MODULE, receive_packet, 30),
ejabberd_hooks:add(presence_probe_hook, Host, ?MODULE, presence_probe, 20),
ejabberd_hooks:add(sm_remove_connection_hook, Host, ?MODULE, remove_connection, 20),
{ok, #state{host = Host}}.
maybe_get_features(#caps{node = Node, version = Version, exts = Exts}) ->
@ -427,6 +446,7 @@ terminate(_Reason, State) ->
ejabberd_hooks:delete(user_receive_packet, Host, ?MODULE, receive_packet, 30),
ejabberd_hooks:delete(s2s_receive_packet, Host, ?MODULE, receive_packet, 30),
ejabberd_hooks:delete(presence_probe_hook, Host, ?MODULE, presence_probe, 20),
ejabberd_hooks:delete(sm_remove_connection_hook, Host, ?MODULE, remove_connection, 20),
ok.
code_change(_OldVsn, State, _Extra) ->

View File

@ -39,7 +39,7 @@
-module(mod_pubsub).
-author('christophe.romain@process-one.net').
-version('1.12-05').
-version('1.12-06').
-behaviour(gen_server).
-behaviour(gen_mod).
@ -48,8 +48,8 @@
-include("jlib.hrl").
-include("pubsub.hrl").
-define(STDTREE, "default").
-define(STDNODE, "default").
-define(STDTREE, "tree").
-define(STDNODE, "flat").
-define(PEPNODE, "pep").
%% exports for hooks
@ -77,6 +77,9 @@
publish_item/6,
delete_item/4,
send_items/6,
get_items/2,
get_item/3,
get_cached_item/2,
broadcast_stanza/7,
get_configure/5,
set_configure/5,
@ -119,7 +122,8 @@
host,
access,
pep_mapping = [],
pep_sendlast_offline,
pep_sendlast_offline = false,
last_item_cache = false,
nodetree = ?STDTREE,
plugins = [?STDNODE],
send_loop}).
@ -164,16 +168,20 @@ init([ServerHost, Opts]) ->
Access = gen_mod:get_opt(access_createnode, Opts, all),
PepOffline = gen_mod:get_opt(pep_sendlast_offline, Opts, false),
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
LastItemCache = gen_mod:get_opt(last_item_cache, Opts, false),
pubsub_index:init(Host, ServerHost, Opts),
ets:new(gen_mod:get_module_proc(Host, pubsub_state), [set, named_table]),
ets:new(gen_mod:get_module_proc(ServerHost, pubsub_state), [set, named_table]),
ets:new(gen_mod:get_module_proc(Host, config), [set, named_table]),
ets:new(gen_mod:get_module_proc(ServerHost, config), [set, named_table]),
ets:new(gen_mod:get_module_proc(Host, last_items), [set, named_table]),
ets:new(gen_mod:get_module_proc(ServerHost, last_items), [set, named_table]),
{Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
mod_disco:register_feature(ServerHost, ?NS_PUBSUB),
ets:insert(gen_mod:get_module_proc(Host, pubsub_state), {nodetree, NodeTree}),
ets:insert(gen_mod:get_module_proc(Host, pubsub_state), {plugins, Plugins}),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {nodetree, NodeTree}),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {plugins, Plugins}),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {pep_mapping, PepMapping}),
ets:insert(gen_mod:get_module_proc(Host, config), {nodetree, NodeTree}),
ets:insert(gen_mod:get_module_proc(Host, config), {plugins, Plugins}),
ets:insert(gen_mod:get_module_proc(Host, config), {last_item_cache, LastItemCache}),
ets:insert(gen_mod:get_module_proc(ServerHost, config), {nodetree, NodeTree}),
ets:insert(gen_mod:get_module_proc(ServerHost, config), {plugins, Plugins}),
ets:insert(gen_mod:get_module_proc(ServerHost, config), {pep_mapping, PepMapping}),
ejabberd_hooks:add(disco_sm_identity, ServerHost, ?MODULE, disco_sm_identity, 75),
ejabberd_hooks:add(disco_sm_features, ServerHost, ?MODULE, disco_sm_features, 75),
ejabberd_hooks:add(disco_sm_items, ServerHost, ?MODULE, disco_sm_items, 75),
@ -202,6 +210,7 @@ init([ServerHost, Opts]) ->
access = Access,
pep_mapping = PepMapping,
pep_sendlast_offline = PepOffline,
last_item_cache = LastItemCache,
nodetree = NodeTree,
plugins = Plugins},
SendLoop = spawn(?MODULE, send_loop, [State]),
@ -633,8 +642,8 @@ out_subscription(User, Server, JID, subscribed) ->
gen_server:cast(Proc, {presence, PUser, PServer, PResources, Owner});
out_subscription(_,_,_,_) ->
ok.
in_subscription(_, User, Server, Subscriber, unsubscribed, _) ->
Owner = jlib:make_jid(User, Server, ""),
in_subscription(_, User, Server, Owner, unsubscribed, _) ->
Subscriber = jlib:make_jid(User, Server, ""),
Proc = gen_mod:get_module_proc(Server, ?PROCNAME),
gen_server:cast(Proc, {unsubscribe, Subscriber, Owner});
in_subscription(_, _, _, _, _, _) ->
@ -1527,7 +1536,8 @@ delete_node(Host, Node, Owner) ->
NodeId = RNode#pubsub_node.id,
Type = RNode#pubsub_node.type,
Options = RNode#pubsub_node.options,
broadcast_removed_node(RH, RN, NodeId, Type, Options, RSubscriptions)
broadcast_removed_node(RH, RN, NodeId, Type, Options, RSubscriptions),
unset_cached_item(RH, NodeId)
end, Removed),
case Result of
default -> {result, Reply};
@ -1745,6 +1755,7 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
Type = TNode#pubsub_node.type,
Options = TNode#pubsub_node.options,
broadcast_publish_item(Host, Node, NodeId, Type, Options, Removed, ItemId, jlib:jid_tolower(Publisher), Payload),
set_cached_item(Host, NodeId, ItemId, Payload),
case Result of
default -> {result, Reply};
_ -> {result, Result}
@ -1754,12 +1765,14 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
Type = TNode#pubsub_node.type,
Options = TNode#pubsub_node.options,
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
set_cached_item(Host, NodeId, ItemId, Payload),
{result, Reply};
{result, {TNode, {Result, Removed}}} ->
NodeId = TNode#pubsub_node.id,
Type = TNode#pubsub_node.type,
Options = TNode#pubsub_node.options,
broadcast_retract_items(Host, Node, NodeId, Type, Options, Removed),
set_cached_item(Host, NodeId, ItemId, Payload),
{result, Result};
{result, {_, default}} ->
{result, Reply};
@ -1831,6 +1844,10 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) ->
Type = TNode#pubsub_node.type,
Options = TNode#pubsub_node.options,
broadcast_retract_items(Host, Node, NodeId, Type, Options, [ItemId], ForceNotify),
case get_cached_item(Host, NodeId) of
#pubsub_item{itemid = {ItemId, NodeId}, _ = '_'} -> unset_cached_item(Host, NodeId);
_ -> ok
end,
case Result of
default -> {result, Reply};
_ -> {result, Result}
@ -1884,6 +1901,7 @@ purge_node(Host, Node, Owner) ->
Type = TNode#pubsub_node.type,
Options = TNode#pubsub_node.options,
broadcast_purge_node(Host, Node, NodeId, Type, Options),
unset_cached_item(Host, NodeId),
case Result of
default -> {result, Reply};
_ -> {result, Result}
@ -1962,6 +1980,22 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIDs) ->
Error
end
end.
get_items(Host, Node) ->
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
node_call(Type, get_items, [NodeId, service_jid(Host)])
end,
case transaction(Host, Node, Action, sync_dirty) of
{result, {_, Items}} -> Items;
Error -> Error
end.
get_item(Host, Node, ItemId) ->
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
node_call(Type, get_item, [NodeId, ItemId])
end,
case transaction(Host, Node, Action, sync_dirty) of
{result, {_, Items}} -> Items;
Error -> Error
end.
%% @spec (Host, Node, NodeId, Type LJID, Number) -> any()
%% Host = pubsubHost()
@ -1973,7 +2007,15 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIDs) ->
%% @doc <p>Resend the items of a node to the user.</p>
%% @todo use cache-last-item feature
send_items(Host, Node, NodeId, Type, LJID, last) ->
case get_cached_item(Host, NodeId) of
undefined ->
send_items(Host, Node, NodeId, Type, LJID, 1);
LastItem ->
Stanza = event_stanza(
[{xmlelement, "items", nodeAttr(Node),
itemsEls([LastItem])}]),
ejabberd_router ! {route, service_jid(Host), jlib:make_jid(LJID), Stanza}
end;
send_items(Host, Node, NodeId, Type, LJID, Number) ->
ToSend = case node_action(Host, Type, get_items, [NodeId, LJID]) of
{result, []} ->
@ -2894,23 +2936,63 @@ set_xoption([_ | Opts], NewOpts) ->
% skip unknown field
set_xoption(Opts, NewOpts).
%%%% last item cache handling
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Payload) ->
set_cached_item(ServerHost, NodeId, ItemId, Payload);
set_cached_item(Host, NodeId, ItemId, Payload) ->
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] ->
ets:insert(gen_mod:get_module_proc(Host, last_items), {NodeId, {ItemId, Payload}});
_ ->
ok
end.
unset_cached_item({_, ServerHost, _}, NodeId) ->
unset_cached_item(ServerHost, NodeId);
unset_cached_item(Host, NodeId) ->
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] ->
ets:delete(gen_mod:get_module_proc(Host, last_items), NodeId);
_ ->
ok
end.
get_cached_item({_, ServerHost, _}, NodeId) ->
get_cached_item(ServerHost, NodeId);
get_cached_item(Host, NodeId) ->
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] ->
case ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
[{NodeId, {ItemId, Payload}}] ->
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
_ ->
undefined
end;
_ ->
undefined
end.
%%%% plugin handling
plugins(Host) ->
case ets:lookup(gen_mod:get_module_proc(Host, pubsub_state), plugins) of
case ets:lookup(gen_mod:get_module_proc(Host, config), plugins) of
[{plugins, []}] -> [?STDNODE];
[{plugins, PL}] -> PL;
_ -> [?STDNODE]
end.
select_type(ServerHost, Host, Node, Type)->
?DEBUG("SELECT_TYPE : ~p~n", [[ServerHost, Host, Node, Type]]),
case Host of
SelectedType = case Host of
{_User, _Server, _Resource} ->
case ets:lookup(gen_mod:get_module_proc(ServerHost, pubsub_state), pep_mapping) of
[{pep_mapping, PM}] -> ?DEBUG("SELECT_TYPE : ~p~n", [PM]), proplists:get_value(Node, PM, ?PEPNODE);
R -> ?DEBUG("SELECT_TYPE why ?: ~p~n", [R]), ?PEPNODE
case ets:lookup(gen_mod:get_module_proc(ServerHost, config), pep_mapping) of
[{pep_mapping, PM}] -> proplists:get_value(Node, PM, ?PEPNODE);
_ -> ?PEPNODE
end;
_ ->
Type
end,
ConfiguredTypes = plugins(ServerHost),
case lists:member(SelectedType, ConfiguredTypes) of
true -> SelectedType;
false -> hd(ConfiguredTypes)
end.
select_type(ServerHost, Host, Node) ->
select_type(ServerHost, Host, Node, hd(plugins(ServerHost))).
@ -2982,7 +3064,7 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
tree_call(Server, Function, Args);
tree_call(Host, Function, Args) ->
?DEBUG("tree_call ~p ~p ~p",[Host, Function, Args]),
Module = case ets:lookup(gen_mod:get_module_proc(Host, pubsub_state), nodetree) of
Module = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
end,

View File

@ -35,7 +35,7 @@
%% it's possible not to define some function at all
%% in that case, warning will be generated at compilation
%% and function call will fail,
%% then mod_pubsub will call function from node_default
%% then mod_pubsub will call function from node_hometree
%% (this makes code cleaner, but execution a little bit longer)
%% API definition
@ -70,10 +70,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, __TO_BE_DEFINED__},
@ -110,76 +110,76 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId)
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).

View File

@ -36,7 +36,7 @@
%% it's possible not to define some function at all
%% in that case, warning will be generated at compilation
%% and function call will fail,
%% then mod_pubsub will call function from node_default
%% then mod_pubsub will call function from node_hometree
%% (this makes code cleaner, but execution a little bit longer)
%% API definition
@ -72,10 +72,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, buddy},
@ -113,79 +113,79 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -36,7 +36,7 @@
%% it's possible not to define some function at all
%% in that case, warning will be generated at compilation
%% and function call will fail,
%% then mod_pubsub will call function from node_default
%% then mod_pubsub will call function from node_hometree
%% (this makes code cleaner, but execution a little bit longer)
%% API definition
@ -72,10 +72,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, club},
@ -112,79 +112,79 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -70,10 +70,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, dispatch},
@ -109,13 +109,13 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(_NodeId, _Sender, _Subscriber, _AccessModel,
_SendLast, _PresenceSubscription, _RosterGroup) ->
@ -126,7 +126,7 @@ unsubscribe_node(_NodeId, _Sender, _Subscriber, _SubID) ->
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
lists:foreach(fun(SubNode) ->
node_default:publish_item(
node_hometree:publish_item(
SubNode#pubsub_node.id, Publisher, Model,
MaxItems, ItemId, Payload)
end, nodetree_default:get_subnodes(NodeId, Publisher)).
@ -150,7 +150,7 @@ get_affiliation(_NodeId, _Owner) ->
{result, []}.
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(_Host, _Owner) ->
{result, []}.
@ -158,37 +158,37 @@ get_entity_subscriptions(_Host, _Owner) ->
get_node_subscriptions(NodeId) ->
%% note: get_node_subscriptions is used for broadcasting
%% DO NOT REMOVE
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(_NodeId, _Owner) ->
{result, []}.
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -63,10 +63,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, flat},
@ -86,9 +86,9 @@ options() ->
{presence_based_delivery, false}].
features() ->
node_default:features().
node_hometree:features().
%% use same code as node_default, but do not limite node to
%% use same code as node_hometree, but do not limite node to
%% the home/localhost/user/... hierarchy
%% any node is allowed
create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
@ -102,76 +102,76 @@ create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
{result, Allowed}.
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -38,7 +38,7 @@
%%% useable and useful as is. Please, send us comments, feedback and
%%% improvements.</p>
-module(node_default).
-module(node_hometree).
-author('christophe.romain@process-one.net').
-include("pubsub.hrl").

View File

@ -67,12 +67,12 @@
]).
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts),
node_hometree:init(Host, ServerHost, Opts),
complain_if_modcaps_disabled(ServerHost),
ok.
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost),
node_hometree:terminate(Host, ServerHost),
ok.
options() ->
@ -132,40 +132,40 @@ create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
{result, Allowed}.
create_node(NodeId, Owner) ->
case node_default:create_node(NodeId, Owner) of
case node_hometree:create_node(NodeId, Owner) of
{result, _} -> {result, []};
Error -> Error
end.
delete_node(Removed) ->
case node_default:delete_node(Removed) of
case node_hometree:delete_node(Removed) of
{result, {_, _, Removed}} -> {result, {[], Removed}};
Error -> Error
end.
subscribe_node(NodeId, Sender, Subscriber, AccessModel,
SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(
node_hometree:subscribe_node(
NodeId, Sender, Subscriber, AccessModel, SendLast,
PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
case node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID) of
case node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID) of
{error, Error} -> {error, Error};
{result, _} -> {result, []}
end.
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(_Host, Owner) ->
{_, D, _} = SubKey = jlib:jid_tolower(Owner),
@ -185,13 +185,13 @@ get_entity_affiliations(_Host, Owner) ->
{result, Reply}.
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(_Host, Owner) ->
{U, D, _} = SubKey = jlib:jid_tolower(Owner),
@ -222,40 +222,40 @@ get_node_subscriptions(NodeId) ->
%% but that call returns also all subscription to none
%% and this is required for broadcast to occurs
%% DO NOT REMOVE
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).
%%%

View File

@ -36,7 +36,7 @@
%% it's possible not to define some function at all
%% in that case, warning will be generated at compilation
%% and function call will fail,
%% then mod_pubsub will call function from node_default
%% then mod_pubsub will call function from node_hometree
%% (this makes code cleaner, but execution a little bit longer)
%% API definition
@ -72,10 +72,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, private},
@ -112,82 +112,82 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode,
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode,
Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast,
PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel,
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel,
SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -36,7 +36,7 @@
%% it's possible not to define some function at all
%% in that case, warning will be generated at compilation
%% and function call will fail,
%% then mod_pubsub will call function from node_default
%% then mod_pubsub will call function from node_hometree
%% (this makes code cleaner, but execution a little bit longer)
%% API definition
@ -72,10 +72,10 @@
init(Host, ServerHost, Opts) ->
node_default:init(Host, ServerHost, Opts).
node_hometree:init(Host, ServerHost, Opts).
terminate(Host, ServerHost) ->
node_default:terminate(Host, ServerHost).
node_hometree:terminate(Host, ServerHost).
options() ->
[{node_type, public},
@ -112,81 +112,81 @@ features() ->
].
create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
node_default:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
node_hometree:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
create_node(NodeId, Owner) ->
node_default:create_node(NodeId, Owner).
node_hometree:create_node(NodeId, Owner).
delete_node(Removed) ->
node_default:delete_node(Removed).
node_hometree:delete_node(Removed).
subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) ->
node_default:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
node_hometree:subscribe_node(NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup).
unsubscribe_node(NodeId, Sender, Subscriber, SubID) ->
node_default:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
node_hometree:unsubscribe_node(NodeId, Sender, Subscriber, SubID).
publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload) ->
node_default:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
node_hometree:publish_item(NodeId, Publisher, Model, MaxItems, ItemId, Payload).
remove_extra_items(NodeId, MaxItems, ItemIds) ->
node_default:remove_extra_items(NodeId, MaxItems, ItemIds).
node_hometree:remove_extra_items(NodeId, MaxItems, ItemIds).
delete_item(NodeId, Publisher, PublishModel, ItemId) ->
node_default:delete_item(NodeId, Publisher, PublishModel, ItemId).
node_hometree:delete_item(NodeId, Publisher, PublishModel, ItemId).
purge_node(NodeId, Owner) ->
node_default:purge_node(NodeId, Owner).
node_hometree:purge_node(NodeId, Owner).
get_entity_affiliations(Host, Owner) ->
node_default:get_entity_affiliations(Host, Owner).
node_hometree:get_entity_affiliations(Host, Owner).
get_node_affiliations(NodeId) ->
node_default:get_node_affiliations(NodeId).
node_hometree:get_node_affiliations(NodeId).
get_affiliation(NodeId, Owner) ->
node_default:get_affiliation(NodeId, Owner).
node_hometree:get_affiliation(NodeId, Owner).
set_affiliation(NodeId, Owner, Affiliation) ->
node_default:set_affiliation(NodeId, Owner, Affiliation).
node_hometree:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(Host, Owner) ->
node_default:get_entity_subscriptions(Host, Owner).
node_hometree:get_entity_subscriptions(Host, Owner).
get_node_subscriptions(NodeId) ->
node_default:get_node_subscriptions(NodeId).
node_hometree:get_node_subscriptions(NodeId).
get_subscription(NodeId, Owner) ->
node_default:get_subscription(NodeId, Owner).
node_hometree:get_subscription(NodeId, Owner).
set_subscription(NodeId, Owner, Subscription) ->
node_default:set_subscription(NodeId, Owner, Subscription).
node_hometree:set_subscription(NodeId, Owner, Subscription).
get_states(NodeId) ->
node_default:get_states(NodeId).
node_hometree:get_states(NodeId).
get_state(NodeId, JID) ->
node_default:get_state(NodeId, JID).
node_hometree:get_state(NodeId, JID).
set_state(State) ->
node_default:set_state(State).
node_hometree:set_state(State).
get_items(NodeId, From) ->
node_default:get_items(NodeId, From).
node_hometree:get_items(NodeId, From).
get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_items(NodeId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
get_item(NodeId, ItemId) ->
node_default:get_item(NodeId, ItemId).
node_hometree:get_item(NodeId, ItemId).
get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
node_hometree:get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
set_item(Item) ->
node_default:set_item(Item).
node_hometree:set_item(Item).
%% @doc <p>Return the name of the node if known: Default is to return
%% node id.</p>
get_item_name(Host, Node, Id) ->
node_default:get_item_name(Host, Node, Id).
node_hometree:get_item_name(Host, Node, Id).

View File

@ -33,7 +33,7 @@
%%% useable and useful as is. Please, send us comments, feedback and
%%% improvements.</p>
-module(nodetree_default).
-module(nodetree_tree).
-author('christophe.romain@process-one.net').
-include("pubsub.hrl").