host,
access,
nodetree = ?STDTREE,
- plugins = [?STDNODE,?PEPNODE]}).
+ plugins = [?STDNODE]}).
%%====================================================================
%% API
gen_mod:get_opt(nodetree, Opts, ?STDTREE)),
?INFO_MSG("** tree plugin is ~p",[TreePlugin]),
TreePlugin:init(Host, ServerHost, Opts),
- Plugins = lists:usort(gen_mod:get_opt(plugins, Opts, []) ++ [?STDNODE,?PEPNODE]),
+ Plugins = lists:usort(gen_mod:get_opt(plugins, Opts, []) ++ [?STDNODE]),
lists:foreach(fun(Name) ->
?INFO_MSG("** init ~s plugin",[Name]),
Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name),
%% disco hooks handling functions
%%
-disco_local_identity(Acc, _From, _To, [], _Lang) ->
- Acc ++ [{xmlelement, "identity", [{"category", "pubsub"}, {"type", "pep"}], []} ];
+identity(Host) ->
+ Identity = case lists:member(?PEPNODE, plugins(Host)) of
+ true -> [{"category", "pubsub"}, {"type", "pep"}];
+ false -> [{"category", "pubsub"}]
+ end,
+ {xmlelement, "identity", Identity, []}.
+
+disco_local_identity(Acc, _From, To, [], _Lang) ->
+ Acc ++ [identity(To#jid.lserver)];
disco_local_identity(Acc, _From, _To, _Node, _Lang) ->
Acc.
disco_local_items(Acc, _From, _To, _Node, _Lang) ->
Acc.
-disco_sm_identity(Acc, _From, _To, [], _Lang) ->
- Acc ++ [{xmlelement, "identity", [{"category", "pubsub"}, {"type", "pep"}], []} ];
+disco_sm_identity(Acc, _From, To, [], _Lang) ->
+ Acc ++ [identity(To#jid.lserver)];
disco_sm_identity(Acc, From, To, Node, _Lang) ->
LOwner = jlib:jid_tolower(jlib:jid_remove_resource(To)),
Acc ++ case node_disco_identity(LOwner, From, Node) of
"\nCopyright (c) 2004-2008 Process-One"}]}].
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) ->
- Plugins = case ets:lookup(gen_mod:get_module_proc(ServerHost, pubsub_state), plugins) of
- [{plugins, PL}] -> PL;
- _ -> [?STDNODE,?PEPNODE]
- end,
- iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, Plugins).
+ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(ServerHost)).
iq_pubsub(Host, ServerHost, From, IQType, SubEl, _Lang, Access, Plugins) ->
{xmlelement, _, _, SubEls} = SubEl,
{_User, _Server, _Resource} ->
?PEPNODE;
_ ->
- case ets:lookup(gen_mod:get_module_proc(ServerHost, pubsub_state), plugins) of
- [{plugins, PL}] -> hd(PL);
- _ -> ?STDNODE
- end
+ hd(plugins(ServerHost))
end,
case lists:member("auto-create", features(Type)) of
true ->
%%%% plugin handling
+plugins(Host) ->
+ case ets:lookup(gen_mod:get_module_proc(Host, pubsub_state), plugins) of
+ [{plugins, PL}] -> PL;
+ _ -> [?STDNODE]
+ end.
+
features() ->
[
%"access-authorize", % OPTIONAL
{'EXIT', {undef, _}} -> [];
Result -> Result
end.
-features(_Host, []) ->
- lists:usort(features(?STDNODE) ++ features(?PEPNODE));
+features(Host, []) ->
+ lists:usort(lists:foldl(fun(Plugin, Acc) ->
+ Acc ++ features(Plugin)
+ end, [], plugins(Host)));
features(Host, Node) ->
{result, Features} = node_action(Host, Node, features, []),
lists:usort(features() ++ Features).