diff options
author | Badlop <badlop@process-one.net> | 2013-05-30 14:28:39 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2013-05-30 14:28:39 +0200 |
commit | 3025bfd3ffbb520a14924f854884a74f99644bad (patch) | |
tree | a64ea23e058bb847cf895abd48cd52b0556d9adc /src/mod_muc/mod_muc_log.erl | |
parent | Merge pull request #69 from PaulSD/master (diff) |
Handle ~ control sequence in text of mod_muc_log (EJAB-1639)
Diffstat (limited to 'src/mod_muc/mod_muc_log.erl')
-rw-r--r-- | src/mod_muc/mod_muc_log.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mod_muc/mod_muc_log.erl b/src/mod_muc/mod_muc_log.erl index ee9eb7a9d..95b25d6a7 100644 --- a/src/mod_muc/mod_muc_log.erl +++ b/src/mod_muc/mod_muc_log.erl @@ -54,6 +54,7 @@ -define(PROCNAME, ejabberd_mod_muc_log). -record(room, {jid, title, subject, subject_author, config}). +-define(PLAINTEXT_CO, <<"ZZCZZ">>). -define(PLAINTEXT_IN, <<"ZZIZZ">>). -define(PLAINTEXT_OUT, <<"ZZOZZ">>). @@ -497,7 +498,7 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, {_, _, Microsecs} = Now, STimeUnique = io_lib:format("~s.~w", [STime, Microsecs]), - fw(F, + catch fw(F, list_to_binary( io_lib:format("<a id=\"~s\" name=\"~s\" href=\"#~s\" " "class=\"ts\">[~s]</a> ", @@ -765,7 +766,8 @@ fw(F, S, O, FileFormat) -> html -> S1; plaintext -> - S1x = ejabberd_regexp:greplace(S1, <<"<[^<^>]*>">>, <<"">>), + S1a = ejabberd_regexp:greplace(S1, <<"<[^<^>]*>">>, <<"">>), + S1x = ejabberd_regexp:greplace(S1a, ?PLAINTEXT_CO, <<"~~">>), S1y = ejabberd_regexp:greplace(S1x, ?PLAINTEXT_IN, <<"<">>), ejabberd_regexp:greplace(S1y, ?PLAINTEXT_OUT, <<">">>) end, @@ -967,13 +969,15 @@ put_room_occupants(F, RoomOccupants, Lang, htmlize(S1) -> htmlize(S1, html). -htmlize(S1, plaintext) -> S1; +htmlize(S1, plaintext) -> + ejabberd_regexp:greplace(S1, <<"~">>, ?PLAINTEXT_CO); 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:greplace(S0, <<"~">>, ?PLAINTEXT_CO), S1x = ejabberd_regexp:replace(S1, <<"<">>, ?PLAINTEXT_IN), ejabberd_regexp:replace(S1x, <<">">>, ?PLAINTEXT_OUT); htmlize(S1, NoFollow, _FileFormat) -> |