Add a patch for enclosure support - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 95aca62b612422b95f0f2fff9c61268f9ab5872c
(DIR) parent fcd1226269822e13ff38e03be34a8993ea63e872
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 13 Apr 2019 21:16:48
Add a patch for enclosure support
Diffstat:
wip/sfeed-git/sfeed-enclosure.patch | 122 ++++++++++++++++++++++++++++++++++++
1 files changed, 122 insertions(+), 0 deletions(-)
---
diff -r fcd122626982 -r 95aca62b6124 wip/sfeed-git/sfeed-enclosure.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wip/sfeed-git/sfeed-enclosure.patch Sat Apr 13 21:16:48 2019 +0200
@@ -0,0 +1,122 @@
+$NetBSD$
+
+Add support for enclosure:
+
+ <gopher://codemadness.org/0/paste/sfeed-enclosure.patch>
+
+diff --git a/sfeed.1 b/sfeed.1
+index ca7f364..2c5b81e 100644
+--- sfeed.1.orig
++++ sfeed.1
+@@ -44,6 +44,8 @@ Content, can have plain-text or HTML code depending on the content-type field.
+ RSS item GUID or Atom id.
+ .It author
+ Item author.
++.It enclosure
++Item, first enclosure.
+ .El
+ .Sh SEE ALSO
+ .Xr sfeed_plain 1 ,
+diff --git a/sfeed.5 b/sfeed.5
+index 45ef577..4b4173c 100644
+--- sfeed.5.orig
++++ sfeed.5
+@@ -39,6 +39,8 @@ Content, can have plain-text or HTML code depending on the content-type field.
+ RSS item GUID or Atom id.
+ .It author
+ Item author.
++.It enclosure
++Item, first enclosure.
+ .El
+ .Sh SEE ALSO
+ .Xr sfeed 1 ,
+diff --git a/sfeed.c b/sfeed.c
+index 2f5830e..8c91a03 100644
+--- sfeed.c.orig
++++ sfeed.c
+@@ -48,6 +48,7 @@ enum TagId {
+ RSSTagGuid,
+ /* must be defined after GUID, because it can be a link (isPermaLink) */
+ RSSTagLink,
++ RSSTagEnclosure,
+ RSSTagAuthor, RSSTagDccreator,
+ /* Atom */
+ AtomTagUpdated, AtomTagPublished,
+@@ -56,6 +57,7 @@ enum TagId {
+ AtomTagId,
+ AtomTagLink,
+ AtomTagLinkAlternate,
++ AtomTagLinkEnclosure,
+ AtomTagAuthor,
+ TagLast
+ };
+@@ -73,7 +75,7 @@ typedef struct field {
+
+ enum {
+ FeedFieldTime = 0, FeedFieldTitle, FeedFieldLink, FeedFieldContent,
+- FeedFieldId, FeedFieldAuthor, FeedFieldLast
++ FeedFieldId, FeedFieldAuthor, FeedFieldEnclosure, FeedFieldLast
+ };
+
+ typedef struct feedcontext {
+@@ -122,6 +124,8 @@ static FeedTag rsstags[] = {
+ { STRP("dc:creator"), RSSTagDccreator },
+ { STRP("dc:date"), RSSTagDcdate },
+ { STRP("description"), RSSTagDescription },
++ /* RSS: <enclosure url="" />, Atom has <link rel="enclosure" /> */
++ { STRP("enclosure"), RSSTagEnclosure },
+ { STRP("guid"), RSSTagGuid },
+ { STRP("link"), RSSTagLink },
+ { STRP("media:description"), RSSTagMediaDescription },
+@@ -156,6 +160,7 @@ static int fieldmap[TagLast] = {
+ [RSSTagContentEncoded] = FeedFieldContent,
+ [RSSTagGuid] = FeedFieldId,
+ [RSSTagLink] = FeedFieldLink,
++ [RSSTagEnclosure] = FeedFieldEnclosure,
+ [RSSTagAuthor] = FeedFieldAuthor,
+ [RSSTagDccreator] = FeedFieldAuthor,
+ /* Atom */
+@@ -168,6 +173,7 @@ static int fieldmap[TagLast] = {
+ [AtomTagId] = FeedFieldId,
+ [AtomTagLink] = -1,
+ [AtomTagLinkAlternate] = FeedFieldLink,
++ [AtomTagLinkEnclosure] = FeedFieldEnclosure,
+ [AtomTagAuthor] = FeedFieldAuthor
+ };
+
+@@ -593,6 +599,8 @@ printfields(void)
+ string_print_trimmed(&ctx.fields[FeedFieldId].str);
+ putchar(FieldSeparator);
+ string_print_trimmed(&ctx.fields[FeedFieldAuthor].str);
++ putchar(FieldSeparator);
++ string_print_uri(&ctx.fields[FeedFieldEnclosure].str);
+ putchar('\n');
+ }
+
+@@ -620,10 +628,13 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
+ }
+
+ if (ctx.feedtype == FeedTypeRSS) {
+- if (ctx.tagid == RSSTagGuid) {
+- if (isattr(n, nl, STRP("ispermalink")) &&
+- !isattr(v, vl, STRP("true")))
+- rssidpermalink = 0;
++ if (ctx.tagid == RSSTagEnclosure &&
++ isattr(n, nl, STRP("url")) && ctx.field) {
++ string_append(ctx.field, v, vl);
++ } else if (ctx.tagid == RSSTagGuid &&
++ isattr(n, nl, STRP("ispermalink")) &&
++ !isattr(v, vl, STRP("true"))) {
++ rssidpermalink = 0;
+ }
+ } else if (ctx.feedtype == FeedTypeAtom) {
+ if (ISCONTENTTAG(ctx)) {
+@@ -641,6 +652,8 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
+ "enclosure", "related", "self" or "via" */
+ if (!vl || isattr(v, vl, STRP("alternate")))
+ atomlinktype = AtomTagLinkAlternate;
++ else if (isattr(v, vl, STRP("enclosure")))
++ atomlinktype = AtomTagLinkEnclosure;
+ else
+ atomlinktype = TagUnknown;
+ } else if (ctx.tagid == AtomTagLink &&