From edc0a9ac87908aaeaedff03b20905a68f4fea75a Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Thu, 19 Feb 2009 11:29:01 +0000 Subject: [PATCH] fix nodetree plugin resolver, and backport last changes from trunk SVN Revision: 1890 --- ChangeLog | 13 +++++++++++++ src/mod_pubsub/mod_pubsub.erl | 25 +++++++++++++------------ src/mod_pubsub/node_buddy.erl | 2 +- src/mod_pubsub/node_club.erl | 2 +- src/mod_pubsub/node_default.erl | 2 +- src/mod_pubsub/node_mb.erl | 2 +- src/mod_pubsub/node_pep.erl | 2 +- src/mod_pubsub/node_private.erl | 2 +- src/mod_pubsub/node_public.erl | 2 +- 9 files changed, 33 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8b7ab8c7..c8356f29e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-02-19 Christophe Romain + + * 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 * src/ejabberd_auth.erl: Fix: for legacy authentication, the Digest diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index 622fc6b6d..08b17df85 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -33,14 +33,13 @@ %%% This module uses version 1.12 of the specification as a base. %%% Most of the specification is implemented. %%% Functions concerning configuration should be rewritten. -%%% Code is derivated from the original pubsub v1.7, by Alexey Shchepin %%% TODO %%% plugin: generate Reply (do not use broadcast atom anymore) -module(mod_pubsub). -author('christophe.romain@process-one.net'). --version('1.12-01'). +-version('1.12-02'). -behaviour(gen_server). -behaviour(gen_mod). @@ -185,7 +184,7 @@ init([ServerHost, Opts]) -> 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), {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), {ok, #state{host = Host, server_host = ServerHost, @@ -237,6 +236,8 @@ init_nodes(Host, ServerHost) -> ok. 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 [host_node, host_parent, info] -> ?INFO_MSG("upgrade pubsub tables",[]), @@ -761,10 +762,10 @@ iq_disco_info(Host, SNode, From, Lang) -> [?XMLATTR('category', "pubsub"), ?XMLATTR('type', "service"), ?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_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_VCARD_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_PUBSUB_s)]}, + #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++ lists:map(fun(Feature) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]} end, features(Host, SNode))}; @@ -1581,7 +1582,7 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) -> Action = fun(#pubsub_node{type = Type}) -> Features = features(Type), PersistentFeature = lists:member("persistent-items", Features), - DeleteFeature = lists:member("delete-any", Features), + DeleteFeature = lists:member("delete-items", Features), if %%-> iq_pubsub just does that matchs %% %% 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")}; not DeleteFeature -> %% 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 -> node_call(Type, delete_item, [Host, Node, Publisher, ItemId]) end @@ -1984,7 +1985,7 @@ get_subscriptions(Host, Node, JID) -> if not RetrieveFeature -> %% 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} -> %% Entity is not an owner {error, 'forbidden'}; @@ -2695,7 +2696,7 @@ features() -> "config-node", % RECOMMENDED "create-and-configure", % RECOMMENDED % see plugin "create-nodes", % RECOMMENDED - % see plugin "delete-any", % RECOMMENDED + % see plugin "delete-items", % RECOMMENDED % see plugin "delete-nodes", % RECOMMENDED % see plugin "filtered-notifications", % RECOMMENDED %TODO "get-pending", % OPTIONAL @@ -2747,7 +2748,7 @@ tree_call({_User, Server, _Resource}, Function, Args) -> tree_call(Host, Function, Args) -> Module = case ets:lookup(gen_mod:get_module_proc(Host, pubsub_state), nodetree) of [{nodetree, N}] -> N; - _ -> list_to_atom(?TREE_PREFIX ++ ?STDNODE) + _ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE) end, catch apply(Module, Function, Args). tree_action(Host, Function, Args) -> diff --git a/src/mod_pubsub/node_buddy.erl b/src/mod_pubsub/node_buddy.erl index 91834e708..6d9e1b549 100644 --- a/src/mod_pubsub/node_buddy.erl +++ b/src/mod_pubsub/node_buddy.erl @@ -98,7 +98,7 @@ options() -> features() -> ["create-nodes", "delete-nodes", - "delete-any", + "delete-items", "instant-nodes", "item-ids", "outcast-affiliation", diff --git a/src/mod_pubsub/node_club.erl b/src/mod_pubsub/node_club.erl index d62da7201..b5a04beda 100644 --- a/src/mod_pubsub/node_club.erl +++ b/src/mod_pubsub/node_club.erl @@ -98,7 +98,7 @@ options() -> features() -> ["create-nodes", "delete-nodes", - "delete-any", + "delete-items", "instant-nodes", "outcast-affiliation", "persistent-items", diff --git a/src/mod_pubsub/node_default.erl b/src/mod_pubsub/node_default.erl index 7087ef11a..56e0d6d2b 100644 --- a/src/mod_pubsub/node_default.erl +++ b/src/mod_pubsub/node_default.erl @@ -160,7 +160,7 @@ features() -> ["create-nodes", "auto-create", "delete-nodes", - "delete-any", + "delete-items", "instant-nodes", "manage-subscriptions", "modify-affiliations", diff --git a/src/mod_pubsub/node_mb.erl b/src/mod_pubsub/node_mb.erl index d1071d863..90a5cdad2 100644 --- a/src/mod_pubsub/node_mb.erl +++ b/src/mod_pubsub/node_mb.erl @@ -103,7 +103,7 @@ features() -> "auto-create", %* "auto-subscribe", %* "delete-nodes", %* - "delete-any", %* + "delete-items", %* "filtered-notifications", %* "modify-affiliations", "outcast-affiliation", diff --git a/src/mod_pubsub/node_pep.erl b/src/mod_pubsub/node_pep.erl index 47041b83d..ebb2e5c35 100644 --- a/src/mod_pubsub/node_pep.erl +++ b/src/mod_pubsub/node_pep.erl @@ -98,7 +98,7 @@ features() -> "auto-create", %* "auto-subscribe", %* "delete-nodes", %* - "delete-any", %* + "delete-items", %* "filtered-notifications", %* "modify-affiliations", "outcast-affiliation", diff --git a/src/mod_pubsub/node_private.erl b/src/mod_pubsub/node_private.erl index a1fe4783b..32f86fbb8 100644 --- a/src/mod_pubsub/node_private.erl +++ b/src/mod_pubsub/node_private.erl @@ -98,7 +98,7 @@ options() -> features() -> ["create-nodes", "delete-nodes", - "delete-any", + "delete-items", "instant-nodes", "outcast-affiliation", "persistent-items", diff --git a/src/mod_pubsub/node_public.erl b/src/mod_pubsub/node_public.erl index 0a3d9d7cb..c8fa085ab 100644 --- a/src/mod_pubsub/node_public.erl +++ b/src/mod_pubsub/node_public.erl @@ -98,7 +98,7 @@ options() -> features() -> ["create-nodes", "delete-nodes", - "delete-any", + "delete-items", "instant-nodes", "outcast-affiliation", "persistent-items",