changeset 31484:3b8415185090

Accept broken URLs from third-party GG clients same as official GG. This patch is r1096 upstream, thanks to tomkiewicz again. Fixes #13886.
author Ethan Blanton <elb@pidgin.im>
date Sun, 01 May 2011 16:36:39 +0000
parents 039867991a51
children 81a2ec76c285
files ChangeLog libpurple/protocols/gg/lib/message.c
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 30 16:27:01 2011 +0000
+++ b/ChangeLog	Sun May 01 16:36:39 2011 +0000
@@ -51,6 +51,9 @@
 	  Wasilczyk) (#10268)
 	* Support XML events, resulting in immediate update of other users'
 	  buddy icons. (Tomasz Wasilczyk) (#13739)
+	* Accept poorly formatted URLs from other third-party clients in
+	  the same manner as the official client.  (Tomasz Wasilczyk)
+	  (#13886)
 
 	ICQ:
 	* Fix unsetting your mood when "None" is selected.  (Dustin Gathmann)
--- a/libpurple/protocols/gg/lib/message.c	Sat Apr 30 16:27:01 2011 +0000
+++ b/libpurple/protocols/gg/lib/message.c	Sun May 01 16:36:39 2011 +0000
@@ -361,7 +361,7 @@
  * \param src Dodawany tekst
  * \param len Długość dodawanego tekstu
  */
-static void gg_append(char *dst, int *pos, const void *src, int len)
+static void gg_append(char *dst, size_t *pos, const void *src, int len)
 {
 	if (dst != NULL)
 		memcpy(&dst[*pos], src, len);
@@ -394,7 +394,8 @@
 	int format_idx = 0;
 	unsigned char old_attr = 0;
 	const unsigned char *color = (const unsigned char*) "\x00\x00\x00";
-	int len, i;
+	int i;
+	size_t len;
 	const unsigned char *format_ = (const unsigned char*) format;
 
 	len = 0;
@@ -584,6 +585,11 @@
 	entity = NULL;
 
 	for (src = html; *src != 0; src++) {
+		if (in_entity && !(isalnum(*src) || *src == '#' || *src == ';')) {
+			in_entity = 0;
+			gg_append(dst, &len, entity, src - entity);
+		}
+
 		if (*src == '<') {
 			tag = src;
 			in_tag = 1;