25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-08 16:52:59 +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.
%% @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()) ->
%% true | false
check_password(User, Server, Password, Digest, DigestGen) ->

View File

@ -290,12 +290,12 @@ get_command_definition(Name) ->
execute_command(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
%% AccessCommands = [{Access, CommandNames, Arguments}]
%% Auth = {user, string()}, {server, string()}, {password, string()} | noauth
%% Auth = {User::string(), Server::string(), Password::string()} | noauth
%% Method = atom()
%% Arguments = [...]
%% Arguments = [any()]
%% Error = command_unknown | account_unprivileged | invalid_account_data | no_auth_provided
execute_command(AccessCommands, Auth, Name, Arguments) ->
case ets:lookup(ejabberd_commands, Name) of
@ -346,14 +346,15 @@ get_tags_commands() ->
%% Access verification
%% -----------------------------
%% At least one AccessCommand must be satisfied
%% @spec (AccessCommands, Auth, Method, Command, Arguments) -> ok
%% where
%% AccessCommands = [ {Access, CommandNames, Arguments} ]
%% Auth = {User::string(), Server::string(), Password::string()}
%% Auth = {User::string(), Server::string(), Password::string()} | noauth
%% Method = atom()
%% Arguments = [...]
%% It may throw {error, Error} where
%% Arguments = [any()]
%% @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
check_access_commands([], _Auth, _Method, _Command, _Arguments) ->
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}
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) ->
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"),
Command = list_to_atom(CmdStringU),

View File

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

View File

@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten.
%%%
%%% 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
%%% by the subscriptions field of pubsub_state. For information on
%%% 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]),
{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
%% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@ -1795,7 +1795,7 @@ delete_node(Host, Node, Owner) ->
Error
end.
%% @spec (Host, Node, From, JID) ->
%% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} |
%% {result, []}
%% Host = host()
@ -2245,7 +2245,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error
end.
%% @spec (Host, Node, NodeId, Type LJID, Number) -> any()
%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost()
%% Node = pubsubNode()
%% NodeId = pubsubNodeId()
@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""}
end.
%% @spec (LJID, PresenceDelivery) -> boolean()
%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid()
%% NotifyType = items | nodes
%% Depth = integer()
@ -3154,7 +3154,7 @@ node_options(Type) ->
Result
end.
%% @spec (Options) -> MaxItems
%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
%% Option = {Key::atom(), Value::term()}

View File

@ -35,7 +35,7 @@
%%% Functions concerning configuration should be rewritten.
%%%
%%% 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
%%% by the subscriptions field of pubsub_state. For information on
%%% 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]),
{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
%% Owner.</p>
send_pending_node_form(Host, Owner, _Lang, Plugins) ->
@ -1800,7 +1800,7 @@ delete_node(Host, Node, Owner) ->
Error
end.
%% @spec (Host, Node, From, JID) ->
%% @spec (Host, Node, From, JID, Configuration) ->
%% {error, Reason::stanzaError()} |
%% {result, []}
%% Host = host()
@ -2255,7 +2255,7 @@ get_item(Host, Node, ItemId) ->
Error -> Error
end.
%% @spec (Host, Node, NodeId, Type LJID, Number) -> any()
%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
%% Host = pubsubHost()
%% Node = pubsubNode()
%% NodeId = pubsubNodeId()
@ -2759,7 +2759,7 @@ service_jid(Host) ->
_ -> {jid, "", Host, "", "", Host, ""}
end.
%% @spec (LJID, PresenceDelivery) -> boolean()
%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
%% LJID = jid()
%% NotifyType = items | nodes
%% Depth = integer()
@ -3154,7 +3154,7 @@ node_options(Type) ->
Result
end.
%% @spec (NodeId) -> [ljid()]
%% @spec (Host, Type, NodeId) -> [ljid()]
%% NodeId = pubsubNodeId()
%% @doc <p>Return list of node owners.</p>
node_owners(Host, Type, NodeId) ->
@ -3178,7 +3178,7 @@ node_owners_call(Type, NodeId) ->
[]
end.
%% @spec (Options) -> MaxItems
%% @spec (Host, Options) -> MaxItems
%% Host = host()
%% Options = [Option]
%% Option = {Key::atom(), Value::term()}

View File

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

View File

@ -256,7 +256,7 @@ delete_node(Removed) ->
end, Removed),
{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}
%% @doc <p>Accepts or rejects subcription requests on a PubSub node.</p>
%% <p>The mechanism works as follow:
@ -905,8 +905,9 @@ set_state(NodeId, State) ->
end,
{result, []}.
%% @spec (StateId) -> ok | {error, Reason::stanzaError()}
%% StateId = mod_pubsub:pubsubStateId()
%% @spec (NodeId, JID) -> ok | {error, Reason::stanzaError()}
%% NodeId = mod_pubsub:pubsubNodeId()
%% JID = mod_pubsub:jid()
%% @doc <p>Delete a state from database.</p>
del_state(NodeId, JID) ->
J = encode_jid(JID),
@ -916,11 +917,9 @@ del_state(NodeId, JID) ->
"and nodeid='", NodeId, "';"]),
ok.
%% @spec (NodeId, From, Rsm) -> {[Items],RsmOut} | []
%% @spec (NodeId, From) -> {[Items],RsmOut} | []
%% NodeId = mod_pubsub:pubsubNodeId()
%% 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.
%% <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

View File

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

View File

@ -89,11 +89,12 @@ options() ->
{odbc, true}].
get_node(Host, Node, _From) ->
get_node(Host, Node).
%% @spec (Host, Node) -> pubsubNode() | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
get_node(Host, Node, _From) ->
get_node(Host, Node).
get_node(Host, Node) ->
H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@ -123,10 +124,10 @@ get_node(NodeId) ->
{error, ?ERR_ITEM_NOT_FOUND}
end.
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host, _From) ->
get_nodes(Host).
%% @spec (Host) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host() | mod_pubsub:jid()
get_nodes(Host) ->
H = ?PUBSUB:escape(Host),
case catch ejabberd_odbc:sql_query_t(
@ -164,11 +165,12 @@ get_parentnodes_tree(Host, Node, From) ->
Error -> Error
end.
get_subnodes(Host, Node, _From) ->
get_subnodes(Host, Node).
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
get_subnodes(Host, Node, _From) ->
get_subnodes(Host, Node).
get_subnodes(Host, Node) ->
H = ?PUBSUB:escape(Host),
N = ?PUBSUB:escape(?PUBSUB:node_to_string(Node)),
@ -183,11 +185,12 @@ get_subnodes(Host, Node) ->
[]
end.
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
%% @spec (Host, Index) -> [pubsubNode()] | {error, Reason}
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
get_subnodes_tree(Host, Node, _From) ->
get_subnodes_tree(Host, Node).
get_subnodes_tree(Host, Node) ->
H = ?PUBSUB:escape(Host),
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
%%% allow virtual nodes handling.
%%% <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.
%%% Please, send us comments, feedback and improvements.</p>
@ -85,9 +85,10 @@ options() ->
set_node(_NodeRecord) ->
ok.
%% @spec (Host, Node) -> pubsubNode()
%% @spec (Host, Node, From) -> pubsubNode()
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid()
%% @doc <p>Virtual node tree does not handle a node database. Any node is considered
%% as existing. Node record contains default values.</p>
get_node(Host, Node, _From) ->
@ -101,8 +102,9 @@ get_node({Host, _} = NodeId) ->
Owners = [{"", Host, ""}],
Record#pubsub_node{owners = Owners, options = Options}.
%% @spec (Host) -> [pubsubNode()]
%% @spec (Host, From) -> [pubsubNode()]
%% 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
%% as existing. Nodes list can not be determined.</p>
get_nodes(Host, _From) ->
@ -136,9 +138,10 @@ get_subnodes(Host, Node, _From) ->
get_subnodes(_Host, _Node) ->
[].
%% @spec (Host, Index) -> [pubsubNode()]
%% @spec (Host, Node, From) -> [pubsubNode()]
%% Host = mod_pubsub:host()
%% Node = mod_pubsub:pubsubNode()
%% From = mod_pubsub:jid()
%% @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).

View File

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

View File

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

View File

@ -173,7 +173,8 @@ initialize(Host, Opts) ->
%% @spec (AdminCTs::[CT], Default::[CT]) -> [CT]
%% where CT = {Extension::string(), Value}
%% 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.
build_list_content_types(AdminCTsUnsorted, DefaultCTsUnsorted) ->
AdminCTs = lists:ukeysort(1, AdminCTsUnsorted),