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 HashList *StartHandlers = NULL;
62 HashList *EndHandlers = NULL;
63 HashList *KnownNameSpaces = NULL;
64 void AddRSSStartHandler(rss_handler_func Handler, int Flags, const char *key, long len)
67 h = (rss_xml_handler*) malloc(sizeof (rss_xml_handler));
70 Put(StartHandlers, key, len, h, NULL);
72 void AddRSSEndHandler(rss_handler_func Handler, int Flags, const char *key, long len)
75 h = (rss_xml_handler*) malloc(sizeof (rss_xml_handler));
78 Put(EndHandlers, key, len, h, NULL);
84 * Convert an RDF/RSS datestamp into a time_t
86 time_t rdf_parsedate(const char *p)
92 if (strlen(p) < 10) return 0L;
94 memset(&tm, 0, sizeof tm);
97 * If the timestamp appears to be in W3C datetime format, try to
98 * parse it. See also: http://www.w3.org/TR/NOTE-datetime
100 * This code, along with parsedate.c, is a potential candidate for
101 * moving into libcitadel.
103 if ( (p[4] == '-') && (p[7] == '-') ) {
104 tm.tm_year = atoi(&p[0]) - 1900;
105 tm.tm_mon = atoi(&p[5]) - 1;
106 tm.tm_mday = atoi(&p[8]);
107 if ( (p[10] == 'T') && (p[13] == ':') ) {
108 tm.tm_hour = atoi(&p[11]);
109 tm.tm_min = atoi(&p[14]);
114 /* hmm... try RFC822 date stamp format */
117 if (t > 0) return(t);
119 /* yeesh. ok, just return the current date and time. */
123 void flush_rss_item(rss_item *ri)
125 /* Initialize the feed item data structure */
126 FreeStrBuf(&ri->guid);
127 FreeStrBuf(&ri->title);
128 FreeStrBuf(&ri->link);
129 FreeStrBuf(&ri->author_or_creator);
130 FreeStrBuf(&ri->author_email);
131 FreeStrBuf(&ri->author_url);
132 FreeStrBuf(&ri->description);
135 void rss_xml_start(void *data, const char *supplied_el, const char **attr)
138 rss_aggregator *rssc = (rss_aggregator*) data;
139 rss_item *ri = rssc->Item;
144 /* Axe the namespace, we don't care about it */
145 /// CtdlLogPrintf(0, "RSS: supplied el %d: %s...\n", rssc->Cfg->ItemType, supplied_el);
147 while (sep = strchr(pel, ':'), sep) {
151 if (pel != supplied_el)
155 if (!GetHash(KnownNameSpaces,
157 pel - supplied_el - 1,
161 CtdlLogPrintf(0, "RSS: START ignoring because of wrong namespace [%s] = [%s]\n",
168 StrBufPlain(rssc->Key, pel, -1);
169 StrBufLowerCase(rssc->Key);
170 if (GetHash(StartHandlers, SKEY(rssc->Key), &pv))
172 rssc->Current = h = (rss_xml_handler*) pv;
174 if (((h->Flags & RSS_UNSET) != 0) &&
175 (rssc->ItemType == RSS_UNSET))
177 h->Handler(rssc->CData, ri, rssc, attr);
179 else if (((h->Flags & RSS_RSS) != 0) &&
180 (rssc->ItemType == RSS_RSS))
182 h->Handler(rssc->CData, ri, rssc, attr);
184 else if (((h->Flags & RSS_ATOM) != 0) &&
185 (rssc->ItemType == RSS_ATOM))
187 h->Handler(rssc->CData, ri, rssc, attr);
191 CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el);
196 CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el);
200 void rss_xml_end(void *data, const char *supplied_el)
203 rss_aggregator *rssc = (rss_aggregator*) data;
204 rss_item *ri = rssc->Item;
209 /* Axe the namespace, we don't care about it */
211 while (sep = strchr(pel, ':'), sep) {
214 // CtdlLogPrintf(0, "RSS: END %s...\n", el);
215 if (pel != supplied_el)
219 if (!GetHash(KnownNameSpaces,
221 pel - supplied_el - 1,
225 CtdlLogPrintf(0, "RSS: END ignoring because of wrong namespace [%s] = [%s]\n",
226 supplied_el, ChrPtr(rssc->CData));
228 FlushStrBuf(rssc->CData);
233 StrBufPlain(rssc->Key, pel, -1);
234 StrBufLowerCase(rssc->Key);
235 if (GetHash(EndHandlers, SKEY(rssc->Key), &pv))
237 h = (rss_xml_handler*) pv;
239 if (((h->Flags & RSS_UNSET) != 0) &&
240 (rssc->ItemType == RSS_UNSET))
242 h->Handler(rssc->CData, ri, rssc, NULL);
244 else if (((h->Flags & RSS_RSS) != 0) &&
245 (rssc->ItemType == RSS_RSS))
247 h->Handler(rssc->CData, ri, rssc, NULL);
249 else if (((h->Flags & RSS_ATOM) != 0) &&
250 (rssc->ItemType == RSS_ATOM))
252 h->Handler(rssc->CData, ri, rssc, NULL);
256 CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData));
261 CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData));
263 FlushStrBuf(rssc->CData);
264 rssc->Current = NULL;
271 void RSS_item_rss_start (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
273 CtdlLogPrintf(CTDL_DEBUG, "RSS: This is an RSS feed.\n");
274 Cfg->ItemType = RSS_RSS;
277 void RSS_item_rdf_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
279 CtdlLogPrintf(CTDL_DEBUG, "RSS: This is an RDF feed.\n");
280 Cfg->ItemType = RSS_RSS;
283 void ATOM_item_feed_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
285 CtdlLogPrintf(CTDL_DEBUG, "RSS: This is an ATOM feed.\n");
286 Cfg->ItemType = RSS_ATOM;
290 void RSS_item_item_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
292 ri->item_tag_nesting ++;
296 void ATOM_item_entry_start(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
299 ri->item_tag_nesting ++;
303 void ATOM_item_link_start (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
306 const char *pHref = NULL;
307 const char *pType = NULL;
308 const char *pRel = NULL;
309 const char *pTitle = NULL;
311 for (i = 0; Attr[i] != NULL; i+=2)
313 if (!strcmp(Attr[i], "href"))
317 else if (!strcmp(Attr[i], "rel"))
321 else if (!strcmp(Attr[i], "type"))
325 else if (!strcmp(Attr[i], "title"))
331 return; /* WHUT? Pointing... where? */
332 if ((pType != NULL) && !strcasecmp(pType, "application/atom+xml"))
333 return; /* these just point to other rss resources, we're not interested in them. */
336 if (!strcasecmp (pRel, "replies"))
338 NewStrBufDupAppendFlush(&ri->reLink, NULL, pHref, -1);
339 StrBufTrim(ri->link);
340 NewStrBufDupAppendFlush(&ri->reLinkTitle, NULL, pTitle, -1);
342 else if (!strcasecmp(pRel, "alternate")) /* Alternative representation of this Item... */
344 NewStrBufDupAppendFlush(&ri->link, NULL, pHref, -1);
345 StrBufTrim(ri->link);
346 NewStrBufDupAppendFlush(&ri->linkTitle, NULL, pTitle, -1);
349 #if 0 /* these are also defined, but dunno what to do with them.. */
350 else if (!strcasecmp(pRel, "related"))
353 else if (!strcasecmp(pRel, "self"))
356 else if (!strcasecmp(pRel, "enclosure"))
357 {/* this reference can get big, and is probably the full article... */
359 else if (!strcasecmp(pRel, "via"))
360 {/* this article was provided via... */
364 else if (StrLength(ri->link) == 0)
366 NewStrBufDupAppendFlush(&ri->link, NULL, pHref, -1);
367 StrBufTrim(ri->link);
368 NewStrBufDupAppendFlush(&ri->linkTitle, NULL, pTitle, -1);
375 void ATOMRSS_item_title_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
377 if ((ri->item_tag_nesting == 0) && (StrLength(CData) > 0)) {
378 NewStrBufDupAppendFlush(&ri->channel_title, CData, NULL, 0);
379 StrBufTrim(ri->channel_title);
383 void RSS_item_guid_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
385 if (StrLength(CData) > 0) {
386 NewStrBufDupAppendFlush(&ri->guid, CData, NULL, 0);
390 void ATOM_item_id_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
392 if (StrLength(CData) > 0) {
393 NewStrBufDupAppendFlush(&ri->guid, CData, NULL, 0);
398 void RSS_item_link_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
400 if (StrLength(CData) > 0) {
401 NewStrBufDupAppendFlush(&ri->link, CData, NULL, 0);
402 StrBufTrim(ri->link);
405 void RSS_item_relink_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
407 if (StrLength(CData) > 0) {
408 NewStrBufDupAppendFlush(&ri->reLink, CData, NULL, 0);
409 StrBufTrim(ri->reLink);
413 void RSSATOM_item_title_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
415 if (StrLength(CData) > 0) {
416 NewStrBufDupAppendFlush(&ri->title, CData, NULL, 0);
417 StrBufTrim(ri->title);
421 void ATOM_item_content_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
423 long olen = StrLength (ri->description);
424 long clen = StrLength (CData);
428 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
429 StrBufTrim(ri->description);
431 else if (olen < clen) {
432 FlushStrBuf(ri->description);
433 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
434 StrBufTrim(ri->description);
438 void ATOM_item_summary_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
440 /* this can contain an abstract of the article. but we don't want to verwrite a full document if we already have it. */
441 if ((StrLength(CData) > 0) && (StrLength(ri->description) == 0))
443 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
444 StrBufTrim(ri->description);
448 void RSS_item_description_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
450 long olen = StrLength (ri->description);
451 long clen = StrLength (CData);
455 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
456 StrBufTrim(ri->description);
458 else if (olen < clen) {
459 FlushStrBuf(ri->description);
460 NewStrBufDupAppendFlush(&ri->description, CData, NULL, 0);
461 StrBufTrim(ri->description);
466 void ATOM_item_published_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
468 if (StrLength(CData) > 0) {
470 ri->pubdate = rdf_parsedate(ChrPtr(CData));
474 void ATOM_item_updated_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
476 if (StrLength(CData) > 0) {
478 ri->pubdate = rdf_parsedate(ChrPtr(CData));
482 void RSS_item_pubdate_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
484 if (StrLength(CData) > 0) {
486 ri->pubdate = rdf_parsedate(ChrPtr(CData));
491 void RSS_item_date_end (StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
493 if (StrLength(CData) > 0) {
495 ri->pubdate = rdf_parsedate(ChrPtr(CData));
501 void RSS_item_author_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
503 if (StrLength(CData) > 0) {
504 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
505 StrBufTrim(ri->author_or_creator);
510 void ATOM_item_name_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
512 if (StrLength(CData) > 0) {
513 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
514 StrBufTrim(ri->author_or_creator);
518 void ATOM_item_email_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
520 if (StrLength(CData) > 0) {
521 NewStrBufDupAppendFlush(&ri->author_email, CData, NULL, 0);
522 StrBufTrim(ri->author_email);
526 void RSS_item_creator_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
528 if ((StrLength(CData) > 0) &&
529 (StrLength(ri->author_or_creator) == 0))
531 NewStrBufDupAppendFlush(&ri->author_or_creator, CData, NULL, 0);
532 StrBufTrim(ri->author_or_creator);
537 void ATOM_item_uri_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
539 if (StrLength(CData) > 0) {
540 NewStrBufDupAppendFlush(&ri->author_url, CData, NULL, 0);
541 StrBufTrim(ri->author_url);
545 void RSS_item_item_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
547 --ri->item_tag_nesting;
548 rss_save_item(ri, Cfg);
552 void ATOM_item_entry_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
554 --ri->item_tag_nesting;
555 rss_save_item(ri, Cfg);
558 void RSS_item_rss_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
560 // CtdlLogPrintf(CTDL_DEBUG, "End of feed detected. Closing parser.\n");
561 ri->done_parsing = 1;
564 void RSS_item_rdf_end(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
566 // CtdlLogPrintf(CTDL_DEBUG, "End of feed detected. Closing parser.\n");
567 ri->done_parsing = 1;
571 void RSSATOM_item_ignore(StrBuf *CData, rss_item *ri, rss_aggregator *Cfg, const char** Attr)
578 * This callback stores up the data which appears in between tags.
580 void rss_xml_cdata_start(void *data)
582 rss_aggregator *rssc = (rss_aggregator*) data;
584 FlushStrBuf(rssc->CData);
587 void rss_xml_cdata_end(void *data)
590 void rss_xml_chardata(void *data, const XML_Char *s, int len)
592 rss_aggregator *rssc = (rss_aggregator*) data;
594 StrBufAppendBufPlain (rssc->CData, s, len, 0);
598 * Callback function for passing libcurl's output to expat for parsing
600 size_t rss_libcurl_callback(void *ptr, size_t size, size_t nmemb, void *stream)
602 XML_Parse((XML_Parser)stream, ptr, (size * nmemb), 0);
608 eNextState ParseRSSReply(AsyncIO *IO)
610 rss_aggregator *rssc;
618 rssc->CData = NewStrBufPlain(NULL, SIZ);
619 rssc->Key = NewStrBuf();
621 StrBufSipLine(rssc->Key, IO->HttpReq.ReplyData, &at);
624 #define encoding "encoding=\""
625 ptr = strstr(ChrPtr(rssc->Key), encoding);
630 ptr += sizeof (encoding) - 1;
631 pche = strchr(ptr, '"');
633 StrBufCutAt(rssc->Key, -1, pche);
640 CtdlLogPrintf(CTDL_ALERT, "RSS: Now parsing [%s] \n", ChrPtr(rssc->Url));
642 rssc->xp = XML_ParserCreateNS(ptr, ':');
644 CtdlLogPrintf(CTDL_ALERT, "Cannot create XML parser!\n");
647 FlushStrBuf(rssc->Key);
649 XML_SetElementHandler(rssc->xp, rss_xml_start, rss_xml_end);
650 XML_SetCharacterDataHandler(rssc->xp, rss_xml_chardata);
651 XML_SetUserData(rssc->xp, rssc);
652 XML_SetCdataSectionHandler(rssc->xp,
657 len = StrLength(IO->HttpReq.ReplyData);
658 ptr = SmashStrBuf(&IO->HttpReq.ReplyData);
659 XML_Parse(rssc->xp, ptr, len, 0);
661 if (ri->done_parsing == 0)
662 XML_Parse(rssc->xp, "", 0, 1);
665 CtdlLogPrintf(CTDL_ALERT, "RSS: XML Status [%s] \n",
667 XML_GetErrorCode(rssc->xp)));
670 XML_ParserFree(rssc->xp);
673 FreeStrBuf(&rssc->CData);
674 FreeStrBuf(&rssc->Key);
676 ///Cfg->next_poll = time(NULL) + config.c_net_freq;
678 return eTerminateConnection;
682 void rss_cleanup(void)
684 DeleteHash(&StartHandlers);
685 DeleteHash(&EndHandlers);
686 DeleteHash(&KnownNameSpaces);
690 CTDL_MODULE_INIT(rssparser)
694 StartHandlers = NewHash(1, NULL);
695 EndHandlers = NewHash(1, NULL);
697 AddRSSStartHandler(RSS_item_rss_start, RSS_UNSET, HKEY("rss"));
698 AddRSSStartHandler(RSS_item_rdf_start, RSS_UNSET, HKEY("rdf"));
699 AddRSSStartHandler(ATOM_item_feed_start, RSS_UNSET, HKEY("feed"));
700 AddRSSStartHandler(RSS_item_item_start, RSS_RSS, HKEY("item"));
701 AddRSSStartHandler(ATOM_item_entry_start, RSS_ATOM, HKEY("entry"));
702 AddRSSStartHandler(ATOM_item_link_start, RSS_ATOM, HKEY("link"));
704 AddRSSEndHandler(ATOMRSS_item_title_end, RSS_ATOM|RSS_RSS|RSS_REQUIRE_BUF, HKEY("title"));
705 AddRSSEndHandler(RSS_item_guid_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("guid"));
706 AddRSSEndHandler(ATOM_item_id_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("id"));
707 AddRSSEndHandler(RSS_item_link_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("link"));
709 // hm, rss to the comments of that blog, might be interesting in future, but...
710 AddRSSEndHandler(RSS_item_relink_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("commentrss"));
712 AddRSSEndHandler(RSS_item_relink_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("comments"));
714 AddRSSEndHandler(RSSATOM_item_title_end, RSS_ATOM|RSS_RSS|RSS_REQUIRE_BUF, HKEY("title"));
715 AddRSSEndHandler(ATOM_item_content_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("content"));
716 AddRSSEndHandler(RSS_item_description_end, RSS_RSS|RSS_ATOM|RSS_REQUIRE_BUF, HKEY("encoded"));
717 AddRSSEndHandler(ATOM_item_summary_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("summary"));
718 AddRSSEndHandler(RSS_item_description_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("description"));
719 AddRSSEndHandler(ATOM_item_published_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("published"));
720 AddRSSEndHandler(ATOM_item_updated_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("updated"));
721 AddRSSEndHandler(RSS_item_pubdate_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("pubdate"));
722 AddRSSEndHandler(RSS_item_date_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("date"));
723 AddRSSEndHandler(RSS_item_author_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("author"));
724 AddRSSEndHandler(RSS_item_creator_end, RSS_RSS|RSS_REQUIRE_BUF, HKEY("creator"));
726 AddRSSEndHandler(ATOM_item_email_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("email"));
727 AddRSSEndHandler(ATOM_item_name_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("name"));
728 AddRSSEndHandler(ATOM_item_uri_end, RSS_ATOM|RSS_REQUIRE_BUF, HKEY("uri"));
730 AddRSSEndHandler(RSS_item_item_end, RSS_RSS, HKEY("item"));
731 AddRSSEndHandler(RSS_item_rss_end, RSS_RSS, HKEY("rss"));
732 AddRSSEndHandler(RSS_item_rdf_end, RSS_RSS, HKEY("rdf"));
733 AddRSSEndHandler(ATOM_item_entry_end, RSS_ATOM, HKEY("entry"));
736 /* at the start of atoms: <seq> <li>link to resource</li></seq> ignore them. */
737 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("seq"));
738 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("seq"));
739 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("li"));
740 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("li"));
742 /* links to other feed generators... */
743 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("feedflare"));
744 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("feedflare"));
745 AddRSSStartHandler(RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("browserfriendly"));
746 AddRSSEndHandler (RSSATOM_item_ignore, RSS_RSS|RSS_ATOM, HKEY("browserfriendly"));
748 KnownNameSpaces = NewHash(1, NULL);
749 Put(KnownNameSpaces, HKEY("http://a9.com/-/spec/opensearch/1.1/"), NULL, reference_free_handler);
750 Put(KnownNameSpaces, HKEY("http://a9.com/-/spec/opensearchrss/1.0/"), NULL, reference_free_handler);
751 Put(KnownNameSpaces, HKEY("http://backend.userland.com/creativeCommonsRssModule"), NULL, reference_free_handler);
752 Put(KnownNameSpaces, HKEY("http://purl.org/atom/ns#"), NULL, reference_free_handler);
753 Put(KnownNameSpaces, HKEY("http://purl.org/dc/elements/1.1/"), NULL, reference_free_handler);
754 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/"), NULL, reference_free_handler);
755 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/content/"), NULL, reference_free_handler);
756 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/slash/"), NULL, reference_free_handler);
757 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/modules/syndication/"), NULL, reference_free_handler);
758 Put(KnownNameSpaces, HKEY("http://purl.org/rss/1.0/"), NULL, reference_free_handler);
759 Put(KnownNameSpaces, HKEY("http://purl.org/syndication/thread/1.0"), NULL, reference_free_handler);
760 Put(KnownNameSpaces, HKEY("http://rssnamespace.org/feedburner/ext/1.0"), NULL, reference_free_handler);
761 Put(KnownNameSpaces, HKEY("http://schemas.google.com/g/2005"), NULL, reference_free_handler);
762 Put(KnownNameSpaces, HKEY("http://webns.net/mvcb/"), NULL, reference_free_handler);
763 Put(KnownNameSpaces, HKEY("http://web.resource.org/cc/"), NULL, reference_free_handler);
764 Put(KnownNameSpaces, HKEY("http://wellformedweb.org/CommentAPI/"), NULL, reference_free_handler);
765 Put(KnownNameSpaces, HKEY("http://www.georss.org/georss"), NULL, reference_free_handler);
766 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/xhtml"), NULL, reference_free_handler);
767 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/02/22-rdf-syntax-ns#"), NULL, reference_free_handler);
768 Put(KnownNameSpaces, HKEY("http://www.w3.org/1999/02/22-rdf-syntax-ns#"), NULL, reference_free_handler);
769 Put(KnownNameSpaces, HKEY("http://www.w3.org/2003/01/geo/wgs84_pos#"), NULL, reference_free_handler);
770 Put(KnownNameSpaces, HKEY("http://www.w3.org/2005/Atom"), NULL, reference_free_handler);
771 Put(KnownNameSpaces, HKEY("urn:flickr:"), NULL, reference_free_handler);
773 /* we don't like these namespaces because of they shadow our usefull parameters. */
774 Put(KnownNameSpaces, HKEY("http://search.yahoo.com/mrss/"), NULL, reference_free_handler);
776 CtdlRegisterCleanupHook(rss_cleanup);