# HG changeset patch # User Richard Laager # Date 1135226230 0 # Node ID 13599d978a31763e3c992e4488a9dcd99ec97a73 # Parent dc995f73c101e0fa78d2d85da7c5e98ce17ce3d4 [gaim-migrate @ 14956] SF Patch #1387727 from Dennis Lambe Jr. (malsyned) "When gaim_markup_strip_html removes HTML tags from log messages before writing them out, the contents of the href attribute of tags gets lost, even though that information is much more valuable than HTML formatting information and would be very useful to have in logs. This patch causes gaim_markup_strip_html, when confronted with a chunk of text that looks like this: Check out this great program I just found! to emit something like this: Check out this great program I just found!" committer: Tailor Script diff -r dc995f73c101 -r 13599d978a31 src/util.c --- a/src/util.c Thu Dec 22 04:21:30 2005 +0000 +++ b/src/util.c Thu Dec 22 04:37:10 2005 +0000 @@ -1254,6 +1254,8 @@ gboolean closing_td_p = FALSE; gchar *str2; const gchar *cdata_close_tag = NULL; + gchar *href = NULL; + int href_st = 0; if(!str) return NULL; @@ -1306,8 +1308,70 @@ k++; } + /* If we've got an tag with an href, save the address + * to print later. */ + if (strncasecmp(str2 + i, " with an ascii representation of the + * address the link was pointing to. */ + else if (href != NULL && strncasecmp(str2 + i, "", 4) == 0) + { + + size_t hrlen = strlen(href); + + /* Only insert the href if it's different from the CDATA. */ + if (hrlen != j - href_st || + strncmp(str2 + href_st, href, hrlen)) + { + str2[j++] = ' '; + str2[j++] = '<'; + g_memmove(str2 + j, href, hrlen); + j += hrlen; + str2[j++] = '>'; + g_free(href); + href = NULL; + } + } + /* Check for tags which should be mapped to newline */ - if (strncasecmp(str2 + i, "

", 3) == 0 + else if (strncasecmp(str2 + i, "

", 3) == 0 || strncasecmp(str2 + i, "