- * 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.
*
* 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.
*
* 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.
else {
CtdlSaveMsgPointerInRoom(rr->room, msgnum, 0, NULL);
}
else {
CtdlSaveMsgPointerInRoom(rr->room, msgnum, 0, NULL);
}
- syslog(LOG_DEBUG, "Saved message %ld to %s", msgnum, rr->room);
+ syslog(LOG_DEBUG, "rssclient: saved message %ld to %s", msgnum, rr->room);
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]);
}
}
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")) { // <author> supercedes <creator> 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)));
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)));
- syslog(LOG_DEBUG, "rssclient_push_todo(%s, %s)", rssurl, roomname);
+ syslog(LOG_DEBUG, "rssclient: will fetch %s to %s", rssurl, roomname);
for (r=rsstodo; r!=NULL; r=r->next) {
if (!strcasecmp(r->url, rssurl)) {
for (r=rsstodo; r!=NULL; r=r->next) {
if (!strcasecmp(r->url, rssurl)) {
Downloaded = NewStrBuf();
curl_easy_setopt(curl, CURLOPT_URL, url->url);
Downloaded = NewStrBuf();
curl_easy_setopt(curl, CURLOPT_URL, url->url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // Follow redirects
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlFillStrBuf_callback); // What to do with downloaded data
curl_easy_setopt(curl, CURLOPT_WRITEDATA, Downloaded); // Give it our StrBuf to work with
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L); // Time out after 20 seconds
res = curl_easy_perform(curl); // Perform the request
if (res != CURLE_OK) {
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // Follow redirects
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlFillStrBuf_callback); // What to do with downloaded data
curl_easy_setopt(curl, CURLOPT_WRITEDATA, Downloaded); // Give it our StrBuf to work with
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L); // Time out after 20 seconds
res = curl_easy_perform(curl); // Perform the request
if (res != CURLE_OK) {