From 1f004c56ac17d454575ec0956272246827b1d419 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 9 Jul 2008 17:53:56 +0000 Subject: [PATCH] * 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 SVN Revision: 1425 --- ChangeLog | 5 +++++ doc/guide.html | 5 +++-- doc/guide.tex | 3 ++- src/ejabberd.cfg.example | 2 +- src/mod_register.erl | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 460204a42..49afcbbfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-07-09 Badlop + * 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) diff --git a/doc/guide.html b/doc/guide.html index bbb0fbf16..b7f10839b 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -2113,7 +2113,7 @@ Chatroom details are added on top of each page: room title, JID, author, subject and configuration.
  • The room JID in the generated HTML is a link to join the chatroom (using -XMPP URI). +XMPP URI).
  • Subject and chatroom configuration changes are tracked and displayed.
  • Joins, leaves, nick changes, kicks, bans and ‘/me’ are tracked and displayed, including the reason if available. @@ -2363,6 +2363,7 @@ restrictions by default).
    welcome_message
    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: ~n.
    registration_watchers
    This option defines a list of JIDs which will be notified each time a new account is registered.
    iqdisc
    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"]} ]}, ... diff --git a/doc/guide.tex b/doc/guide.tex index ab5b3d05b..5a23a359a 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -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"]} ]}, ... diff --git a/src/ejabberd.cfg.example b/src/ejabberd.cfg.example index e1d63ed9e..eb43bb3ca 100644 --- a/src/ejabberd.cfg.example +++ b/src/ejabberd.cfg.example @@ -459,7 +459,7 @@ %% 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 diff --git a/src/mod_register.erl b/src/mod_register.erl index a936ea5e1..21080c8a2 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -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.