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

Fix EDoc errors.

SVN Revision: 2494
This commit is contained in:
Badlop 2009-08-17 17:16:43 +00:00
parent 0192913405
commit 45b12ec886
14 changed files with 81 additions and 73 deletions

View File

@ -84,7 +84,7 @@ check_password(User, Server, Password) ->
end. end.
%% @doc Check if the user and password can login in server. %% @doc Check if the user and password can login in server.
%% @spec (User::string(), Server::string(), Password::string() %% @spec (User::string(), Server::string(), Password::string(),
%% Digest::string(), DigestGen::function()) -> %% Digest::string(), DigestGen::function()) ->
%% true | false %% true | false
check_password(User, Server, Password, Digest, DigestGen) -> check_password(User, Server, Password, Digest, DigestGen) ->

View File

@ -290,12 +290,12 @@ get_command_definition(Name) ->
execute_command(Name, Arguments) -> execute_command(Name, Arguments) ->
execute_command([], noauth, Name, Arguments). execute_command([], noauth, Name, Arguments).
%% @spec (AccessCommands, AuthList, Name::atom(), Arguments) -> ResultTerm | {error, Error} %% @spec (AccessCommands, Auth, Name::atom(), Arguments) -> ResultTerm | {error, Error}
%% where %% where
%% AccessCommands = [{Access, CommandNames, Arguments}] %% AccessCommands = [{Access, CommandNames, Arguments}]
%% Auth = {user, string()}, {server, string()}, {password, string()} | noauth %% Auth = {User::string(), Server::string(), Password::string()} | noauth
%% Method = atom() %% Method = atom()
%% Arguments = [...] %% Arguments = [any()]
%% Error = command_unknown | account_unprivileged | invalid_account_data | no_auth_provided %% Error = command_unknown | account_unprivileged | invalid_account_data | no_auth_provided
execute_command(AccessCommands, Auth, Name, Arguments) -> execute_command(AccessCommands, Auth, Name, Arguments) ->
case ets:lookup(ejabberd_commands, Name) of case ets:lookup(ejabberd_commands, Name) of
@ -346,14 +346,15 @@ get_tags_commands() ->
%% Access verification %% Access verification
%% ----------------------------- %% -----------------------------
%% At least one AccessCommand must be satisfied
%% @spec (AccessCommands, Auth, Method, Command, Arguments) -> ok %% @spec (AccessCommands, Auth, Method, Command, Arguments) -> ok
%% where %% where
%% AccessCommands = [ {Access, CommandNames, Arguments} ] %% AccessCommands = [ {Access, CommandNames, Arguments} ]
%% Auth = {User::string(), Server::string(), Password::string()} %% Auth = {User::string(), Server::string(), Password::string()} | noauth
%% Method = atom() %% Method = atom()
%% Arguments = [...] %% Arguments = [any()]
%% It may throw {error, Error} where %% @doc Check access is allowed to that command.
%% At least one AccessCommand must be satisfied.
%% It may throw {error, Error} where:
%% Error = account_unprivileged | invalid_account_data | no_auth_provided %% Error = account_unprivileged | invalid_account_data | no_auth_provided
check_access_commands([], _Auth, _Method, _Command, _Arguments) -> check_access_commands([], _Auth, _Method, _Command, _Arguments) ->
ok; ok;

View File

@ -275,7 +275,7 @@ try_call_command(Args, Auth, AccessCommands) ->
{io_lib:format("Problem '~p ~p' occurred executing the command.~nStacktrace: ~p", [A, Why, Stack]), ?STATUS_ERROR} {io_lib:format("Problem '~p ~p' occurred executing the command.~nStacktrace: ~p", [A, Why, Stack]), ?STATUS_ERROR}
end. end.
%% @spec (Args::[string()], Auth) -> string() | integer() | {string(), integer()} | {error, ErrorType} %% @spec (Args::[string()], Auth, AccessCommands) -> string() | integer() | {string(), integer()} | {error, ErrorType}
call_command([CmdString | Args], Auth, AccessCommands) -> call_command([CmdString | Args], Auth, AccessCommands) ->
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"), {ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"),
Command = list_to_atom(CmdStringU), Command = list_to_atom(CmdStringU),

View File

@ -201,11 +201,8 @@ add_user(El, Domain) ->
Password = exmpp_xml:get_attribute(El,password,none), Password = exmpp_xml:get_attribute(El,password,none),
add_user(El, Domain, ?BTL(User), ?BTL(Password)). add_user(El, Domain, ?BTL(User), ?BTL(Password)).
%% @spec El = XML element %% @spec (El::xmlel(), Domain::string(), User::string(), Password::string())
%% Domain = String with a domain name %% -> ok | {atomic, exists} | {error, not_allowed}
%% User = String with an user name
%% Password = String with an user password
%% @ret ok | {atomic, exists} | {error, not_allowed}
%% @doc Add a new user to the database. %% @doc Add a new user to the database.
%% If user already exists, it will be only updated. %% If user already exists, it will be only updated.
add_user(El, Domain, User, Password) -> add_user(El, Domain, User, Password) ->
@ -230,10 +227,8 @@ add_user(El, Domain, User, Password) ->
?ERROR_MSG("Error adding user ~s@~s: ~p~n", [User, Domain, Other]) ?ERROR_MSG("Error adding user ~s@~s: ~p~n", [User, Domain, Other])
end. end.
%% @spec User = String with User name %% @spec (User::string(), Password::string(), Domain::string())
%% Password = String with a Password value %% -> ok | {atomic, exists} | {error, not_allowed}
%% Domain = Stirng with a Domain name
%% @ret ok | {atomic, exists} | {error, not_allowed}
%% @doc Create a new user %% @doc Create a new user
create_user(User,Password,Domain) -> create_user(User,Password,Domain) ->
case ejabberd_auth:try_register(User,Domain,Password) of case ejabberd_auth:try_register(User,Domain,Password) of
@ -246,14 +241,13 @@ create_user(User,Password,Domain) ->
%%%================================== %%%==================================
%%%% Populate user %%%% Populate user
%% @spec User = String %% @spec (User::string(), Domain::string(), El::xml())
%% Domain = String %% -> ok | {error, not_found}
%% El = XML element
%% @ret ok | {error, not_found}
%% %%
%% @doc Add a new user from a XML file with a roster list. %% @doc Add a new user from a XML file with a roster list.
%% %%
%% Example of a file: %% Example of a file:
%% ```
%% <?xml version='1.0' encoding='UTF-8'?> %% <?xml version='1.0' encoding='UTF-8'?>
%% <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> %% <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'>
%% <host jid='localhost'> %% <host jid='localhost'>
@ -268,6 +262,7 @@ create_user(User,Password,Domain) ->
%% </user> %% </user>
%% </host> %% </host>
%% </server-data> %% </server-data>
%% '''
populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) -> populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
io:format("Trying to add/update roster list...",[]), io:format("Trying to add/update roster list...",[]),
@ -297,6 +292,7 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
%% @doc Read vcards from the XML and send it to the server %% @doc Read vcards from the XML and send it to the server
%% %%
%% Example: %% Example:
%% ```
%% <?xml version='1.0' encoding='UTF-8'?> %% <?xml version='1.0' encoding='UTF-8'?>
%% <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> %% <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'>
%% <host jid='localhost'> %% <host jid='localhost'>
@ -307,6 +303,7 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
%% </user> %% </user>
%% </host> %% </host>
%% </server-data> %% </server-data>
%% '''
populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) -> populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) ->
io:format("Trying to add/update vCards...",[]), io:format("Trying to add/update vCards...",[]),
@ -515,7 +512,7 @@ make_xinclude(Fn) ->
%%%% Export user %%%% Export user
%% @spec (Fd, Username::string(), Host::string()) -> ok %% @spec (Fd, Username::string(), Host::string()) -> ok
%% extraer su informacion e imprimirla %% @doc Extract user information and print it.
export_user(Fd, Username, Host) -> export_user(Fd, Username, Host) ->
UserString = extract_user(Username, Host), UserString = extract_user(Username, Host),
print(Fd, UserString). print(Fd, UserString).
@ -663,9 +660,8 @@ make_main_basefilename(Dir, FnT) ->
filename:join([Dir, Filename2]). filename:join([Dir, Filename2]).
%% @spec (FnT::string(), Host::string()) -> FnH::string() %% @spec (FnT::string(), Host::string()) -> FnH::string()
%% FnH = FnT + _ + Host2 + Extension %% @doc Make the filename for the host.
%% Host2 = Host with any . replaced by _ %% Example: ``("20080804-231550", "jabber.example.org") -> "20080804-231550_jabber_example_org.xml"''
%% Example: ("20080804-231550", "jabber.example.org") -> "20080804-231550_jabber_example_org.xml"
make_host_filename(FnT, Host) -> make_host_filename(FnT, Host) ->
Host2 = string:join(string:tokens(Host, "."), "_"), Host2 = string:join(string:tokens(Host, "."), "_"),
filename:flatten([FnT, "_", Host2, ".xml"]). filename:flatten([FnT, "_", Host2, ".xml"]).

View File

@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten. %%% Functions concerning configuration should be rewritten.
%%% %%%
%%% Support for subscription-options and multi-subscribe features was %%% Support for subscription-options and multi-subscribe features was
%%% added by Brian Cully <bjc@kublai.com>. Subscriptions and options are %%% added by Brian Cully (bjc AT kublai.com). Subscriptions and options are
%%% stored in the pubsub_subscription table, with a link to them provided %%% stored in the pubsub_subscription table, with a link to them provided
%%% by the subscriptions field of pubsub_state. For information on %%% by the subscriptions field of pubsub_state. For information on
%%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6, %%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6,
@ -1350,7 +1350,7 @@ adhoc_request(_Host, _ServerHost, _Owner, Other, _Access, _Plugins) ->
?DEBUG("Couldn't process ad hoc command:~n~p", [Other]), ?DEBUG("Couldn't process ad hoc command:~n~p", [Other]),
{error, ?ERR_ITEM_NOT_FOUND}. {error, ?ERR_ITEM_NOT_FOUND}.
%% @spec (Host, Owner) -> iqRes() %% @spec (Host, Owner, Lang, Plugins) -> iqRes()
%% @doc <p>Sends the process pending subscriptions XForm for Host to %% @doc <p>Sends the process pending subscriptions XForm for Host to
%% Owner.</p> %% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) -> send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@ -1795,7 +1795,7 @@ delete_node(Host, Node, Owner) ->
Error Error
end. end.
%% @spec (Host, Node, From, JID) -> %% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} | %% {error, Reason::stanzaError()} |
%% {result, []} %% {result, []}
%% Host = host() %% Host = host()
@ -2245,7 +2245,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error Error -> Error
end. end.
%% @spec (Host, Node, NodeId, Type LJID, Number) -> any() %% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost() %% Host = pubsubHost()
%% Node = pubsubNode() %% Node = pubsubNode()
%% NodeId = pubsubNodeId() %% NodeId = pubsubNodeId()
@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""} _ -> {jid, "", Host, "", "", Host, ""}
end. end.
%% @spec (LJID, PresenceDelivery) -> boolean() %% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid() %% LJID = jid()
%% NotifyType = items | nodes %% NotifyType = items | nodes
%% Depth = integer() %% Depth = integer()
@ -3154,7 +3154,7 @@ node_options(Type) ->
Result Result
end. end.
%% @spec (Options) -> MaxItems %% @spec (Host, Options) -> MaxItems
%% Host = host() %% Host = host()
%% Options = [Option] %% Options = [Option]
%% Option = {Key::atom(), Value::term()} %% Option = {Key::atom(), Value::term()}

View File

@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten. %%% Functions concerning configuration should be rewritten.
%%% %%%
%%% Support for subscription-options and multi-subscribe features was %%% Support for subscription-options and multi-subscribe features was
%%% added by Brian Cully <bjc@kublai.com>. Subscriptions and options are %%% added by Brian Cully (bjc AT kublai.com). Subscriptions and options are
%%% stored in the pubsub_subscription table, with a link to them provided %%% stored in the pubsub_subscription table, with a link to them provided
%%% by the subscriptions field of pubsub_state. For information on %%% by the subscriptions field of pubsub_state. For information on
%%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6, %%% subscription-options and mulit-subscribe see XEP-0060 sections 6.1.6,
@ -1354,7 +1354,7 @@ adhoc_request(_Host, _ServerHost, _Owner, Other, _Access, _Plugins) ->
?DEBUG("Couldn't process ad hoc command:~n~p", [Other]), ?DEBUG("Couldn't process ad hoc command:~n~p", [Other]),
{error, ?ERR_ITEM_NOT_FOUND}. {error, ?ERR_ITEM_NOT_FOUND}.
%% @spec (Host, Owner) -> iqRes() %% @spec (Host, Owner, Lang, Plugins) -> iqRes()
%% @doc <p>Sends the process pending subscriptions XForm for Host to %% @doc <p>Sends the process pending subscriptions XForm for Host to
%% Owner.</p> %% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) -> send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@ -1800,7 +1800,7 @@ delete_node(Host, Node, Owner) ->
Error Error
end. end.
%% @spec (Host, Node, From, JID) -> %% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} | %% {error, Reason::stanzaError()} |
%% {result, []} %% {result, []}
%% Host = host() %% Host = host()
@ -2255,7 +2255,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error Error -> Error
end. end.
%% @spec (Host, Node, NodeId, Type LJID, Number) -> any() %% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost() %% Host = pubsubHost()
%% Node = pubsubNode() %% Node = pubsubNode()
%% NodeId = pubsubNodeId() %% NodeId = pubsubNodeId()
@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""} _ -> {jid, "", Host, "", "", Host, ""}
end. end.
%% @spec (LJID, PresenceDelivery) -> boolean() %% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid() %% LJID = jid()
%% NotifyType = items | nodes %% NotifyType = items | nodes
%% Depth = integer() %% Depth = integer()
@ -3154,7 +3154,7 @@ node_options(Type) ->
Result Result
end. end.
%% @spec (NodeId) -> [ljid()] %% @spec (Host, Type, NodeId) -> [ljid()]
%% NodeId = pubsubNodeId() %% NodeId = pubsubNodeId()
%% @doc <p>Return list of node owners.</p> %% @doc <p>Return list of node owners.</p>
node_owners(Host, Type, NodeId) -> node_owners(Host, Type, NodeId) ->
@ -3178,7 +3178,7 @@ node_owners_call(Type, NodeId) ->
[] []
end. end.
%% @spec (Options) -> MaxItems %% @spec (Host, Options) -> MaxItems
%% Host = host() %% Host = host()
%% Options = [Option] %% Options = [Option]
%% Option = {Key::atom(), Value::term()} %% Option = {Key::atom(), Value::term()}

View File

@ -243,7 +243,7 @@ delete_node(Removed) ->
end, Removed), end, Removed),
{result, {default, broadcast, Reply}}. {result, {default, broadcast, Reply}}.
%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) -> %% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup, Options) ->
%% {error, Reason} | {result, Result} %% {error, Reason} | {result, Result}
%% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p> %% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p>
%% <p>The mechanism works as follow: %% <p>The mechanism works as follow:
@ -825,8 +825,9 @@ set_state(State) when is_record(State, pubsub_state) ->
set_state(_) -> set_state(_) ->
{error, ?ERR_INTERNAL_SERVER_ERROR}. {error, ?ERR_INTERNAL_SERVER_ERROR}.
%% @spec (StateId) -> ok | {error, Reason::stanzaError()} %% @spec (NodeId, JID) -> ok | {error, Reason::stanzaError()}
%% StateId = mod_pubsub:pubsubStateId() %% NodeId = mod_pubsub:pubsubNodeId()
%% JID = mod_pubsub:jid()
%% @doc <p>Delete a state from database.</p> %% @doc <p>Delete a state from database.</p>
del_state(NodeId, JID) -> del_state(NodeId, JID) ->
mnesia:delete({pubsub_state, {JID, NodeId}}). mnesia:delete({pubsub_state, {JID, NodeId}}).

View File

@ -256,7 +256,7 @@ delete_node(Removed) ->
end, Removed), end, Removed),
{result, {default, broadcast, Reply}}. {result, {default, broadcast, Reply}}.
%% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup) -> %% @spec (NodeId, Sender, Subscriber, AccessModel, SendLast, PresenceSubscription, RosterGroup, Options) ->
%% {error, Reason} | {result, Result} %% {error, Reason} | {result, Result}
%% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p> %% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p>
%% <p>The mechanism works as follow: %% <p>The mechanism works as follow:
@ -905,8 +905,9 @@ set_state(NodeId, State) ->
end, end,
{result, []}. {result, []}.
%% @spec (StateId) -> ok | {error, Reason::stanzaError()} %% @spec (NodeId, JID) -> ok | {error, Reason::stanzaError()}
%% StateId = mod_pubsub:pubsubStateId() %% NodeId = mod_pubsub:pubsubNodeId()
%% JID = mod_pubsub:jid()
%% @doc <p>Delete a state from database.</p> %% @doc <p>Delete a state from database.</p>
del_state(NodeId, JID) -> del_state(NodeId, JID) ->
J = encode_jid(JID), J = encode_jid(JID),
@ -916,11 +917,9 @@ del_state(NodeId, JID) ->
"and nodeid='", NodeId, "';"]), "and nodeid='", NodeId, "';"]),
ok. ok.
%% @spec (NodeId, From, Rsm) -> {[Items],RsmOut} | [] %% @spec (NodeId, From) -> {[Items],RsmOut} | []
%% NodeId = mod_pubsub:pubsubNodeId() %% NodeId = mod_pubsub:pubsubNodeId()
%% Items = mod_pubsub:pubsubItems() %% Items = mod_pubsub:pubsubItems()
%% Rsm = jlib:rsm_in() | none
%% RsmOut=jlib:rsm_out() | none
%% @doc Returns the list of stored items for a given node. %% @doc Returns the list of stored items for a given node.
%% <p>For the default PubSub module, items are stored in Mnesia database.</p> %% <p>For the default PubSub module, items are stored in Mnesia database.</p>
%% <p>We can consider that the pubsub_item table have been created by the main %% <p>We can consider that the pubsub_item table have been created by the main

View File

@ -103,11 +103,12 @@ set_node(Record) when is_record(Record, pubsub_node) ->
set_node(_) -> set_node(_) ->
{error, ?ERR_INTERNAL_SERVER_ERROR}. {error, ?ERR_INTERNAL_SERVER_ERROR}.
get_node(Host, Node, _From) ->
get_node(Host, Node).
%% @spec (Host, Node) -> pubsubNode() | {error, Reason} %% @spec (Host, Node) -> pubsubNode() | {error, Reason}
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
get_node(Host, Node, _From) ->
get_node(Host, Node).
get_node(Host, Node) -> get_node(Host, Node) ->
case catch mnesia:read({pubsub_node, {Host, Node}}) of case catch mnesia:read({pubsub_node, {Host, Node}}) of
[Record] when is_record(Record, pubsub_node) -> Record; [Record] when is_record(Record, pubsub_node) -> Record;
@ -121,10 +122,11 @@ get_node(NodeId) ->
Error -> Error Error -> Error
end. end.
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host, _From) -> get_nodes(Host, _From) ->
get_nodes(Host). get_nodes(Host).
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host) -> get_nodes(Host) ->
mnesia:match_object(#pubsub_node{nodeid = {Host, '_'}, _ = '_'}). mnesia:match_object(#pubsub_node{nodeid = {Host, '_'}, _ = '_'}).
@ -165,12 +167,13 @@ get_subnodes(Host, Node) ->
lists:member(Node, Parents)]), lists:member(Node, Parents)]),
qlc:e(Q). qlc:e(Q).
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
%% @spec (Host, Index) -> [pubsubNodeIdx()] | {error, Reason} %% @spec (Host, Index) -> [pubsubNodeIdx()] | {error, Reason}
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid() %% From = mod_pubsub:jid()
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
get_subnodes_tree(Host, Node) -> get_subnodes_tree(Host, Node) ->
mnesia:foldl(fun(#pubsub_node{nodeid = {H, N}} = R, Acc) -> mnesia:foldl(fun(#pubsub_node{nodeid = {H, N}} = R, Acc) ->
case lists:prefix(Node, N) and (H == Host) of case lists:prefix(Node, N) and (H == Host) of

View File

@ -89,11 +89,12 @@ options() ->
{odbc, true}]. {odbc, true}].
get_node(Host, Node, _From) ->
get_node(Host, Node).
%% @spec (Host, Node) -> pubsubNode() | {error, Reason} %% @spec (Host, Node) -> pubsubNode() | {error, Reason}
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
get_node(Host, Node, _From) ->
get_node(Host, Node).
get_node(Host, Node) -> get_node(Host, Node) ->
H = ?PUBSUB:escape(Host), H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)), N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@ -123,10 +124,10 @@ get_node(NodeId) ->
{error, ?ERR_ITEM_NOT_FOUND} {error, ?ERR_ITEM_NOT_FOUND}
end. end.
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host, _From) -> get_nodes(Host, _From) ->
get_nodes(Host). get_nodes(Host).
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host) -> get_nodes(Host) ->
H = ?PUBSUB:escape(Host), H = ?PUBSUB:escape(Host),
case catch ejabberd_odbc:sql_query_t( case catch ejabberd_odbc:sql_query_t(
@ -164,11 +165,12 @@ get_parentnodes_tree(Host, Node, From) ->
Error -> Error Error -> Error
end. end.
get_subnodes(Host, Node, _From) ->
get_subnodes(Host, Node).
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason} %% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
get_subnodes(Host, Node, _From) ->
get_subnodes(Host, Node).
get_subnodes(Host, Node) -> get_subnodes(Host, Node) ->
H = ?PUBSUB:escape(Host), H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)), N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@ -183,11 +185,12 @@ get_subnodes(Host, Node) ->
[] []
end. end.
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason} %% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
get_subnodes_tree(Host, Node) -> get_subnodes_tree(Host, Node) ->
H = ?PUBSUB:escape(Host), H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)), N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),

View File

@ -26,7 +26,7 @@
%%% @doc The module <strong>{@module}</strong> is the PubSub node tree plugin that %%% @doc The module <strong>{@module}</strong> is the PubSub node tree plugin that
%%% allow virtual nodes handling. %%% allow virtual nodes handling.
%%% <p>PubSub node tree plugins are using the {@link gen_nodetree} behaviour.</p> %%% <p>PubSub node tree plugins are using the {@link gen_nodetree} behaviour.</p>
%%% This plugin development is still a work in progress. Due to optimizations in %%% <p>This plugin development is still a work in progress. Due to optimizations in
%%% mod_pubsub, this plugin can not work anymore without altering functioning. %%% mod_pubsub, this plugin can not work anymore without altering functioning.
%%% Please, send us comments, feedback and improvements.</p> %%% Please, send us comments, feedback and improvements.</p>
@ -85,9 +85,10 @@ options() ->
set_node(_NodeRecord) -> set_node(_NodeRecord) ->
ok. ok.
%% @spec (Host, Node) -> pubsubNode() %% @spec (Host, Node, From) -> pubsubNode()
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle a node database. Any node is considered %% @doc <p>Virtual node tree does not handle a node database. Any node is considered
%% as existing. Node record contains default values.</p> %% as existing. Node record contains default values.</p>
get_node(Host, Node, _From) -> get_node(Host, Node, _From) ->
@ -101,8 +102,9 @@ get_node({Host, _} = NodeId) ->
Owners = [{"", Host, ""}], Owners = [{"", Host, ""}],
Record#pubsub_node{owners = Owners, options = Options}. Record#pubsub_node{owners = Owners, options = Options}.
%% @spec (Host) -> [pubsubNode()] %% @spec (Host, From) -> [pubsubNode()]
%% Host = mod_pubsub:host() | mod_pubsub:jid() %% Host = mod_pubsub:host() | mod_pubsub:jid()
%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle a node database. Any node is considered %% @doc <p>Virtual node tree does not handle a node database. Any node is considered
%% as existing. Nodes list can not be determined.</p> %% as existing. Nodes list can not be determined.</p>
get_nodes(Host, _From) -> get_nodes(Host, _From) ->
@ -136,9 +138,10 @@ get_subnodes(Host, Node, _From) ->
get_subnodes(_Host, _Node) -> get_subnodes(_Host, _Node) ->
[]. [].
%% @spec (Host, Index) -> [pubsubNode()] %% @spec (Host, Node, From) -> [pubsubNode()]
%% Host = mod_pubsub:host() %% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode() %% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle parent/child. Child list is empty.</p> %% @doc <p>Virtual node tree does not handle parent/child. Child list is empty.</p>
get_subnodes_tree(Host, Node, _From) -> get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node). get_subnodes_tree(Host, Node).

View File

@ -83,12 +83,13 @@
%%% @type pubsubNode() = #pubsub_node{ %%% @type pubsubNode() = #pubsub_node{
%%% nodeid = {Host::host(), Node::pubsubNode()}, %%% nodeid = {Host::host(), Node::pubsubNode()},
%%% parentid = Node::pubsubNode(), %%% parentid = Node::pubsubNode(),
%%% nodeidx = int(). % can be anything you want %%% nodeidx = int(),
%%% type = nodeType(), %%% type = nodeType(),
%%% options = [nodeOption()]} %%% options = [nodeOption()]}.
%%% <p>This is the format of the <tt>nodes</tt> table. The type of the table %%% <p>This is the format of the <tt>nodes</tt> table. The type of the table
%%% is: <tt>set</tt>,<tt>ram/disc</tt>.</p> %%% is: <tt>set</tt>,<tt>ram/disc</tt>.</p>
%%% <p>The <tt>parentid</tt> and <tt>type</tt> fields are indexed.</p> %%% <p>The <tt>parentid</tt> and <tt>type</tt> fields are indexed.</p>
%%% nodeidx can be anything you want.
-record(pubsub_node, {nodeid, -record(pubsub_node, {nodeid,
id, id,
parents = [], parents = [],
@ -98,7 +99,7 @@
}). }).
%%% @type pubsubState() = #pubsub_state{ %%% @type pubsubState() = #pubsub_state{
%%% stateid = {ljid(), nodeidx()}}, %%% stateid = {ljid(), nodeidx()},
%%% items = [ItemId::string()], %%% items = [ItemId::string()],
%%% affiliation = affiliation(), %%% affiliation = affiliation(),
%%% subscriptions = [subscription()]}. %%% subscriptions = [subscription()]}.
@ -111,7 +112,7 @@
}). }).
%%% @type pubsubItem() = #pubsub_item{ %%% @type pubsubItem() = #pubsub_item{
%%% itemid = {ItemId::string(), nodeidx()}}, %%% itemid = {ItemId::string(), nodeidx()},
%%% creation = {now(), ljid()}, %%% creation = {now(), ljid()},
%%% modification = {now(), ljid()}, %%% modification = {now(), ljid()},
%%% payload = XMLContent::string()}. %%% payload = XMLContent::string()}.

View File

@ -15,8 +15,8 @@
%%% All Rights Reserved.'' %%% All Rights Reserved.''
%%% This software is copyright 2006-2009, ProcessOne. %%% This software is copyright 2006-2009, ProcessOne.
%%% %%%
%%% @author Pablo Polvorin <pablo.polvorin@process-one.net>, based on %%% @author Pablo Polvorin <pablo.polvorin@process-one.net>
%% pubsub_subscription.erl by Brian Cully <bjc@kublai.com> %%% @author based on pubsub_subscription.erl by Brian Cully <bjc@kublai.com>
%%% @version {@vsn}, {@date} {@time} %%% @version {@vsn}, {@date} {@time}
%%% @end %%% @end
%%% ==================================================================== %%% ====================================================================

View File

@ -173,7 +173,8 @@ initialize(Host, Opts) ->
%% @spec (AdminCTs::[CT], Default::[CT]) -> [CT] %% @spec (AdminCTs::[CT], Default::[CT]) -> [CT]
%% where CT = {Extension::string(), Value} %% where CT = {Extension::string(), Value}
%% Value = string() | undefined %% Value = string() | undefined
%% Returns a unified list without duplicates where elements of AdminCTs have more priority. %% @doc Return a unified list without duplicates.
%% Elements of AdminCTs have more priority.
%% If a CT is declared as 'undefined', then it is not included in the result. %% If a CT is declared as 'undefined', then it is not included in the result.
build_list_content_types(AdminCTsUnsorted, DefaultCTsUnsorted) -> build_list_content_types(AdminCTsUnsorted, DefaultCTsUnsorted) ->
AdminCTs = lists:ukeysort(1, AdminCTsUnsorted), AdminCTs = lists:ukeysort(1, AdminCTsUnsorted),