From 31d38dba148c19311c6b06c505110feaa0b0b8eb Mon Sep 17 00:00:00 2001
From: runemaster <>
Date: Sun, 12 Mar 2006 17:34:30 +0000
Subject: [PATCH] Make fully formed URI's clickable. i.e.;
 http://www.somedomeil.com/ https://www.somedomeil.com/
 telnet://www.somedomeil.com/ gopher://www.somedomeil.com/
 irc://www.somedomeil.com/

Does not currently sopport URI's that do not beging with protocol reference.
Also supports ports and sub-directories i.e.; http://www.somedomain.com:6080/docs/index.html
---
 web/lib/msgslib.ssjs   | 5 +++++
 web/root/msgs/msg.ssjs | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/web/lib/msgslib.ssjs b/web/lib/msgslib.ssjs
index f852ed3204..9c26a3c8e1 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 36f41dd1f8..838112b043 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) {
-- 
GitLab