diff options
author | Badlop <badlop@process-one.net> | 2011-11-22 23:11:21 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2011-12-08 12:40:04 +0100 |
commit | 48308042b6d88f4c1b574b7af7f2f17a59eafae8 (patch) | |
tree | bd3f4f15f6e0fc187834ee1c08364adec10f63e0 /src/mod_muc | |
parent | Frontend module to Re and Regexp (EJAB-921) (diff) |
Use the regexp frontend module (EJAB-921)
Diffstat (limited to 'src/mod_muc')
-rw-r--r-- | src/mod_muc/mod_muc_log.erl | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mod_muc/mod_muc_log.erl b/src/mod_muc/mod_muc_log.erl index 7560016a0..6cc4efff1 100644 --- a/src/mod_muc/mod_muc_log.erl +++ b/src/mod_muc/mod_muc_log.erl @@ -416,11 +416,11 @@ add_message_to_log(Nick1, Message, RoomJID, Opts, State) -> io_lib:format("<font class=\"msc\">~s~s~s</font><br/>", [Nick, ?T(" has set the subject to: "), htmlize(T,NoFollow,FileFormat)]); {body, T} -> - case {regexp:first_match(T, "^/me\s"), Nick} of + case {ejabberd_regexp:run(T, "^/me\s"), Nick} of {_, ""} -> io_lib:format("<font class=\"msm\">~s</font><br/>", [htmlize(T,NoFollow,FileFormat)]); - {{match, _, _}, _} -> + {match, _} -> io_lib:format("<font class=\"mne\">~s ~s</font><br/>", [Nick, string:substr(htmlize(T,FileFormat), 5)]); {nomatch, _} -> @@ -662,8 +662,7 @@ fw(F, S, O, FileFormat) -> html -> S1; plaintext -> - {ok, Res, _} = regexp:gsub(S1, "<[^>]*>", ""), - Res + ejabberd_regexp:greplace(S1, "<[^>]*>", "") end, io:format(F, S2, []). @@ -790,15 +789,15 @@ htmlize(S1, NoFollow, _FileFormat) -> S2_list). htmlize2(S1, NoFollow) -> - S2 = element(2, regexp:gsub(S1, "\\&", "\\&")), - S3 = element(2, regexp:gsub(S2, "<", "\\<")), - S4 = element(2, regexp:gsub(S3, ">", "\\>")), - S5 = element(2, regexp:gsub(S4, "((http|https|ftp)://|(mailto|xmpp):)[^] )\'\"}]+", - link_regexp(NoFollow))), + S2 = ejabberd_regexp:greplace(S1, "\\&", "\\&"), + S3 = ejabberd_regexp:greplace(S2, "<", "\\<"), + S4 = ejabberd_regexp:greplace(S3, ">", "\\>"), + S5 = ejabberd_regexp:greplace(S4, "((http|https|ftp)://|(mailto|xmpp):)[^] )\'\"}]+", + link_regexp(NoFollow)), %% Remove 'right-to-left override' unicode character 0x202e - S6 = element(2, regexp:gsub(S5, " ", "\\ \\ ")), - S7 = element(2, regexp:gsub(S6, "\\t", "\\ \\ \\ \\ ")), - element(2, regexp:gsub(S7, [226,128,174], "[RLO]")). + S6 = ejabberd_regexp:greplace(S5, " ", "\\ \\ "), + S7 = ejabberd_regexp:greplace(S6, "\\t", "\\ \\ \\ \\ "), + ejabberd_regexp:greplace(S7, [226,128,174], "[RLO]"). %% Regexp link %% Add the nofollow rel attribute when required |