[sylpheed:34265] patch: display yahoo attachments hrefs

Rich Coe Richard.Coe at med.ge.com
Thu Oct 21 07:51:48 JST 2010


I'm on a yahoo originated mailing list, and when a user sends an email
with attachments, yahoo strips them off the email and stores them on the
yahoo server, and adds links to the original.

The link is of the following form, line spacing added clarity:
<a style="text-decoration: none;" 
    href="http://xa.yimg.com/kq/groups/[...]/[...]/name/Long%20Filename%2Edoc"
    title="Long Filename.doc">Long Filename.doc</a>

In libsylph/html.c, the parser only looks for href as the first attribute
in the tag.  The following patch looks at every attribute in the tag for
'href' and makes the anchor link clickable.

Index: libsylph/html.c
===================================================================
--- libsylph/html.c     (revision 2688)
+++ libsylph/html.c     (working copy)
@@ -472,12 +472,15 @@
                html_append_char(parser, '\n');
                parser->state = HTML_BR;
        } else if (!strcmp(tag->name, "a")) {
-               if (tag->attr && tag->attr->data &&
-                   !strcmp(((HTMLAttr *)tag->attr->data)->name, "href")) {
+               GList *attrl = tag->attr;
+               while (attrl) {
+                   if (attrl->data && !strcmp(((HTMLAttr *)attrl->data)->name, "href")) {
                        g_free(parser->href);
-                       parser->href =
-                               g_strdup(((HTMLAttr *)tag->attr->data)->value);
+                       parser->href = g_strdup(((HTMLAttr *)attrl->data)->value);
                        parser->state = HTML_HREF;
+                       break;
+                   }
+                   attrl = g_list_next(attrl);
                }
        } else if (!strcmp(tag->name, "/a")) {
                g_free(parser->href);

-- 


More information about the Sylpheed mailing list