pidgin: 113d4df2: Accept broken URLs from third-party GG c...

elb at pidgin.im elb at pidgin.im
Sun May 1 12:41:42 EDT 2011


----------------------------------------------------------------------
Revision: 113d4df2492ccaf3df6b9a5afdf75ded1b7a9783
Parent:   b57428af52edd804dcbdb1fe2770b7d63226ad27
Author:   elb at pidgin.im
Date:     05/01/11 12:36:39
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/113d4df2492ccaf3df6b9a5afdf75ded1b7a9783

Changelog: 

Accept broken URLs from third-party GG clients same as official GG.

This patch is r1096 upstream, thanks to tomkiewicz again.

Fixes #13886.

Changes against parent b57428af52edd804dcbdb1fe2770b7d63226ad27

  patched  ChangeLog
  patched  libpurple/protocols/gg/lib/message.c

-------------- next part --------------
============================================================
--- ChangeLog	6414d849e04e249cfad513869454cf590f74ec0f
+++ ChangeLog	230323c046f63f8a9a570e6ce6714ce890bcabd0
@@ -51,6 +51,9 @@ version 2.8.0 (??/??/????):
 	  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)
============================================================
--- libpurple/protocols/gg/lib/message.c	43899d1df984e1842ae7762f3bb319322aec4b7e
+++ libpurple/protocols/gg/lib/message.c	e1995d0acaf16be38cd60e4dc70e42630809188d
@@ -361,7 +361,7 @@ int gg_message_get_attributes(gg_message
  * \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 @@ size_t gg_message_text_to_html(char *dst
 	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 @@ size_t gg_message_html_to_text(char *dst
 	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;


More information about the Commits mailing list