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

fix nodetree plugin resolver, and backport last changes from trunk

SVN Revision: 1890
This commit is contained in:
Christophe Romain 2009-02-19 11:29:01 +00:00
parent 5334a2d965
commit edc0a9ac87
9 changed files with 33 additions and 19 deletions

View File

@ -1,3 +1,16 @@
2009-02-19 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: fix nodetree plugin resolver
* src/mod_pubsub/mod_pubsub.erl: backport last changes from trunk
* src/mod_pubsub/node_mb.erl: Likewise
* src/mod_pubsub/node_buddy.erl: Likewise
* src/mod_pubsub/node_private.erl: Likewise
* src/mod_pubsub/node_public.erl: Likewise
* src/mod_pubsub/node_default.erl: Likewise
* src/mod_pubsub/node_pep.erl: Likewise
* src/mod_pubsub/node_club.erl: Likewise
2009-02-18 Pablo Polvorin <pablo.polvorin@process-one.net> 2009-02-18 Pablo Polvorin <pablo.polvorin@process-one.net>
* src/ejabberd_auth.erl: Fix: for legacy authentication, the Digest * src/ejabberd_auth.erl: Fix: for legacy authentication, the Digest

View File

@ -33,14 +33,13 @@
%%% This module uses version 1.12 of the specification as a base. %%% This module uses version 1.12 of the specification as a base.
%%% Most of the specification is implemented. %%% Most of the specification is implemented.
%%% Functions concerning configuration should be rewritten. %%% Functions concerning configuration should be rewritten.
%%% Code is derivated from the original pubsub v1.7, by Alexey Shchepin
%%% TODO %%% TODO
%%% plugin: generate Reply (do not use broadcast atom anymore) %%% plugin: generate Reply (do not use broadcast atom anymore)
-module(mod_pubsub). -module(mod_pubsub).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-version('1.12-01'). -version('1.12-02').
-behaviour(gen_server). -behaviour(gen_server).
-behaviour(gen_mod). -behaviour(gen_mod).
@ -185,7 +184,7 @@ init([ServerHost, Opts]) ->
ets:new(gen_mod:get_module_proc(ServerHost, pubsub_state), [set, named_table]), ets:new(gen_mod:get_module_proc(ServerHost, pubsub_state), [set, named_table]),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {nodetree, NodeTree}), 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), {plugins, Plugins}),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {pep_mapping, PepMapping}), ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {pep_mapping, PepMapping}),
init_nodes(Host, ServerHost), init_nodes(Host, ServerHost),
{ok, #state{host = Host, {ok, #state{host = Host,
server_host = ServerHost, server_host = ServerHost,
@ -237,6 +236,8 @@ init_nodes(Host, ServerHost) ->
ok. ok.
update_database(Host) -> update_database(Host) ->
mnesia:del_table_index(pubsub_node, type),
mnesia:del_table_index(pubsub_node, parentid),
case catch mnesia:table_info(pubsub_node, attributes) of case catch mnesia:table_info(pubsub_node, attributes) of
[host_node, host_parent, info] -> [host_node, host_parent, info] ->
?INFO_MSG("upgrade pubsub tables",[]), ?INFO_MSG("upgrade pubsub tables",[]),
@ -761,10 +762,10 @@ iq_disco_info(Host, SNode, From, Lang) ->
[?XMLATTR('category', "pubsub"), [?XMLATTR('category', "pubsub"),
?XMLATTR('type', "service"), ?XMLATTR('type', "service"),
?XMLATTR('name', translate:translate(Lang, "Publish-Subscribe"))]}, ?XMLATTR('name', translate:translate(Lang, "Publish-Subscribe"))]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_INFO_s)]}, #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_INFO_s)]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_ITEMS_s)]}, #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_ITEMS_s)]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]}, #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++ #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
lists:map(fun(Feature) -> lists:map(fun(Feature) ->
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]} #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]}
end, features(Host, SNode))}; end, features(Host, SNode))};
@ -1581,7 +1582,7 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) ->
Action = fun(#pubsub_node{type = Type}) -> Action = fun(#pubsub_node{type = Type}) ->
Features = features(Type), Features = features(Type),
PersistentFeature = lists:member("persistent-items", Features), PersistentFeature = lists:member("persistent-items", Features),
DeleteFeature = lists:member("delete-any", Features), DeleteFeature = lists:member("delete-items", Features),
if if
%%-> iq_pubsub just does that matchs %%-> iq_pubsub just does that matchs
%% %% Request does not specify an item %% %% Request does not specify an item
@ -1591,7 +1592,7 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) ->
{error, extended_error('feature-not-implemented', unsupported, "persistent-items")}; {error, extended_error('feature-not-implemented', unsupported, "persistent-items")};
not DeleteFeature -> not DeleteFeature ->
%% Service does not support item deletion %% Service does not support item deletion
{error, extended_error('feature-not-implemented', unsupported, "delete-any")}; {error, extended_error('feature-not-implemented', unsupported, "delete-items")};
true -> true ->
node_call(Type, delete_item, [Host, Node, Publisher, ItemId]) node_call(Type, delete_item, [Host, Node, Publisher, ItemId])
end end
@ -1984,7 +1985,7 @@ get_subscriptions(Host, Node, JID) ->
if if
not RetrieveFeature -> not RetrieveFeature ->
%% Service does not support manage subscriptions %% Service does not support manage subscriptions
{error, extended_error('feature-not-implemented', unsupported, "manage-affiliations")}; {error, extended_error('feature-not-implemented', unsupported, "manage-subscriptions")};
Affiliation /= {result, owner} -> Affiliation /= {result, owner} ->
%% Entity is not an owner %% Entity is not an owner
{error, 'forbidden'}; {error, 'forbidden'};
@ -2695,7 +2696,7 @@ features() ->
"config-node", % RECOMMENDED "config-node", % RECOMMENDED
"create-and-configure", % RECOMMENDED "create-and-configure", % RECOMMENDED
% see plugin "create-nodes", % RECOMMENDED % see plugin "create-nodes", % RECOMMENDED
% see plugin "delete-any", % RECOMMENDED % see plugin "delete-items", % RECOMMENDED
% see plugin "delete-nodes", % RECOMMENDED % see plugin "delete-nodes", % RECOMMENDED
% see plugin "filtered-notifications", % RECOMMENDED % see plugin "filtered-notifications", % RECOMMENDED
%TODO "get-pending", % OPTIONAL %TODO "get-pending", % OPTIONAL
@ -2747,7 +2748,7 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
tree_call(Host, Function, Args) -> tree_call(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, pubsub_state), nodetree) of
[{nodetree, N}] -> N; [{nodetree, N}] -> N;
_ -> list_to_atom(?TREE_PREFIX ++ ?STDNODE) _ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
end, end,
catch apply(Module, Function, Args). catch apply(Module, Function, Args).
tree_action(Host, Function, Args) -> tree_action(Host, Function, Args) ->

View File

@ -98,7 +98,7 @@ options() ->
features() -> features() ->
["create-nodes", ["create-nodes",
"delete-nodes", "delete-nodes",
"delete-any", "delete-items",
"instant-nodes", "instant-nodes",
"item-ids", "item-ids",
"outcast-affiliation", "outcast-affiliation",

View File

@ -98,7 +98,7 @@ options() ->
features() -> features() ->
["create-nodes", ["create-nodes",
"delete-nodes", "delete-nodes",
"delete-any", "delete-items",
"instant-nodes", "instant-nodes",
"outcast-affiliation", "outcast-affiliation",
"persistent-items", "persistent-items",

View File

@ -160,7 +160,7 @@ features() ->
["create-nodes", ["create-nodes",
"auto-create", "auto-create",
"delete-nodes", "delete-nodes",
"delete-any", "delete-items",
"instant-nodes", "instant-nodes",
"manage-subscriptions", "manage-subscriptions",
"modify-affiliations", "modify-affiliations",

View File

@ -103,7 +103,7 @@ features() ->
"auto-create", %* "auto-create", %*
"auto-subscribe", %* "auto-subscribe", %*
"delete-nodes", %* "delete-nodes", %*
"delete-any", %* "delete-items", %*
"filtered-notifications", %* "filtered-notifications", %*
"modify-affiliations", "modify-affiliations",
"outcast-affiliation", "outcast-affiliation",

View File

@ -98,7 +98,7 @@ features() ->
"auto-create", %* "auto-create", %*
"auto-subscribe", %* "auto-subscribe", %*
"delete-nodes", %* "delete-nodes", %*
"delete-any", %* "delete-items", %*
"filtered-notifications", %* "filtered-notifications", %*
"modify-affiliations", "modify-affiliations",
"outcast-affiliation", "outcast-affiliation",

View File

@ -98,7 +98,7 @@ options() ->
features() -> features() ->
["create-nodes", ["create-nodes",
"delete-nodes", "delete-nodes",
"delete-any", "delete-items",
"instant-nodes", "instant-nodes",
"outcast-affiliation", "outcast-affiliation",
"persistent-items", "persistent-items",

View File

@ -98,7 +98,7 @@ options() ->
features() -> features() ->
["create-nodes", ["create-nodes",
"delete-nodes", "delete-nodes",
"delete-any", "delete-items",
"instant-nodes", "instant-nodes",
"outcast-affiliation", "outcast-affiliation",
"persistent-items", "persistent-items",