From 007cafa7cde176fc95176be6e047fac56941adad Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 17 Aug 2009 17:17:34 +0000 Subject: [PATCH] Fix EDoc errors. SVN Revision: 2495 --- src/cyrsasl.erl | 5 +++-- src/ejabberd_auth.erl | 1 + src/ejabberd_auth_external.erl | 3 +-- src/ejabberd_auth_internal.erl | 3 +-- src/ejabberd_auth_ldap.erl | 3 +-- src/ejabberd_auth_odbc.erl | 3 +-- src/ejabberd_commands.erl | 15 ++++++++------- src/ejabberd_ctl.erl | 2 +- src/ejabberd_piefxis.erl | 30 +++++++++++++----------------- src/mod_roster.erl | 8 +++----- src/mod_roster_odbc.erl | 6 ++---- src/web/mod_http_fileserver.erl | 3 ++- 12 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/cyrsasl.erl b/src/cyrsasl.erl index c1287e080..5a9dd2dee 100644 --- a/src/cyrsasl.erl +++ b/src/cyrsasl.erl @@ -42,12 +42,13 @@ -record(sasl_mechanism, {mechanism, module, require_plain_password}). -%% @type saslstate() = {sasl_state, Service, Myname, Realm, GetPassword, CheckPassword, Mech_Mod, Mech_State} +%% @type saslstate() = {sasl_state, Service, Myname, Realm, GetPassword, CheckPassword, CheckPasswordDigest, Mech_Mod, Mech_State} %% Service = string() %% Myname = string() %% Realm = string() %% GetPassword = function() %% CheckPassword = function() +%% CheckPasswordDigest = any() %% Mech_Mod = atom() %% Mech_State = term(). %% State of this process. @@ -148,7 +149,7 @@ listmech(Host) -> ['$1']}]), filter_anonymous(Host, Mechs). -%% @spec (Service, ServerFQDN, UserRealm, SecFlags, GetPassword, CheckPassword) -> saslstate() +%% @spec (Service, ServerFQDN, UserRealm, SecFlags, GetPassword, CheckPassword, CheckPasswordDigest) -> saslstate() %% Service = string() %% ServerFQDN = string() %% UserRealm = string() diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl index bce8bd3cf..2003d0552 100644 --- a/src/ejabberd_auth.erl +++ b/src/ejabberd_auth.erl @@ -135,6 +135,7 @@ check_password_with_authmodule(User, Server, Password) %% Digest = string() | undefined %% DigestGen = function() %% AuthModule = authmodule() +%% @doc Check the password is valid and also return the authentication module that accepts it. %% The password is 'undefined' if the client %% authenticates using the digest method as defined in %% XEP-0078: Non-SASL Authentication diff --git a/src/ejabberd_auth_external.erl b/src/ejabberd_auth_external.erl index d9a32dd20..603088ebc 100644 --- a/src/ejabberd_auth_external.erl +++ b/src/ejabberd_auth_external.erl @@ -124,11 +124,10 @@ get_password(_User, _Server) -> get_password_s(_User, _Server) -> "". -%% @spec (User, Server) -> bool() +%% @spec (User, Server) -> true | false | {error, Error} %% User = string() %% Server = string() -%% @spec (User, Server) -> true | false | {error, Error} is_user_exists(User, Server) -> try extauth:is_user_exists(User, Server) of Res -> Res diff --git a/src/ejabberd_auth_internal.erl b/src/ejabberd_auth_internal.erl index 61c57d7e7..f4fa35541 100644 --- a/src/ejabberd_auth_internal.erl +++ b/src/ejabberd_auth_internal.erl @@ -361,11 +361,10 @@ get_password_s(User, Server) -> [] end. -%% @spec (User, Server) -> bool() +%% @spec (User, Server) -> true | false | {error, Error} %% User = string() %% Server = string() -%% @spec (User, Server) -> true | false | {error, Error} is_user_exists(User, Server) -> try LUser = exmpp_stringprep:nodeprep(User), diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl index a373a0678..d4d90602e 100644 --- a/src/ejabberd_auth_ldap.erl +++ b/src/ejabberd_auth_ldap.erl @@ -241,11 +241,10 @@ get_password(_User, _Server) -> get_password_s(_User, _Server) -> "". -%% @spec (User, Server) -> bool() +%% @spec (User, Server) -> true | false | {error, Error} %% User = string() %% Server = string() -%% @spec (User, Server) -> true | false | {error, Error} is_user_exists(User, Server) -> case catch is_user_exists_ldap(User, Server) of {'EXIT', Error} -> diff --git a/src/ejabberd_auth_odbc.erl b/src/ejabberd_auth_odbc.erl index 0943488f4..ccebe8a00 100644 --- a/src/ejabberd_auth_odbc.erl +++ b/src/ejabberd_auth_odbc.erl @@ -286,11 +286,10 @@ get_password_s(User, Server) -> "" end. -%% @spec (User, Server) -> bool() +%% @spec (User, Server) -> true | false | {error, Error} %% User = string() %% Server = string() -%% @spec (User, Server) -> true | false | {error, Error} is_user_exists(User, Server) -> try LUser = exmpp_stringprep:nodeprep(User), diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index 3eb5cae27..db6999a02 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -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; diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index 264bbaa53..7919986ae 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -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), diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index 1f0540890..ea66f529a 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -162,11 +162,8 @@ add_user(El, Domain) -> Password = exmpp_xml:get_attribute(El,password,none), add_user(El, Domain, User, 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) -> @@ -191,10 +188,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(?BTL(User),?BTL(Domain),?BTL(Password)) of @@ -207,14 +202,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: +%% ``` %% %% %% @@ -229,6 +223,7 @@ create_user(User,Password,Domain) -> %% %% %% +%% ''' populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) -> io:format("Trying to add/update roster list...",[]), @@ -258,6 +253,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: +%% ``` %% %% %% @@ -268,6 +264,7 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) -> %% %% %% +%% ''' populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) -> io:format("Trying to add/update vCards...",[]), @@ -457,7 +454,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). @@ -613,9 +610,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"]). diff --git a/src/mod_roster.erl b/src/mod_roster.erl index e2c017d54..052351773 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -182,13 +182,11 @@ roster_hash(Items) -> [R#roster{groups = lists:sort(Grs)} || R = #roster{groups = Grs} <- Items]))). -%% @spec (Host) -> true | false -%% @type Host = binary() +%% @spec (Host::binary()) -> true | false roster_versioning_enabled(Host) -> gen_mod:get_module_opt(binary_to_list(Host), ?MODULE, versioning, false). -%% @spec (Host) -> true | false -%% @type Host = binary() +%% @spec (Host::binary()) -> true | false roster_version_on_db(Host) -> gen_mod:get_module_opt(binary_to_list(Host), ?MODULE, store_current_id, false). @@ -219,7 +217,7 @@ roster_version(LServer ,LUser) -> %% To = exmpp_jid:jid() %% IQ_Rec = exmpp_iq:iq() %% IQ_Result = exmpp_iq:iq() -%% Load roster from DB only if neccesary +%% @doc Load roster from DB only if neccesary. %% It is neccesary if %% - roster versioning is disabled in server OR %% - roster versioning is not used by the client OR diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index 790862b0a..536da1efa 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -140,13 +140,11 @@ roster_hash(Items) -> [R#roster{groups = lists:sort(Grs)} || R = #roster{groups = Grs} <- Items]))). -%% @spec (Host) -> true | false -%% @type Host = binary() +%% @spec (Host::binary()) -> true | false roster_versioning_enabled(Host) -> gen_mod:get_module_opt(binary_to_list(Host), ?MODULE, versioning, false). -%% @spec (Host) -> true | false -%% @type Host = binary() +%% @spec (Host::binary()) -> true | false roster_version_on_db(Host) -> gen_mod:get_module_opt(binary_to_list(Host), ?MODULE, store_current_id, false). diff --git a/src/web/mod_http_fileserver.erl b/src/web/mod_http_fileserver.erl index d0b63048a..a5a021c00 100644 --- a/src/web/mod_http_fileserver.erl +++ b/src/web/mod_http_fileserver.erl @@ -167,7 +167,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),