Fix for GaimLog.Striptags()
- From: Arun Raghavan <arunissatan yahoo com>
- To: dashboard-hackers gnome org
- Subject: Fix for GaimLog.Striptags()
- Date: Wed, 22 Sep 2004 00:39:37 -0700 (PDT)
Hi,
The GaimLog.StripTags() method loops forever if a line in the log has a
"<" that isn't matched by a ">". Here's a one-liner to fix this - it
retains the rest of the line starting at the unmatched "<".
One concern here is that we're ignoring everthing in between "<" and
">", which is not good. A line like:
------------------------
dude1: e < mc^2+1. I *really* want the text here indexed. e > mc^2+1
dude2: Cool! I want that indexed too!
------------------------
would be reduced to:
------------------------
dude1: e mc^2+1
dude2: Cool! I want that indexed too! But I can't. I'm so unhappy.
------------------------
Maybe a patch to Gaim to write "<" and ">" when input by the user as
"<" and ">" would be good. Any foreseeable objections from the
Gaim folks?
Whee! Hackfest!
Arun
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
? beagle.spec
Index: Util/ImLog.cs
===================================================================
RCS file: /cvs/gnome/beagle/Util/ImLog.cs,v
retrieving revision 1.5
diff -u -r1.5 ImLog.cs
--- Util/ImLog.cs 17 Sep 2004 16:34:06 -0000 1.5
+++ Util/ImLog.cs 22 Sep 2004 07:23:03 -0000
@@ -145,6 +145,12 @@
if (i == -1)
break;
j = line.IndexOf ('>', i);
+
+ // If a "<" is unmatched, preserve it, and the
+ // rest of the line
+ if(j == -1)
+ break;
+
line = line.Substring (0, i) + line.Substring (j+1);
}
return line;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]