aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-05-19 20:46:43 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-05-19 20:46:43 +0100
commit0b3ffb13172c211eed561288d0fd04d76506bb02 (patch)
tree61b10a04029a860cdea017b6a31c479c27f06491
parent2334048eaa9ab26fcdab781dbfb1bacb1c01ba8d (diff)
Setting the HTML flag on a connection has a nasty side effect of escaping
a lot of "special" characters, and these HTML entities are not counted as one character. :-( So just strip HTML of incoming stuff and don't do anything with what goes out. It's not required. The story may actually be more complicated this, let's find out.
-rw-r--r--lib/misc.c5
-rw-r--r--protocols/twitter/twitter.c1
-rw-r--r--protocols/twitter/twitter_lib.c3
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/misc.c b/lib/misc.c
index c56b31f3..d77972e3 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -153,11 +153,11 @@ static const htmlentity_t ent[] =
void strip_html( char *in )
{
char *start = in;
- char *out = g_malloc( strlen( in ) + 1 );
+ char out[strlen(in)+1];
char *s = out, *cs;
int i, matched;
- memset( out, 0, strlen( in ) + 1 );
+ memset( out, 0, sizeof( out ) );
while( *in )
{
@@ -219,7 +219,6 @@ void strip_html( char *in )
}
strcpy( start, out );
- g_free( out );
}
char *escape_html( const char *html )
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 98e85641..a9b38a2f 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -179,7 +179,6 @@ static void twitter_login( account_t *acc )
twitter_connections = g_slist_append( twitter_connections, ic );
ic->proto_data = td;
- ic->flags |= OPT_DOES_HTML;
td->user = acc->user;
if( !set_getbool( &acc->set, "oauth" ) )
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index ee6e39fe..3becc67e 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -433,6 +433,8 @@ static void twitter_groupchat(struct im_connection *ic, GSList *list)
status = l->data;
twitter_add_buddy(ic, status->user->screen_name, status->user->name);
+ strip_html(status->text);
+
// Say it!
if (g_strcasecmp(td->user, status->user->screen_name) == 0)
imcb_chat_log (gc, "Your Tweet: %s", status->text);
@@ -470,6 +472,7 @@ static void twitter_private_message_chat(struct im_connection *ic, GSList *list)
status = l->data;
+ strip_html( status->text );
if( mode_one )
text = g_strdup_printf( "\002<\002%s\002>\002 %s",
status->user->screen_name, status->text );