2 * Bring external RSS feeds into rooms.
4 * Copyright (c) 2007-2010 by the citadel.org team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #if TIME_WITH_SYS_TIME
26 # include <sys/time.h>
30 # include <sys/time.h>
39 #include <sys/types.h>
42 #include <curl/curl.h>
43 #include <libcitadel.h>
46 #include "citserver.h"
50 #include "ctdl_module.h"
51 #include "clientsocket.h"
53 #include "parsedate.h"
55 #include "citadel_dirs.h"
58 #include "event_client.h"
59 #include "rss_atom_parser.h"
61 extern pthread_mutex_t RSSQueueMutex;
63 HashList *StartHandlers = NULL;
64 HashList *EndHandlers = NULL;
65 HashList *KnownNameSpaces = NULL;
66 void AddRSSStartHandler(rss_handler_func Handler, int Flags, const char *key, long len)
69 h = (rss_xml_handler*) malloc(sizeof (rss_xml_handler));
72 Put(StartHandlers, key, len, h, NULL);
74 void AddRSSEndHandler(rss_handler_func Handler, int Flags, const char *key, long len)
77 h = (rss_xml_handler*) malloc(sizeof (rss_xml_handler));
80 Put(EndHandlers, key, len, h, NULL);
86 * Convert an RDF/RSS datestamp into a time_t
88 time_t rdf_parsedate(const char *p)
94 if (strlen(p) < 10) return 0L;
96 memset(&tm, 0, sizeof tm);
99 * If the timestamp appears to be in W3C datetime format, try to
100 * parse it. See also: http://www.w3.org/TR/NOTE-datetime
102 * This code, along with parsedate.c, is a potential candidate for
103 * moving into libcitadel.
105 if ( (p[4] == '-') && (p[7] == '-') ) {
106 tm.tm_year = atoi(&p[0]) - 1900;
107 tm.tm_mon = atoi(&p[5]) - 1;
108 tm.tm_mday = atoi(&p[8]);
109 if ( (p[10] == 'T') && (p[13] == ':') ) {
110 tm.tm_hour = atoi(&p[11]);
111 tm.tm_min = atoi(&p[14]);
116 /* hmm... try RFC822 date stamp format */
119 if (t > 0) return(t);
121 /* yeesh. ok, just return the current date and time. */
125 void flush_rss_item(rss_item *ri)
127 /* Initialize the feed item data structure */
128 FreeStrBuf(&ri->guid);
129 FreeStrBuf(&ri->title);
130 FreeStrBuf(&ri->link);
131 FreeStrBuf(&ri->author_or_creator);
132 FreeStrBuf(&ri->author_email);
133 FreeStrBuf(&ri->author_url);
134 FreeStrBuf(&ri->description);
137 void rss_xml_start(void *data, const char *supplied_el, const char **attr)
140 rss_aggregator *rssc = (rss_aggregator*) data;
141 rss_item *ri = rssc->Item;
146 /* Axe the namespace, we don't care about it */
147 /// CtdlLogPrintf(0, "RSS: supplied el %d: %s...\n", rssc->Cfg->ItemType, supplied_el);
149 while (sep = strchr(pel, ':'), sep) {
153 if (pel != supplied_el)
157 if (!GetHash(KnownNameSpaces,
159 pel - supplied_el - 1,
163 CtdlLogPrintf(0, "RSS: START ignoring because of wrong namespace [%s] = [%s]\n",
170 StrBufPlain(rssc->Key, pel, -1);
171 StrBufLowerCase(rssc->Key);
172 if (GetHash(StartHandlers, SKEY(rssc->Key), &pv))
174 rssc->Current = h = (rss_xml_handler*) pv;
176 if (((h->Flags & RSS_UNSET) != 0) &&
177 (rssc->ItemType == RSS_UNSET))
179 h->Handler(rssc->CData, ri, rssc, attr);
181 else if (((h->Flags & RSS_RSS) != 0) &&
182 (rssc->ItemType == RSS_RSS))
184 h->Handler(rssc->CData, ri, rssc, attr);
186 else if (((h->Flags & RSS_ATOM) != 0) &&
187 (rssc->ItemType == RSS_ATOM))
189 h->Handler(rssc->CData, ri, rssc, attr);
193 CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el);
198 CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el);
202 void rss_xml_end(void *data, const char *supplied_el)
205 rss_aggregator *rssc = (rss_aggregator*) data;
206 rss_item *ri = rssc->Item;
211 /* Axe the namespace, we don't care about it */
213 while (sep = strchr(pel, ':'), sep) {
216 // CtdlLogPrintf(0, "RSS: END %s...\n", el);
217 if (pel != supplied_el)
221 if (!GetHash(KnownNameSpaces,
223 pel - supplied_el - 1,
227 CtdlLogPrintf(0, "RSS: END ignoring because of wrong namespace [%s] = [%s]\n",
228 supplied_el, ChrPtr(rssc->CData));
230 FlushStrBuf(rssc->CData);
235 StrBufPlain(rssc->Key, pel, -1);
236 StrBufLowerCase(rssc->Key);
237 if (GetHash(EndHandlers, SKEY(rssc->Key), &pv))
239 h = (rss_xml_handler*) pv;
241 if (((h->Flags & RSS_UNSET) != 0) &&
242 (rssc->ItemType == RSS_UNSET))
244 h->Handler(rssc->CData, ri, rssc, NULL);
246 else if (((h->Flags & RSS_RSS) != 0) &&
247 (rssc->ItemType == RSS_RSS))
249 h->Handler(rssc->CData, ri, rssc, NULL);
251 else if (((h->Flags & RSS_ATOM) != 0) &&
252 (rssc->ItemType == RSS_ATOM))
254 h->Handler(rssc->CData, ri, rssc, NULL);
258 CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData));
263 CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData));
265 FlushStrBuf(rssc->CData);
266 rssc->Current = NULL;
273 void RSS_item_rss_start (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
275 syslog(LOG_DEBUG, "RSS: This is an RSS feed.\n");
276 Cfg->ItemType = RSS_RSS;
279 void RSS_item_rdf_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
281 syslog(LOG_DEBUG, "RSS: This is an RDF feed.\n");
282 Cfg->ItemType = RSS_RSS;
285 void ATOM_item_feed_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
287 syslog(LOG_DEBUG, "RSS: This is an ATOM feed.\n");
288 Cfg->ItemType = RSS_ATOM;
292 void RSS_item_item_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
294 ri->item_tag_nesting ++;
298 void ATOM_item_entry_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
301 ri->item_tag_nesting ++;
305 void ATOM_item_link_start (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
308 const char *pHref = NULL;
309 const char *pType = NULL;
310 const char *pRel = NULL;
311 const char *pTitle = NULL;
313 for (i = 0; Attr[i] != NULL; i+=2)
315 if (!strcmp(Attr[i], "href"))
319 else if (!strcmp(Attr[i], "rel"))
323 else if (!strcmp(Attr[i], "type"))
327 else if (!strcmp(Attr[i], "title"))
333 return; /* WHUT? Pointing... where? */
334 if ((pType != NULL) && !strcasecmp(pType, "application/atom+xml"))
335 return; /* these just point to other rss resources, we're not interested in them. */
338 if (!strcasecmp (pRel, "replies"))
340 NewStrBufDupAppendFlush(&ri->reLink, NULL, pHref, -1);
341 StrBufTrim(ri->link);
342 NewStrBufDupAppendFlush(&ri->reLinkTitle, NULL, pTitle, -1);
344 else if (!strcasecmp(pRel, "alternate")) /* Alternative representation of this Item... */
346 NewStrBufDupAppendFlush(&ri->link, NULL, pHref, -1);
347 StrBufTrim(ri->link);
348 NewStrBufDupAppendFlush(&ri->linkTitle, NULL, pTitle, -1);
351 #if 0 /* these are also defined, but dunno what to do with them.. */
352 else if (!strcasecmp(pRel, "related"))
355 else if (!strcasecmp(pRel, "self"))
358 else if (!strcasecmp(pRel, "enclosure"))
359 {/* this reference can get big, and is probably the full article... */
361 else if (!strcasecmp(pRel, "via"))
362 {/* this article was provided via... */
366 else if (StrLength(ri->link) == 0)
368 NewStrBufDupAppendFlush(&ri->link, NULL, pHref, -1);
369 StrBufTrim(ri->link);
370 NewStrBufDupAppendFlush(&ri->linkTitle, NULL, pTitle, -1);
377 void ATOMRSS_item_title_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
379 if ((ri->item_tag_nesting == 0) && (StrLength(CData) > 0)) {
380 NewStrBufDupAppendFlush(&ri->channel_title, CData, NULL, 0);
381 StrBufTrim(ri->channel_title);
385 void RSS_item_guid_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
387 if (StrLength(CData) > 0) {
388 NewStrBufDupAppendFlush(&ri->guid, CData, NULL, 0);
392 void ATOM_item_id_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
394 if (StrLength(CData) > 0) {
395 NewStrBufDupAppendFlush(&ri->guid, CData, NULL, 0);
400 void RSS_item_link_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
402 if (StrLength(CData) > 0) {
403 NewStrBufDupAppendFlush(&ri->link, CData, NULL, 0);
404 StrBufTrim(ri->link);
407 void RSS_item_relink_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
409 if (StrLength(CData) > 0) {
410 NewStrBufDupAppendFlush(&ri->reLink, CData, NULL, 0);
411 StrBufTrim(ri->reLink);
415 void RSSATOM_item_title_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
417 if (StrLength(CData) > 0) {
418 NewStrBufDupAppendFlush(&ri->title, CData, NULL, 0);
419 StrBufTrim(ri->title);
423 void ATOM_item_content_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
425 long olen = StrLength (ri->description);
426 long clen = StrLength (CData);
430 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
431 StrBufTrim(ri->description);
433 else if (olen < clen) {
434 FlushStrBuf(ri->description);
435 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
436 StrBufTrim(ri->description);
440 void ATOM_item_summary_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
442 /* this can contain an abstract of the article. but we don't want to verwrite a full document if we already have it. */
443 if ((StrLength(CData) > 0) && (StrLength(ri->description) == 0))
445 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
446 StrBufTrim(ri->description);
450 void RSS_item_description_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
452 long olen = StrLength (ri->description);
453 long clen = StrLength (CData);
457 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
458 StrBufTrim(ri->description);
460 else if (olen < clen) {
461 FlushStrBuf(ri->description);
462 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
463 StrBufTrim(ri->description);
468 void ATOM_item_published_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
470 if (StrLength(CData) > 0) {
472 ri->pubdate = rdf_parsedate(ChrPtr(CData));
476 void ATOM_item_updated_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
478 if (StrLength(CData) > 0) {
480 ri->pubdate = rdf_parsedate(ChrPtr(CData));
484 void RSS_item_pubdate_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
486 if (StrLength(CData) > 0) {
488 ri->pubdate = rdf_parsedate(ChrPtr(CData));
493 void RSS_item_date_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
495 if (StrLength(CData) > 0) {
497 ri->pubdate = rdf_parsedate(ChrPtr(CData));
503 void RSS_item_author_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
505 if (StrLength(CData) > 0) {
506 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
507 StrBufTrim(ri->author_or_creator);
512 void ATOM_item_name_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
514 if (StrLength(CData) > 0) {
515 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
516 StrBufTrim(ri->author_or_creator);
520 void ATOM_item_email_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
522 if (StrLength(CData) > 0) {
523 NewStrBufDupAppendFlush(&ri->author_email, CData, NULL, 0);
524 StrBufTrim(ri->author_email);
528 void RSS_item_creator_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
530 if ((StrLength(CData) > 0) &&
531 (StrLength(ri->author_or_creator) == 0))
533 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
534 StrBufTrim(ri->author_or_creator);
539 void ATOM_item_uri_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
541 if (StrLength(CData) > 0) {
542 NewStrBufDupAppendFlush(&ri->author_url, CData, NULL, 0);
543 StrBufTrim(ri->author_url);
547 void RSS_item_item_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
549 --ri->item_tag_nesting;
550 rss_save_item(ri, Cfg);
554 void ATOM_item_entry_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
556 --ri->item_tag_nesting;
557 rss_save_item(ri, Cfg);
560 void RSS_item_rss_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
562 // syslog(LOG_DEBUG, "End of feed detected. Closing parser.\n");
563 ri->done_parsing = 1;
566 void RSS_item_rdf_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
568 // syslog(LOG_DEBUG, "End of feed detected. Closing parser.\n");
569 ri->done_parsing = 1;
573 void RSSATOM_item_ignore(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
580 * This callback stores up the data which appears in between tags.
582 void rss_xml_cdata_start(void *data)
584 rss_aggregator *rssc = (rss_aggregator*) data;
586 FlushStrBuf(rssc->CData);
589 void rss_xml_cdata_end(void *data)
592 void rss_xml_chardata(void *data, const XML_Char *s, int len)
594 rss_aggregator *rssc = (rss_aggregator*) data;
596 StrBufAppendBufPlain (rssc->CData, s, len, 0);
600 * Callback function for passing libcurl's output to expat for parsing
602 size_t rss_libcurl_callback(void *ptr, size_t size, size_t nmemb, void *stream)
604 XML_Parse((XML_Parser)stream, ptr, (size * nmemb), 0);
610 eNextState ParseRSSReply(AsyncIO *IO)
613 rss_aggregator *rssc;
621 if (IO->HttpReq.httpcode != 200)
624 EV_syslog(LOG_DEBUG, "need a 200, got a %ld !\n",
625 IO->HttpReq.httpcode);
626 // TODO: aide error message with rate limit
632 rssc->CData = NewStrBufPlain(NULL, SIZ);
633 rssc->Key = NewStrBuf();
635 StrBufSipLine(rssc->Key, IO->HttpReq.ReplyData, &at);
638 #define encoding "encoding=\""
639 ptr = strstr(ChrPtr(rssc->Key), encoding);
644 ptr += sizeof (encoding) - 1;
645 pche = strchr(ptr, '"');
647 StrBufCutAt(rssc->Key, -1, pche);
654 syslog(LOG_DEBUG, "RSS: Now parsing [%s] \n", ChrPtr(rssc->Url));
656 rssc->xp = XML_ParserCreateNS(ptr, ':');
658 syslog(LOG_DEBUG, "Cannot create XML parser!\n");
661 FlushStrBuf(rssc->Key);
663 rssc->Messages = NewHash(1, Flathash);
664 XML_SetElementHandler(rssc->xp, rss_xml_start, rss_xml_end);
665 XML_SetCharacterDataHandler(rssc->xp, rss_xml_chardata);
666 XML_SetUserData(rssc->xp, rssc);
667 XML_SetCdataSectionHandler(rssc->xp,
672 len = StrLength(IO->HttpReq.ReplyData);
673 ptr = SmashStrBuf(&IO->HttpReq.ReplyData);
674 XML_Parse(rssc->xp, ptr, len, 0);
676 if (ri->done_parsing == 0)
677 XML_Parse(rssc->xp, "", 0, 1);
680 syslog(LOG_DEBUG, "RSS: XML Status [%s] \n",
682 XML_GetErrorCode(rssc->xp)));
684 XML_ParserFree(rssc->xp);
686 FreeStrBuf(&rssc->CData);
687 FreeStrBuf(&rssc->Key);
689 Buf = NewStrBufDup(rssc->rooms);
690 rssc->recp.recp_room = SmashStrBuf(&Buf);
691 rssc->recp.num_room = rssc->roomlist_parts;
692 rssc->recp.recptypes_magic = RECPTYPES_MAGIC;
694 rssc->Pos = GetNewHashPos(rssc->Messages, 1);
696 ///Cfg->next_poll = time(NULL) + config.c_net_freq;
697 if (GetNextHashPos(rssc->Messages, rssc->Pos, &len, &Key, (void**) &rssc->ThisMsg))
698 return QueueDBOperation(IO, RSS_FetchNetworkUsetableEntry);
704 void rss_parser_cleanup(void)
706 DeleteHash(&StartHandlers);
707 DeleteHash(&EndHandlers);
708 DeleteHash(&KnownNameSpaces);
712 CTDL_MODULE_INIT(rssparser)
716 StartHandlers = NewHash(1, NULL);
717 EndHandlers = NewHash(1, NULL);
719 AddRSSStartHandler(RSS_item_rss_start, RSS_UNSET, HKEY("rss"));
720 AddRSSStartHandler(RSS_item_rdf_start, RSS_UNSET, HKEY("rdf"));
721 AddRSSStartHandler(ATOM_item_feed_start, RSS_UNSET, HKEY("feed"));
722 AddRSSStartHandler(RSS_item_item_start, RSS_RSS, HKEY("item"));
723 AddRSSStartHandler(ATOM_item_entry_start, RSS_ATOM, HKEY("entry"));
724 AddRSSStartHandler(ATOM_item_link_start, RSS_ATOM, HKEY("link"));
726 AddRSSEndHandler(ATOMRSS_item_title_end, RSS_ATOM|RSS_RSS|RSS_REQUIRE_BUF, HKEY("title"));
727 AddRSSEndHandler(RSS_item_guid_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("guid"));
728 AddRSSEndHandler(ATOM_item_id_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("id"));
729 AddRSSEndHandler(RSS_item_link_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("link"));
731 // hm, rss to the comments of that blog, might be interesting in future, but...
732 AddRSSEndHandler(RSS_item_relink_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("commentrss"));
734 AddRSSEndHandler(RSS_item_relink_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("comments"));
736 AddRSSEndHandler(RSSATOM_item_title_end, RSS_ATOM|RSS_RSS|RSS_REQUIRE_BUF, HKEY("title"));
737 AddRSSEndHandler(ATOM_item_content_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("content"));
738 AddRSSEndHandler(RSS_item_description_end, RSS_RSS|RSS_ATOM|RSS_REQUIRE_BUF, HKEY("encoded"));
739 AddRSSEndHandler(ATOM_item_summary_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("summary"));
740 AddRSSEndHandler(RSS_item_description_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("description"));
741 AddRSSEndHandler(ATOM_item_published_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("published"));
742 AddRSSEndHandler(ATOM_item_updated_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("updated"));
743 AddRSSEndHandler(RSS_item_pubdate_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("pubdate"));
744 AddRSSEndHandler(RSS_item_date_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("date"));
745 AddRSSEndHandler(RSS_item_author_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("author"));
746 AddRSSEndHandler(RSS_item_creator_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("creator"));
748 AddRSSEndHandler(ATOM_item_email_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("email"));
749 AddRSSEndHandler(ATOM_item_name_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("name"));
750 AddRSSEndHandler(ATOM_item_uri_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("uri"));
752 AddRSSEndHandler(RSS_item_item_end, RSS_RSS, HKEY("item"));
753 AddRSSEndHandler(RSS_item_rss_end, RSS_RSS, HKEY("rss"));
754 AddRSSEndHandler(RSS_item_rdf_end, RSS_RSS, HKEY("rdf"));
755 AddRSSEndHandler(ATOM_item_entry_end, RSS_ATOM, HKEY("entry"));
758 /* at the start of atoms: <seq> <li>link to resource</li></seq> ignore them. */
759 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("seq"));
760 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("seq"));
761 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("li"));
762 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("li"));
764 /* links to other feed generators... */
765 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("feedflare"));
766 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("feedflare"));
767 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("browserfriendly"));
768 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("browserfriendly"));
770 KnownNameSpaces = NewHash(1, NULL);
771 Put(KnownNameSpaces, HKEY("http://a9.com/-/spec/opensearch/1.1/"), NULL, reference_free_handler);
772 Put(KnownNameSpaces, HKEY("http://a9.com/-/spec/opensearchrss/1.0/"), NULL, reference_free_handler);
773 Put(KnownNameSpaces, HKEY("http://backend.userland.com/creativeCommonsRssModule"), NULL, reference_free_handler);
774 Put(KnownNameSpaces, HKEY("http://purl.org/atom/ns#"), NULL, reference_free_handler);
775 Put(KnownNameSpaces, HKEY("http://purl.org/dc/elements/1.1/"), NULL, reference_free_handler);
776 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/"), NULL, reference_free_handler);
777 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/content/"), NULL, reference_free_handler);
778 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/slash/"), NULL, reference_free_handler);
779 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/syndication/"), NULL, reference_free_handler);
780 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/"), NULL, reference_free_handler);
781 Put(KnownNameSpaces, HKEY("http://purl.org/syndication/thread/1.0"), NULL, reference_free_handler);
782 Put(KnownNameSpaces, HKEY("http://rssnamespace.org/feedburner/ext/1.0"), NULL, reference_free_handler);
783 Put(KnownNameSpaces, HKEY("http://schemas.google.com/g/2005"), NULL, reference_free_handler);
784 Put(KnownNameSpaces, HKEY("http://webns.net/mvcb/"), NULL, reference_free_handler);
785 Put(KnownNameSpaces, HKEY("http://web.resource.org/cc/"), NULL, reference_free_handler);
786 Put(KnownNameSpaces, HKEY("http://wellformedweb.org/CommentAPI/"), NULL, reference_free_handler);
787 Put(KnownNameSpaces, HKEY("http://www.georss.org/georss"), NULL, reference_free_handler);
788 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/xhtml"), NULL, reference_free_handler);
789 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/02/22-rdf-syntax-ns#"), NULL, reference_free_handler);
790 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/02/22-rdf-syntax-ns#"), NULL, reference_free_handler);
791 Put(KnownNameSpaces, HKEY("http://www.w3.org/2003/01/geo/wgs84_pos#"), NULL, reference_free_handler);
792 Put(KnownNameSpaces, HKEY("http://www.w3.org/2005/Atom"), NULL, reference_free_handler);
793 Put(KnownNameSpaces, HKEY("urn:flickr:"), NULL, reference_free_handler);
795 /* we don't like these namespaces because of they shadow our usefull parameters. */
796 Put(KnownNameSpaces, HKEY("http://search.yahoo.com/mrss/"), NULL, reference_free_handler);
798 CtdlRegisterCleanupHook(rss_parser_cleanup);