From ba5851b4f7f719f4297a927940bf191d1a09568c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 27 Aug 2018 14:39:17 -0400 Subject: [PATCH] RSS feed reader now accepts as a substitute for if the latter is not present. --- citadel/modules/rssclient/serv_rssclient.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 0b89a9563..250e1ecdd 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -1,7 +1,9 @@ /* - * Bring external RSS feeds into rooms. + * Bring external RSS and/or Atom feeds into rooms. This module implements a + * very loose parser that scrapes both kinds of feeds and is not picky about + * the standards compliance of the source data. * - * Copyright (c) 2007-2017 by the citadel.org team + * Copyright (c) 2007-2018 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -205,13 +207,20 @@ void rss_end_element(void *data, const char *el) } } - else if (!strcasecmp(el, "author")) { // author of item (rss and maybe atom) + else if (!strcasecmp(el, "creator")) { // can be used if is not present if ((r->msg != NULL) && (CM_IsEmpty(r->msg, eAuthor))) { CM_SetField(r->msg, eAuthor, ChrPtr(r->CData), StrLength(r->CData)); striplt(r->msg->cm_fields[eAuthor]); } } + else if (!strcasecmp(el, "author")) { // supercedes if both are present + if (r->msg != NULL) { + CM_SetField(r->msg, eAuthor, ChrPtr(r->CData), StrLength(r->CData)); // CM_SetField will free() the previous value + striplt(r->msg->cm_fields[eAuthor]); + } + } + else if (!strcasecmp(el, "pubdate")) { // date/time stamp (rss) Sat, 25 Feb 2017 14:28:01 EST if ((r->msg)&&(r->msg->cm_fields[eTimestamp]==NULL)) { CM_SetFieldLONG(r->msg, eTimestamp, parsedate(ChrPtr(r->CData))); -- 2.30.2