aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2013-05-30 14:08:18 +0200
committerBadlop <badlop@process-one.net>2013-05-30 14:08:25 +0200
commitbc8264b2ac6cf58d267dc06bb0d45585d5d677d0 (patch)
tree882ed8aca6c509ff48f8e33c0487874a4692dd09
parentMerge pull request #42 from sezuan/2.1.x (diff)
Handle ~ control sequence in text of mod_muc_log (EJAB-1639)
-rw-r--r--src/mod_muc/mod_muc_log.erl7
1 files 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("<a id=\"~s\" name=\"~s\" href=\"#~s\" class=\"ts\">[~s]</a> ",
+ catch fw(F, io_lib:format("<a id=\"~s\" name=\"~s\" href=\"#~s\" class=\"ts\">[~s]</a> ",
[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) ->