diff --git a/ChangeLog b/ChangeLog index 34dc8f270..0befd051c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ * src/mod_pubsub/node_default.erl, src/mod_pubsub/node_pep.erl: Fix acl:match_rule/3 call. It takes a #jid record, not a short JID. + * src/mod_pubsub/node_buddy.erl, src/mod_pubsub/node_club.erl, + src/mod_pubsub/node_dispatch.erl, src/mod_pubsub/node_mb.erl, + src/mod_pubsub/node_private.erl, src/mod_pubsub/node_public.erl, + src/mod_pubsub/node_zoo.erl, src/mod_pubsub/nodetree_default.erl, + src/mod_pubsub/nodetree_virtual.erl: Finish the conversion of + mod_pubsub to Exmpp. + 2008-12-05 Jean-Sébastien Pédron * src/ejabberd_receiver.erl, src/mod_offline_odbc.erl, diff --git a/src/mod_pubsub/node_buddy.erl b/src/mod_pubsub/node_buddy.erl index 6cdd6118b..95fefe9a5 100644 --- a/src/mod_pubsub/node_buddy.erl +++ b/src/mod_pubsub/node_buddy.erl @@ -26,8 +26,9 @@ -module(node_buddy). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). diff --git a/src/mod_pubsub/node_club.erl b/src/mod_pubsub/node_club.erl index ae8ab9cf1..6ff3fd33a 100644 --- a/src/mod_pubsub/node_club.erl +++ b/src/mod_pubsub/node_club.erl @@ -26,8 +26,9 @@ -module(node_club). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). diff --git a/src/mod_pubsub/node_dispatch.erl b/src/mod_pubsub/node_dispatch.erl index 98a396cbf..a646a3373 100644 --- a/src/mod_pubsub/node_dispatch.erl +++ b/src/mod_pubsub/node_dispatch.erl @@ -26,8 +26,9 @@ -module(node_dispatch). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). @@ -119,10 +120,10 @@ delete_node(Host, Removed) -> subscribe_node(_Host, _Node, _Sender, _Subscriber, _AccessModel, _SendLast, _PresenceSubscription, _RosterGroup) -> - {error, ?ERR_FORBIDDEN}. + {error, 'forbidden'}. unsubscribe_node(_Host, _Node, _Sender, _Subscriber, _SubID) -> - {error, ?ERR_FORBIDDEN}. + {error, 'forbidden'}. publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload) -> lists:foreach(fun(SubNode) -> @@ -135,10 +136,10 @@ remove_extra_items(_Host, _Node, _MaxItems, ItemIds) -> {result, {ItemIds, []}}. delete_item(_Host, _Node, _JID, _ItemId) -> - {error, ?ERR_ITEM_NOT_FOUND}. + {error, 'item-not-found'}. purge_node(_Host, _Node, _Owner) -> - {error, ?ERR_FORBIDDEN}. + {error, 'forbidden'}. get_entity_affiliations(_Host, _Owner) -> {result, []}. diff --git a/src/mod_pubsub/node_mb.erl b/src/mod_pubsub/node_mb.erl index f2498071c..15cc1d312 100644 --- a/src/mod_pubsub/node_mb.erl +++ b/src/mod_pubsub/node_mb.erl @@ -35,9 +35,10 @@ -module(node_mb). -author('eric@ohmforce.com'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("ejabberd.hrl"). -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). diff --git a/src/mod_pubsub/node_private.erl b/src/mod_pubsub/node_private.erl index 5d87ec181..20a8e5e01 100644 --- a/src/mod_pubsub/node_private.erl +++ b/src/mod_pubsub/node_private.erl @@ -26,8 +26,9 @@ -module(node_private). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). diff --git a/src/mod_pubsub/node_public.erl b/src/mod_pubsub/node_public.erl index 7fda56e22..c12e37187 100644 --- a/src/mod_pubsub/node_public.erl +++ b/src/mod_pubsub/node_public.erl @@ -26,8 +26,9 @@ -module(node_public). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). diff --git a/src/mod_pubsub/node_zoo.erl b/src/mod_pubsub/node_zoo.erl index 12a69c58f..0fc6fb797 100644 --- a/src/mod_pubsub/node_zoo.erl +++ b/src/mod_pubsub/node_zoo.erl @@ -25,8 +25,9 @@ -module(node_zoo). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_node). @@ -92,12 +93,13 @@ features() -> %% the home/localhost/user/... hierarchy %% any node is allowed create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) -> - LOwner = jlib:jid_tolower(Owner), + LOwner = jlib:short_prepd_jid(Owner), Allowed = case LOwner of - {"", Host, ""} -> + {undefined, Host, undefined} -> true; % pubsub service always allowed _ -> - case acl:match_rule(ServerHost, Access, LOwner) of + {LU, LS, LR} = LOwner, + case acl:match_rule(ServerHost, Access, exmpp_jid:make_jid(LU, LS, LR)) of allow -> true; _ -> diff --git a/src/mod_pubsub/nodetree_default.erl b/src/mod_pubsub/nodetree_default.erl index f3dea3eb9..0c3ce3082 100644 --- a/src/mod_pubsub/nodetree_default.erl +++ b/src/mod_pubsub/nodetree_default.erl @@ -36,8 +36,9 @@ -module(nodetree_default). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_nodetree). diff --git a/src/mod_pubsub/nodetree_virtual.erl b/src/mod_pubsub/nodetree_virtual.erl index 7b057a0fd..80a6e745e 100644 --- a/src/mod_pubsub/nodetree_virtual.erl +++ b/src/mod_pubsub/nodetree_virtual.erl @@ -34,8 +34,9 @@ -module(nodetree_virtual). -author('christophe.romain@process-one.net'). +-include_lib("exmpp/include/exmpp.hrl"). + -include("pubsub.hrl"). --include("jlib.hrl"). -behaviour(gen_pubsub_nodetree). @@ -121,11 +122,11 @@ get_subnodes_tree(_Host, _Node) -> %% is considered as already created.

%%

default allowed nodes: /home/host/user/any/node/name

create_node(_Host, Node, _Type, Owner, _Options) -> - UserName = Owner#jid.luser, - UserHost = Owner#jid.lserver, + UserName = Owner#jid.lnode, + UserHost = Owner#jid.ldomain, case Node of - ["home", UserHost, UserName | _] -> {error, ?ERR_CONFLICT}; - _ -> {error, ?ERR_NOT_ALLOWED} + ["home", UserHost, UserName | _] -> {error, 'conflict'}; + _ -> {error, 'not-allowed'} end. %% @spec (Host, Node) -> [mod_pubsub:node()]