25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

* src/mod_muc/mod_muc_log.erl: Fix XHTML compliance: ensure some

language is set, include ID attribute in each message, add
microseconds to ensure unique value (EJAB-497)

SVN Revision: 1426
This commit is contained in:
Badlop 2008-07-09 18:39:41 +00:00
parent 1f004c56ac
commit fc911a43ff
2 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,9 @@
2008-07-09 Badlop <badlop@process-one.net>
* src/mod_muc/mod_muc_log.erl: Fix XHTML compliance: ensure some
language is set, include ID attribute in each message, add
microseconds to ensure unique value (EJAB-497)
* 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

View File

@ -120,9 +120,11 @@ init([Host, Opts]) ->
NoFollow = gen_mod:get_opt(spam_prevention, Opts, true),
Lang = case ejabberd_config:get_local_option({language, Host}) of
undefined ->
"";
L ->
L
case ejabberd_config:get_global_option(language) of
undefined -> "en";
L -> L
end;
L -> L
end,
{ok, #state{host = Host,
out_dir = OutDir,
@ -286,9 +288,10 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, State) ->
top_link = TopLink} = State,
Room = get_room_info(RoomJID, Opts),
Now = now(),
TimeStamp = case Timezone of
local -> calendar:now_to_local_time(now());
universal -> calendar:now_to_universal_time(now())
local -> calendar:now_to_local_time(Now);
universal -> calendar:now_to_universal_time(Now)
end,
{Fd, Fn, _Dir} = build_filename_string(TimeStamp, OutDir, Room#room.jid, DirType),
{Date, Time} = TimeStamp,
@ -382,10 +385,12 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, State) ->
{Hour, Minute, Second} = Time,
STime = lists:flatten(
io_lib:format("~2..0w:~2..0w:~2..0w", [Hour, Minute, Second])),
{_, _, Microsecs} = Now,
STimeUnique = io_lib:format("~s.~w", [STime, Microsecs]),
% Write message
file:write(F, io_lib:format("<a name=\"~s\" href=\"#~s\" class=\"ts\">[~s]</a> ~s~n",
[STime, STime, STime, Text])),
file:write(F, io_lib:format("<a id=\"~s\" name=\"~s\" href=\"#~s\" class=\"ts\">[~s]</a> ~s~n",
[STimeUnique, STimeUnique, STimeUnique, STime, Text])),
% Close file
file:close(F),