projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dc48bee
)
RSS feed reader now accepts <creator> as a substitute for <author> if the latter...
author
Art Cancro
<ajc@citadel.org>
Mon, 27 Aug 2018 18:39:17 +0000
(14:39 -0400)
committer
Art Cancro
<ajc@citadel.org>
Mon, 27 Aug 2018 18:39:17 +0000
(14:39 -0400)
citadel/modules/rssclient/serv_rssclient.c
patch
|
blob
|
history
diff --git
a/citadel/modules/rssclient/serv_rssclient.c
b/citadel/modules/rssclient/serv_rssclient.c
index 0b89a9563ac5c4f011321a8dbd82db4ceb0ef402..250e1ecdd436bef27e2f40f925a552f9943beede 100644
(file)
--- 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-201
7
by the citadel.org team
+ * Copyright (c) 2007-201
8
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.
*
* 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")) { // <creator> can be used if <author> 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]);
}
}
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)));