this patch tries to fix:
   1.  don't parse html commands
   2.  mailto:[EMAIL PROTECTED]  display

testcase:
1.
--BEGIN MESSAGE--
<b> bold! </b>
--END   MESSAGE--
2.
--BEGIN MESSAGE--
hello [EMAIL PROTECTED]
--END   MESSAGE--

-- 
Buenos Aires, Argentina                           12°C with winds at 16 km/h W




Index: plugins/qt-gui/src/mlview3.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/mlview3.cpp,v
retrieving revision 1.15
diff -u -d -p -r1.15 mlview3.cpp
--- plugins/qt-gui/src/mlview3.cpp	2 Jul 2003 04:41:02 -0000	1.15
+++ plugins/qt-gui/src/mlview3.cpp	29 Jul 2003 06:20:48 -0000
@@ -80,10 +80,14 @@ QString MLView::toRichText(const QString
   // not used for html now QString text = QStyleSheet::escape(s);
   QString text = s;
 
+  // prevent html commands
+  text.replace("<", "&lt;");
+  text.replace(">", "&gt;");
+  
   // We must hightlight URLs at this step, before we convert
   // linebreaks to richtext tags and such.  Also, check to make sure
   // that the text is not prepared to be highlighted already (by AIM).
-  QRegExp reAHREF("<a href", false);
+  QRegExp reAHREF("&lt;a href", false);
   int pos = 0;
   if (highlightURLs && (pos = text.find(reAHREF, pos)) == -1)
   {
@@ -103,8 +107,8 @@ QString MLView::toRichText(const QString
      while ( (pos = text.find(reMail, pos)) != -1 ) {
         QString mail = reMail.cap(2);
         QString link = QString::fromLatin1("<a href=\"mailto:";) + mail + QString::fromLatin1("\">") + mail + QString::fromLatin1("</a>");
-        text.replace(pos, mail.length(), link);
-        pos += reMail.matchedLength() - mail.length() + link.length();
+        text.replace(pos, mail.length() + reMail.cap(1).length(), link);
+        pos += mail.length() + reMail.cap(1).length();
      }
 
   }
@@ -123,7 +127,7 @@ QString MLView::toRichText(const QString
      text.replace(pos+1, longSpaces.matchedLength()-1, cap);
   }
   text.replace(QRegExp("\t"), " &nbsp;&nbsp;&nbsp;");
-
+  
   return text;
 }
 

Attachment: pgp00000.pgp
Description: signature

Reply via email to