]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_register.erl: Support for io_lib newline character in
authorBadlop <badlop@process-one.net>
Wed, 9 Jul 2008 17:53:56 +0000 (17:53 +0000)
committerBadlop <badlop@process-one.net>
Wed, 9 Jul 2008 17:53:56 +0000 (17:53 +0000)
the body of welcome_message (EJAB-501)
* doc/guide.tex: Document the newline character
* src/ejabberd.cfg.example: Example usage of newline character

SVN Revision: 1425

ChangeLog
doc/guide.html
doc/guide.tex
src/ejabberd.cfg.example
src/mod_register.erl

index 460204a42d3e1734dd8c5f2f8538432cd4e5613b..49afcbbfc0e2d5b7680bdfdfc15dd3dd9f4165fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-07-09  Badlop  <badlop@process-one.net>
 
+       * src/mod_register.erl: Support for io_lib newline character in
+       the body of welcome_message (EJAB-501)
+       * doc/guide.tex: Document the newline character
+       * src/ejabberd.cfg.example: Example usage of newline character
+
        * src/ejabberd_config.erl (load_file): error message on sasl.log
        is not flattened (EJAB-616)
 
index bbb0fbf1669fd37dc73da13c6e224cd7cfcf285e..b7f10839b6d613eab933ff115da1fb4e612fb215 100644 (file)
@@ -2113,7 +2113,7 @@ Chatroom details are added on top of each page: room title, JID,
 author, subject and configuration.
 </LI><LI CLASS="li-itemize">
 The room JID in the generated HTML is a link to join the chatroom (using
-<A HREF="http://www.xmpp.org/rfc/rfc5122.html">XMPP URI</A>).
+<A HREF="http://www.xmpp.org/rfcs/rfc5122.html">XMPP URI</A>).
 </LI><LI CLASS="li-itemize">Subject and chatroom configuration changes are tracked and displayed.
 </LI><LI CLASS="li-itemize">Joins, leaves, nick changes, kicks, bans and &#X2018;/me&#X2019; are tracked and
 displayed, including the reason if available.
@@ -2363,6 +2363,7 @@ restrictions by default).
 </DD><DT CLASS="dt-description"><B><TT>welcome_message</TT></B></DT><DD CLASS="dd-description"> Set a welcome message that
 is sent to each newly registered account. The first string is the subject, and 
 the second string is the message body.
+In the body you can set a newline with the characters: <TT>~n</TT>.
 </DD><DT CLASS="dt-description"><B><TT>registration_watchers</TT></B></DT><DD CLASS="dd-description"> This option defines a 
 list of JIDs which will be notified each time a new account is registered.
 </DD><DT CLASS="dt-description"><B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies 
@@ -2413,7 +2414,7 @@ Also define a registration timeout of one hour:
   ...
   {mod_register,
    [
-    {welcome_message, {"Welcome!", "Welcome to this Jabber server. Check http://www.jabber.org"}},
+    {welcome_message, {"Welcome!", "Hi.~nWelcome to this Jabber server.~n Check http://www.jabber.org~n~nBye"}},
     {registration_watchers, ["admin1@example.org", "boss@example.net"]}
    ]},
   ...
index ab5b3d05b2372b5c13c24b94bbac780e793d2b8c..5a23a359acf2eb0977ecc0ab2c041ce4ccd4f15e 100644 (file)
@@ -3036,6 +3036,7 @@ Options:
 \titem{welcome\_message} \ind{options!welcomem}Set a welcome message that
   is sent to each newly registered account. The first string is the subject, and 
   the second string is the message body.
+  In the body you can set a newline with the characters: \term{\~\ n}.
 \titem{registration\_watchers} \ind{options!rwatchers}This option defines a 
   list of JIDs which will be notified each time a new account is registered.
 \iqdiscitem{In-Band Registration (\ns{jabber:iq:register})}
@@ -3094,7 +3095,7 @@ Also define a registration timeout of one hour:
   ...
   {mod_register,
    [
-    {welcome_message, {"Welcome!", "Welcome to this Jabber server. Check http://www.jabber.org"}},
+    {welcome_message, {"Welcome!", "Hi.~nWelcome to this Jabber server.~n Check http://www.jabber.org~n~nBye"}},
     {registration_watchers, ["admin1@example.org", "boss@example.net"]}
    ]},
   ...
index e1d63ed9ea5a716f420a10fa32e6cfe5238adba3..eb43bb3ca8a2e13d459e0f05653fc934b50a2b55 100644 (file)
                  %% a message with this subject and body.
                  %%
                  {welcome_message, {"Welcome!", 
-                                    "Welcome to this Jabber server."}},
+                                    "Hi.~nWelcome to this Jabber server."}},
 
                  %%
                  %% When a user registers, send a notification to 
index a936ea5e1a522df302063d09f7ee1c9857a4fc66..21080c8a249d3667b3793d34a5180866e710da39 100644 (file)
@@ -241,12 +241,13 @@ send_welcome_message(JID) ->
        {"", ""} ->
            ok;
        {Subj, Body} ->
+           BodyFormatted = io_lib:format(Body, []),
            ejabberd_router:route(
              jlib:make_jid("", Host, ""),
              JID,
              {xmlelement, "message", [{"type", "normal"}],
               [{xmlelement, "subject", [], [{xmlcdata, Subj}]},
-               {xmlelement, "body", [], [{xmlcdata, Body}]}]});
+               {xmlelement, "body", [], [{xmlcdata, BodyFormatted}]}]});
        _ ->
            ok
     end.