From bc8264b2ac6cf58d267dc06bb0d45585d5d677d0 Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 30 May 2013 14:08:18 +0200 Subject: [PATCH] Handle ~ control sequence in text of mod_muc_log (EJAB-1639) --- src/mod_muc/mod_muc_log.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod_muc/mod_muc_log.erl b/src/mod_muc/mod_muc_log.erl index 27f1340dc..7f45bd416 100644 --- a/src/mod_muc/mod_muc_log.erl +++ b/src/mod_muc/mod_muc_log.erl @@ -455,7 +455,7 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, State) -> STimeUnique = io_lib:format("~s.~w", [STime, Microsecs]), %% Write message - fw(F, io_lib:format("[~s] ", + catch fw(F, io_lib:format("[~s] ", [STimeUnique, STimeUnique, STimeUnique, STime]) ++ Text, FileFormat), %% Close file @@ -787,13 +787,14 @@ htmlize(S1) -> htmlize(S1, html). htmlize(S1, plaintext) -> - S1; + ejabberd_regexp:replace(S1, "~", "~~"); htmlize(S1, FileFormat) -> htmlize(S1, false, FileFormat). %% The NoFollow parameter tell if the spam prevention should be applied to the link found %% true means 'apply nofollow on links'. -htmlize(S1, _NoFollow, plaintext) -> +htmlize(S0, _NoFollow, plaintext) -> + S1 = ejabberd_regexp:replace(S0, "~", "~~"), S1x = ejabberd_regexp:replace(S1, "<", ?PLAINTEXT_IN), ejabberd_regexp:replace(S1x, ">", ?PLAINTEXT_OUT); htmlize(S1, NoFollow, _FileFormat) ->