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

Finish the conversion of mod_pubsub to Exmpp.

PR:		EJABP-1

SVN Revision: 1709
This commit is contained in:
Jean-Sébastien Pédron 2008-12-08 11:21:32 +00:00
parent d01c24bd23
commit 82b97b9639
10 changed files with 37 additions and 20 deletions

View File

@ -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 <js.pedron@meetic-corp.com>
* src/ejabberd_receiver.erl, src/mod_offline_odbc.erl,

View File

@ -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).

View File

@ -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).

View File

@ -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, []}.

View File

@ -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).

View File

@ -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).

View File

@ -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).

View File

@ -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;
_ ->

View File

@ -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).

View File

@ -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.</p>
%% <p>default allowed nodes: /home/host/user/any/node/name</p>
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()]