diff --git a/web/lib/msgslib.ssjs b/web/lib/msgslib.ssjs index f852ed320492a789662144127a61f30c59a88288..9c26a3c8e1634d7d4e8b820515bbdf7b0be4a0ae 100644 --- a/web/lib/msgslib.ssjs +++ b/web/lib/msgslib.ssjs @@ -181,3 +181,8 @@ function idx_to_user(fromidx) } return(istouser); } + +function make_links(str) { + var str_link=str.replace(/((http|https|ftp|telnet|gopher|irc)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\/\\\+&%\$#\=~]*))/gi,'<a href="$1" target="_blank">$1</a>'); + return(str_link) +} diff --git a/web/root/msgs/msg.ssjs b/web/root/msgs/msg.ssjs index 36f41dd1f8c42737d87aeb7b96dd4faeb8a07ad2..838112b043af85482430699c2bd0fa89949e7b6a 100644 --- a/web/root/msgs/msg.ssjs +++ b/web/root/msgs/msg.ssjs @@ -109,11 +109,13 @@ if(msg.type=="plain") { /* ANSI */ if(template.body.indexOf('\x1b[')>=0 || template.body.indexOf('\x01')>=0) { template.body=html_encode(template.body,true,false,true,true); + template.body=make_links(template.body); } /* Plain text */ else { - template.body=word_wrap(template.body); + template.body=word_wrap(template.body,80); template.body=html_encode(template.body,true,false,false,false); + template.body=make_links(template.body); } } if(msg.attachments!=undefined) {