Split RSS Parser...
[citadel.git] / citadel / modules / rssclient / rss_atom_parser.h
1 /*
2  * Bring external RSS feeds into rooms.
3  *
4  * Copyright (c) 2007-2010 by the citadel.org team
5  *
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.
10  *
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.
15  *
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
19  */
20
21
22 #define RSS_UNSET       (1<<0)
23 #define RSS_RSS         (1<<1)
24 #define RSS_ATOM        (1<<2)
25 #define RSS_REQUIRE_BUF (1<<3)
26
27 typedef struct _rss_item {
28         char *roomlist;
29         int done_parsing;
30         StrBuf *guid;
31         StrBuf *title;
32         StrBuf *link;
33         StrBuf *linkTitle;
34         StrBuf *reLink;
35         StrBuf *reLinkTitle;
36         StrBuf *description;
37         time_t pubdate;
38         StrBuf *channel_title;
39         int item_tag_nesting;
40         StrBuf *author_or_creator;
41         StrBuf *author_url;
42         StrBuf *author_email;
43 }rss_item;
44
45
46 typedef struct rssnetcfg rssnetcfg;
47 struct rssnetcfg {
48         rssnetcfg *next;
49         StrBuf* Url;
50         char *rooms;
51         time_t last_error_when;
52         int ItemType;
53         time_t next_poll;
54 };
55
56 typedef void (*rss_handler_func)(StrBuf *CData, 
57                                  rss_item *ri, 
58                                  rssnetcfg *Cfg, 
59                                  const char** Attr);
60
61 typedef struct __rss_xml_handler {
62         int Flags;
63         rss_handler_func Handler;
64 }rss_xml_handler;
65
66 typedef struct _rsscollection {
67         AsyncIO IO;
68         XML_Parser xp;
69
70         StrBuf *CData;
71         StrBuf *Key;
72
73         rss_item *Item;
74         rssnetcfg *Cfg;
75         
76         rss_xml_handler *Current;
77 } rsscollection;
78
79
80
81 eNextState ParseRSSReply(AsyncIO *IO);
82
83 void rss_save_item(rss_item *ri);