aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-04-16 20:57:30 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-04-16 20:57:30 -0700
commit717e3bf045e5ebfb9b71e9260c8e573daefa7900 (patch)
treebf91ff0ddd796508ea2bda34ef07c13efcf8c3a4
parentb3cae44de28b62a282f2ba32260048174abc83e7 (diff)
Hopefully improved Yahoo! "markup" stripping.
-rw-r--r--protocols/yahoo/yahoo.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index 6f6590df..aad9d2df 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -70,7 +70,7 @@ static char *byahoo_strip( const char *in )
{
int len;
- /* This should get rid of HTML tags at the beginning of the string. */
+ /* This should get rid of the markup noise at the beginning of the string. */
while( *in )
{
if( g_strncasecmp( in, "<font", 5 ) == 0 ||
@@ -100,17 +100,23 @@ static char *byahoo_strip( const char *in )
}
}
- /* This is supposed to get rid of the closing HTML tags at the end of the line. */
+ /* This is supposed to get rid of the noise at the end of the line. */
len = strlen( in );
- while( len > 0 && in[len-1] == '>' )
+ while( len > 0 && ( in[len-1] == '>' || in[len-1] == 'm' ) )
{
int blen = len;
+ const char *search;
- len --;
- while( len > 0 && ( in[len] != '<' || in[len+1] != '/' ) )
+ if( in[len-1] == '>' )
+ search = "</";
+ else
+ search = "\e[";
+
+ len -= 3;
+ while( len > 0 && strncmp( in + len, search, 2 ) != 0 )
len --;
- if( len == 0 && ( in[len] != '<' || in[len+1] != '/' ) )
+ if( len <= 0 && strncmp( in, search, 2 ) != 0 )
{
len = blen;
break;