SPARK-285 link-2-text filter matches too much URL's or text which looks like an URL

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4628 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2006-07-20 22:36:29 +00:00
committed by derek
parent ea831b5c9d
commit 658330cb12

View File

@ -178,7 +178,7 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis
setCursor(HAND_CURSOR);
// Make sure the message is not null.
message = message.trim();
// message = message.trim();
message = message.replaceAll("/\"", "");
if (ModelUtil.hasLength(message)) {
try {
@ -225,11 +225,11 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis
boolean underlined = false;
StringTokenizer t = new StringTokenizer(text, " \n", true);
while (t.hasMoreTokens()) {
String textFound = t.nextToken();
final StringTokenizer tokenizer = new StringTokenizer(text, " \n \tokenizer", true);
while (tokenizer.hasMoreTokens()) {
String textFound = tokenizer.nextToken();
if (textFound.startsWith("http://") || textFound.startsWith("ftp://")
|| textFound.startsWith("https://") || textFound.startsWith("www") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) {
|| textFound.startsWith("https://") || textFound.startsWith("www.") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) {
insertLink(textFound);
}
else if (!insertImage(textFound)) {