From 85412f0a41e60cb03d8b7e01c00eccb233b69d0f Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 3 Mar 2009 18:11:23 +0000 Subject: [PATCH] Merge from trunk: 1835, 1836, 1842, 1843, 1854, 1858, 1860, 1861, and 1862. * doc/Makefile: In Clean do not remove html. In new Distclean, remove also html. * doc/Makefile: When cleaning, remove contributed_modules.tex * src/Makefile.in: Fix arguments to Install program * doc/guide.tex: Provide only an example of language option * doc/guide.html: Likewise * doc/guide.tex: mod_muc can run in several nodes of cluster * doc/guide.html: Likewise * doc/api/process-one.css: Add some style to HTML elements * src/ejabberd_listener.erl: Fix EDoc errors * src/web/ejabberd_web_admin.erl: Likewise * src/ejabberd_hooks.erl: Explanation in EDoc of some functions * doc/guide.tex: Explain that account creation is only supported by internal and odbc authentication methods * doc/guide.html: Likewise * src/Makefile.in: The path to the installed copy of ejabberd Guide is set in the environment variable EJABBERD_DOC_PATH (EJAB-837). * src/web/ejabberd_web_admin.erl: Likewise * src/ejabberdctl.template: Likewise * doc/guide.tex: Likewise * doc/guide.html: Likewise SVN Revision: 1937 --- ChangeLog | 36 +++++++++++++++++++++++++++++++- doc/Makefile | 5 ++++- doc/api/process-one.css | 14 ++++++++++++- doc/guide.html | 38 +++++++++++++++------------------- doc/guide.tex | 31 ++++++++++++--------------- src/Makefile.in | 3 ++- src/ejabberd_hooks.erl | 18 +++++++++++++--- src/ejabberdctl.template | 4 ++++ src/web/ejabberd_web_admin.erl | 16 +++++++------- 9 files changed, 111 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index a96dc6dad..688f4deba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,41 @@ +2009-03-03 Badlop + + * doc/Makefile: In Clean do not remove html. In new Distclean, + remove also html. + + * doc/Makefile: When cleaning, remove contributed_modules.tex + + * src/Makefile.in: Fix arguments to Install program + + * doc/guide.tex: Provide only an example of language option + * doc/guide.html: Likewise + + * doc/guide.tex: mod_muc can run in several nodes of cluster + * doc/guide.html: Likewise + + * doc/api/process-one.css: Add some style to HTML elements + + * src/ejabberd_listener.erl: Fix EDoc errors + * src/web/ejabberd_web_admin.erl: Likewise + + * src/ejabberd_hooks.erl: Explanation in EDoc of some functions + + * doc/guide.tex: Explain that account creation is only supported + by internal and odbc authentication methods + * doc/guide.html: Likewise + + * src/Makefile.in: The path to the installed copy of ejabberd + Guide is set in the environment variable + EJABBERD_DOC_PATH (EJAB-837). + * src/web/ejabberd_web_admin.erl: Likewise + * src/ejabberdctl.template: Likewise + * doc/guide.tex: Likewise + * doc/guide.html: Likewise + 2009-03-02 Pablo Polvorin * src/ejabberd_auth_anonymous.erl: Correct include declaration (thanks - to badlop). Bug was introduced in r1863. + to Badlop). Bug was introduced in r1863. * src/ejabberd_s2s_in.erl, src/ejabberd_s2s_out.erl: Serialize stanzas to iolist(). diff --git a/doc/Makefile b/doc/Makefile index 2fda395a0..3cc89b059 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -32,7 +32,6 @@ pdf: guide.pdf features.pdf clean: rm -f *.aux rm -f *.haux - rm -f *.html rm -f *.htoc rm -f *.idx rm -f *.ilg @@ -41,6 +40,10 @@ clean: rm -f *.out rm -f *.pdf rm -f *.toc + [ ! -f contributed_modules.tex ] || rm contributed_modules.tex + +distclean: clean + rm -f *.html guide.html: guide.tex hevea -fix -pedantic guide.tex diff --git a/doc/api/process-one.css b/doc/api/process-one.css index 793d717aa..5cd371e10 100644 --- a/doc/api/process-one.css +++ b/doc/api/process-one.css @@ -71,10 +71,22 @@ pre, tt, code { } pre { - margin-left: 1em; + margin:1ex 2ex; + border:1px dashed lightgrey; + background-color:#f9f9f9; + padding:0.5ex; } pre em { font-style: normal; font-weight: bold; } + +dt { + margin:0ex 2ex; + font-weight:bold; +} + +dd { + margin:0ex 0ex 1ex 4ex; +} diff --git a/doc/guide.html b/doc/guide.html index 3282fc3d8..645ae6d5c 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -476,7 +476,7 @@ variable.

  • Install OpenSSL in C:\sdk\OpenSSL and add C:\sdk\OpenSSL\lib\VC to your path or copy the binaries to your system directory.
  • Install ZLib in C:\sdk\gnuWin32. Copy C:\sdk\GnuWin32\bin\zlib1.dll to your system directory. If you change your path it should already be set after libiconv install. -
  • Make sure the you can access Erlang binaries from your path. For example: set PATH=%PATH%;"C:\sdk\erl5.5.5\bin" +
  • Make sure the you can access Erlang binaries from your path. For example: set PATH=%PATH%;"C:\sdk\erl5.6.5\bin"
  • Depending on how you end up actually installing the library you might need to check and tweak the paths in the file configure.erl.
  • While in the directory ejabberd\src run:
    configure.bat
    @@ -914,8 +914,8 @@ connected to port 5237 with password ‘ggsecret’.
     {s2s_default_policy, deny}.
     {{s2s_host,"jabber.example.org"}, allow}.
     {{s2s_host,"example.com"}, allow}.
    -

    Note, that for jabberd 1.4- or WPJabber-based -services you have to make the transports log and do XDB by themselves: +

    Note, that for services based in jabberd14 or WPJabber +you have to make the transports log and do XDB by themselves:

      <!--
          You have to add elogger and rlogger entries here when using ejabberd.
          In this case the transport will do the logging.
    @@ -937,7 +937,7 @@ services you have to make the transports log and do XDB by themselves:
       <xdb id="xdb">
         <host/>
         <load>
    -      <!-- this is a lib of wpjabber or jabberd -->
    +      <!-- this is a lib of wpjabber or jabberd14 -->
           <xdb_file>/usr/lib/jabber/xdb_file.so</xdb_file>
           </load>
         <xdb_file xmlns="jabber:config:xdb_file">
    @@ -959,7 +959,7 @@ example authentication scripts.
     3.2.2 and 3.2.4.
     
  • anonymous — See section 3.1.4.
  • pam — See section 3.1.4. -
  • +

    Account creation is only supported by internal and odbc methods.

    Internal

    ejabberd uses its internal Mnesia database as the default authentication method.

    • auth_method: The value internal will enable the internal @@ -1193,13 +1193,9 @@ To define a shaper named ‘normal’ with traffic speed limi can be seen by Jabber clients. If a Jabber client does not support xml:lang, the specified language is used. The default value is en. In order to take effect there must be a translation file -<language>.msg in ejabberd’s msgs directory.

      Examples: -

      • -To set Russian as default language: -
        {language, "ru"}.
        -
      • To set Spanish as default language: -
        {language, "es"}.
        -

      Appendix A provides more details about internationalization and localization.

      +<language>.msg in ejabberd’s msgs directory.

      For example, to set Russian as default language: +

      {language, "ru"}.
      +

      Appendix A provides more details about internationalization and localization.

      3.1.8  Include Additional Configuration Files

      The option include_config_file in a configuration file instructs ejabberd to include other configuration files immediately.

      The basic usage is:

      {include_config_file, <filename>}.
      @@ -3019,6 +3015,8 @@ all the environment variables and command line parameters.

      The environment Path to the ejabberd service log file.

      EJABBERD_SO_PATH
      Path to the directory with binary system libraries. +
      EJABBERD_DOC_PATH
      + Path to the directory with ejabberd documentation.
      HOME
      Path to the directory that is considered ejabberd’s home. This path is used to read the file .erlang.cookie. @@ -3140,10 +3138,8 @@ be installed in the system. The file is searched by default in "/share/doc/ejabberd/guide.html". The directory of the documentation can be specified in -ejabberd.cfg with the option doc_path. -For example: -

      {doc_path, "/usr/local/share/doc/ejabberd/"}.
      -

      +the environment variable EJABBERD_DOC_PATH. +See section 4.1.2.

      4.3  Ad-hoc Commands

      If you enable mod_configure and mod_adhoc, you can perform several administrative tasks in ejabberd with a Jabber client. @@ -3315,11 +3311,11 @@ Writing, on the other hand, will be slower. And of course if machine with one of the replicas is down, other replicas will be used.

      Also section 5.3 (Table Fragmentation) of Mnesia User’s Guide can be helpful.

      (alt) Same as in previous item, but for other tables.

    • Run ‘init:stop().’ or just ‘q().’ to exit from the Erlang shell. This probably can take some time if Mnesia has not yet -transfered and processed all data it needed from first.
    • Now run ejabberd on second with almost the same config as -on first (you probably do not need to duplicate ‘acl’ -and ‘access’ options — they will be taken from -first, and mod_muc and mod_irc should be -enabled only on one machine in the cluster). +transfered and processed all data it needed from first.
    • Now run ejabberd on second with a configuration similar as +on first: you probably do not need to duplicate ‘acl’ +and ‘access’ options because they will be taken from +first; and mod_irc should be +enabled only on one machine in the cluster.
    • You can repeat these steps for other machines supposed to serve this domain.

      6.3  Service Load-Balancing

      diff --git a/doc/guide.tex b/doc/guide.tex index 2e4c60531..a84f24954 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -1118,6 +1118,8 @@ The following authentication methods are supported by \ejabberd{}: \item pam --- See section~\ref{pam}. \end{itemize} +Account creation is only supported by internal and odbc methods. + \makesubsubsection{internalauth}{Internal} \ind{internal authentication}\ind{Mnesia} @@ -1481,17 +1483,10 @@ can be seen by \Jabber{} clients. If a \Jabber{} client does not support \term{en}. In order to take effect there must be a translation file \term{.msg} in \ejabberd{}'s \term{msgs} directory. -Examples: -\begin{itemize} -\item To set Russian as default language: +For example, to set Russian as default language: \begin{verbatim} {language, "ru"}. \end{verbatim} -\item To set Spanish as default language: -\begin{verbatim} -{language, "es"}. -\end{verbatim} -\end{itemize} Appendix \ref{i18ni10n} provides more details about internationalization and localization. @@ -3891,6 +3886,8 @@ The environment variables: Path to the ejabberd service log file. \titem{EJABBERD\_SO\_PATH} Path to the directory with binary system libraries. + \titem{EJABBERD\_DOC\_PATH} + Path to the directory with ejabberd documentation. \titem{HOME} Path to the directory that is considered \ejabberd{}'s home. This path is used to read the file \term{.erlang.cookie}. @@ -4027,11 +4024,9 @@ be installed in the system. The file is searched by default in \term{"/share/doc/ejabberd/guide.html"}. The directory of the documentation can be specified in -\term{ejabberd.cfg} with the option \term{doc\_path}. -For example: -\begin{verbatim} -{doc_path, "/usr/local/share/doc/ejabberd/"}. -\end{verbatim} +the environment variable \term{EJABBERD\_DOC\_PATH}. +See section \ref{erlangconfiguration}. + \makesection{adhoccommands}{Ad-hoc Commands} @@ -4320,11 +4315,11 @@ mnesia:change_table_copy_type(schema, node(), disc_copies). transfered and processed all data it needed from \term{first}. -\item Now run \ejabberd{} on \term{second} with almost the same config as - on \term{first} (you probably do not need to duplicate `\verb|acl|' - and `\verb|access|' options --- they will be taken from - \term{first}, and \verb|mod_muc| and \verb|mod_irc| should be - enabled only on one machine in the cluster). +\item Now run \ejabberd{} on \term{second} with a configuration similar as + on \term{first}: you probably do not need to duplicate `\verb|acl|' + and `\verb|access|' options because they will be taken from + \term{first}; and \verb|mod_irc| should be + enabled only on one machine in the cluster. \end{enumerate} You can repeat these steps for other machines supposed to serve this diff --git a/src/Makefile.in b/src/Makefile.in index 8917df636..ac9412a17 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -172,6 +172,7 @@ install: all -e "s*@LIBDIR@*@libdir@*" \ -e "s*@SYSCONFDIR@*@sysconfdir@*" \ -e "s*@LOCALSTATEDIR@*@localstatedir@*" \ + -e "s*@DOCDIR@*@docdir@*" \ -e "s*@erl@*@ERL@*" ejabberdctl.template \ > ejabberdctl.example [ -f $(ETCDIR)/ejabberdctl.cfg ] \ @@ -180,7 +181,7 @@ install: all install -b -m 644 $(G_USER) inetrc $(ETCDIR)/inetrc # # Administration script - [ -d $(SBINDIR) ] || install -d 750 $(SBINDIR) + [ -d $(SBINDIR) ] || install -d -m 750 $(SBINDIR) install -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl # # Binary Erlang files diff --git a/src/ejabberd_hooks.erl b/src/ejabberd_hooks.erl index e506aea89..22dc49eba 100644 --- a/src/ejabberd_hooks.erl +++ b/src/ejabberd_hooks.erl @@ -58,6 +58,9 @@ start_link() -> gen_server:start_link({local, ejabberd_hooks}, ejabberd_hooks, [], []). +%% @spec (Hook::atom(), Module::atom(), Function::atom(), Seq::integer()) -> ok +%% @doc Add a module and function to this hook. +%% The integer sequence is used to sort the calls: low number is called before high number. add(Hook, Module, Function, Seq) -> add(Hook, global, Module, Function, Seq). @@ -65,6 +68,9 @@ add(Hook, Host, Module, Function, Seq) when is_binary(Host) orelse is_atom(Host) -> gen_server:call(ejabberd_hooks, {add, Hook, Host, Module, Function, Seq}). +%% @spec (Hook::atom(), Module::atom(), Function::atom(), Seq::integer()) -> ok +%% @doc Delete a module and function from this hook. +%% It is important to indicate exactly the same information than when the call was added. delete(Hook, Module, Function, Seq) -> delete(Hook, global, Module, Function, Seq). @@ -72,6 +78,9 @@ delete(Hook, Host, Module, Function, Seq) when is_binary(Host) orelse is_atom(Host) -> gen_server:call(ejabberd_hooks, {delete, Hook, Host, Module, Function, Seq}). +%% @spec (Hook::atom(), Args) -> ok +%% @doc Run the calls of this hook in order, don't care about function results. +%% If a call returns stop, no more calls are performed. run(Hook, Args) -> run(Hook, global, Args). @@ -83,6 +92,12 @@ run(Hook, Host, Args) when is_binary(Host) orelse is_atom(Host) -> ok end. +%% @spec (Hook::atom(), Val, Args) -> Val | stopped | NewVal +%% @doc Run the calls of this hook in order. +%% The arguments passed to the function are: [Val | Args]. +%% The result of a call is used as Val for the next call. +%% If a call returns 'stop', no more calls are performed and 'stopped' is returned. +%% If a call returns {stopped, NewVal}, no more calls are performed and NewVal is returned. run_fold(Hook, Val, Args) -> run_fold(Hook, global, Val, Args). @@ -214,6 +229,3 @@ run_fold1([{_Seq, Module, Function} | Ls], Hook, Val, Args) -> NewVal -> run_fold1(Ls, Hook, NewVal, Args) end. - - - diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template index b71531c19..32a31d105 100644 --- a/src/ejabberdctl.template +++ b/src/ejabberdctl.template @@ -48,6 +48,9 @@ fi if [ "$SPOOLDIR" = "" ] ; then SPOOLDIR=@LOCALSTATEDIR@/lib/ejabberd fi +if [ "$EJABBERD_DOC_PATH" = "" ] ; then + EJABBERD_DOC_PATH=@DOCDIR@ +fi # check the proper system user is used ID=`id -g` @@ -99,6 +102,7 @@ export EJABBERD_MSGS_PATH export EJABBERD_LOG_PATH export EJABBERD_SO_PATH export EJABBERD_BIN_PATH +export EJABBERD_DOC_PATH export ERL_CRASH_DUMP export ERL_INETRC export ERL_MAX_PORTS diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl index fe5ea042c..1182c2a9f 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/web/ejabberd_web_admin.erl @@ -41,9 +41,9 @@ process(["doc", LocalFile], _Request) -> - DocPath = case ejabberd_config:get_global_option(doc_path) of + DocPath = case os:getenv("EJABBERD_DOC_PATH") of P when is_list(P) -> P; - _ -> "/share/doc/ejabberd/" + false -> "/share/doc/ejabberd/" end, %% Code based in mod_http_fileserver FileName = filename:join(DocPath, LocalFile), @@ -55,8 +55,8 @@ process(["doc", LocalFile], _Request) -> FileContents}; {error, Error} -> ?DEBUG("Delivering error: ~p", [Error]), - Help = " " ++ FileName ++ " - Try to specify the path to ejabberd guide.html " - "with the option doc_path. Check the ejabberd Guide for more information", + Help = " " ++ FileName ++ " - Try to specify the path to ejabberd documentation " + "with the environment variable EJABBERD_DOC_PATH. Check the ejabberd Guide for more information.", case Error of eacces -> {403, [], "Forbidden"++Help}; enoent -> {404, [], "Not found"++Help}; @@ -1071,10 +1071,10 @@ term_to_string(T) -> %% @spec (T::any(), Cols::integer()) -> {NumLines::integer(), Paragraph::string()} term_to_paragraph(T, Cols) -> - Paragraph = erl_prettypr:format(erl_syntax:abstract(T), [{paper, Cols}]), - {ok, FieldList} = regexp:split(Paragraph, "\n"), - NumLines = length(FieldList), - {NumLines, Paragraph}. + Paragraph = erl_prettypr:format(erl_syntax:abstract(T), [{paper, Cols}]), + {ok, FieldList} = regexp:split(Paragraph, "\n"), + NumLines = length(FieldList), + {NumLines, Paragraph}. term_to_id(T) -> jlib:encode_base64(binary_to_list(term_to_binary(T))).