25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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 * 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. 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> 2008-12-05 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/ejabberd_receiver.erl, src/mod_offline_odbc.erl, * src/ejabberd_receiver.erl, src/mod_offline_odbc.erl,

View File

@ -26,8 +26,9 @@
-module(node_buddy). -module(node_buddy).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).

View File

@ -26,8 +26,9 @@
-module(node_club). -module(node_club).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).

View File

@ -26,8 +26,9 @@
-module(node_dispatch). -module(node_dispatch).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).
@ -119,10 +120,10 @@ delete_node(Host, Removed) ->
subscribe_node(_Host, _Node, _Sender, _Subscriber, _AccessModel, subscribe_node(_Host, _Node, _Sender, _Subscriber, _AccessModel,
_SendLast, _PresenceSubscription, _RosterGroup) -> _SendLast, _PresenceSubscription, _RosterGroup) ->
{error, ?ERR_FORBIDDEN}. {error, 'forbidden'}.
unsubscribe_node(_Host, _Node, _Sender, _Subscriber, _SubID) -> unsubscribe_node(_Host, _Node, _Sender, _Subscriber, _SubID) ->
{error, ?ERR_FORBIDDEN}. {error, 'forbidden'}.
publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload) -> publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload) ->
lists:foreach(fun(SubNode) -> lists:foreach(fun(SubNode) ->
@ -135,10 +136,10 @@ remove_extra_items(_Host, _Node, _MaxItems, ItemIds) ->
{result, {ItemIds, []}}. {result, {ItemIds, []}}.
delete_item(_Host, _Node, _JID, _ItemId) -> delete_item(_Host, _Node, _JID, _ItemId) ->
{error, ?ERR_ITEM_NOT_FOUND}. {error, 'item-not-found'}.
purge_node(_Host, _Node, _Owner) -> purge_node(_Host, _Node, _Owner) ->
{error, ?ERR_FORBIDDEN}. {error, 'forbidden'}.
get_entity_affiliations(_Host, _Owner) -> get_entity_affiliations(_Host, _Owner) ->
{result, []}. {result, []}.

View File

@ -35,9 +35,10 @@
-module(node_mb). -module(node_mb).
-author('eric@ohmforce.com'). -author('eric@ohmforce.com').
-include_lib("exmpp/include/exmpp.hrl").
-include("ejabberd.hrl"). -include("ejabberd.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).

View File

@ -26,8 +26,9 @@
-module(node_private). -module(node_private).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).

View File

@ -26,8 +26,9 @@
-module(node_public). -module(node_public).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).

View File

@ -25,8 +25,9 @@
-module(node_zoo). -module(node_zoo).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_node). -behaviour(gen_pubsub_node).
@ -92,12 +93,13 @@ features() ->
%% the home/localhost/user/... hierarchy %% the home/localhost/user/... hierarchy
%% any node is allowed %% any node is allowed
create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) -> create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
LOwner = jlib:jid_tolower(Owner), LOwner = jlib:short_prepd_jid(Owner),
Allowed = case LOwner of Allowed = case LOwner of
{"", Host, ""} -> {undefined, Host, undefined} ->
true; % pubsub service always allowed 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 -> allow ->
true; true;
_ -> _ ->

View File

@ -36,8 +36,9 @@
-module(nodetree_default). -module(nodetree_default).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_nodetree). -behaviour(gen_pubsub_nodetree).

View File

@ -34,8 +34,9 @@
-module(nodetree_virtual). -module(nodetree_virtual).
-author('christophe.romain@process-one.net'). -author('christophe.romain@process-one.net').
-include_lib("exmpp/include/exmpp.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("jlib.hrl").
-behaviour(gen_pubsub_nodetree). -behaviour(gen_pubsub_nodetree).
@ -121,11 +122,11 @@ get_subnodes_tree(_Host, _Node) ->
%% is considered as already created.</p> %% is considered as already created.</p>
%% <p>default allowed nodes: /home/host/user/any/node/name</p> %% <p>default allowed nodes: /home/host/user/any/node/name</p>
create_node(_Host, Node, _Type, Owner, _Options) -> create_node(_Host, Node, _Type, Owner, _Options) ->
UserName = Owner#jid.luser, UserName = Owner#jid.lnode,
UserHost = Owner#jid.lserver, UserHost = Owner#jid.ldomain,
case Node of case Node of
["home", UserHost, UserName | _] -> {error, ?ERR_CONFLICT}; ["home", UserHost, UserName | _] -> {error, 'conflict'};
_ -> {error, ?ERR_NOT_ALLOWED} _ -> {error, 'not-allowed'}
end. end.
%% @spec (Host, Node) -> [mod_pubsub:node()] %% @spec (Host, Node) -> [mod_pubsub:node()]