TDAP: align rss config structs with the primary type.
[citadel] / citadel / modules / rssclient / rss_atom_parser.h
1 /*
2  * Bring external RSS feeds into rooms.
3  *
4  * Copyright (c) 2007-2012 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 3.
8  * 
9  * 
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  * 
17  * 
18  * 
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_aggregator rss_aggregator;
28 typedef struct rss_item rss_item;
29 typedef struct rss_room_counter rss_room_counter;
30
31 typedef void (*rss_handler_func)(StrBuf *CData, 
32                                  rss_item *ri, 
33                                  rss_aggregator *Cfg, 
34                                  const char** Attr);
35
36
37 typedef struct __rss_xml_handler {
38         int              Flags;
39         rss_handler_func Handler;
40 }rss_xml_handler;
41
42 struct rss_item {
43         int     done_parsing;
44         int     item_tag_nesting;
45         time_t  pubdate;
46         StrBuf *guid;
47         StrBuf *title;
48         StrBuf *link;
49         StrBuf *linkTitle;
50         StrBuf *reLink;
51         StrBuf *reLinkTitle;
52         StrBuf *description;
53         StrBuf *channel_title;
54         StrBuf *author_or_creator;
55         StrBuf *author_url;
56         StrBuf *author_email;
57 };
58 void flush_rss_item(rss_item *ri);
59
60 struct rss_room_counter {
61         int count;
62         long QRnumber;
63 };
64
65 typedef struct __networker_save_message {
66         struct CtdlMessage Msg;
67         StrBuf *MsgGUID;
68         StrBuf *Message;
69
70         StrBuf *author_email;
71         StrBuf *author_or_creator;
72         StrBuf *title;
73         StrBuf *description;
74
75         StrBuf *link;
76         StrBuf *linkTitle;
77
78         StrBuf *reLink;
79         StrBuf *reLinkTitle;
80 } networker_save_message;
81
82 typedef struct RSSCfgLine RSSCfgLine;
83 struct RSSCfgLine {
84         RSSCfgLine *next;
85         StrBuf *Url;
86         time_t last_known_good;
87 };
88
89 typedef struct __pRSSConfig {
90         const RSSCfgLine *pCfg;
91         long             QRnumber;
92 }pRSSConfig;
93
94 struct rss_aggregator {
95         AsyncIO          IO;
96         XML_Parser       xp;
97
98         int              ItemType;
99         int              roomlist_parts;
100
101         time_t           last_error_when;
102         time_t           next_poll;
103         StrBuf          *Url;
104         StrBuf          *rooms;
105         pRSSConfig       Cfg;
106         HashList        *OtherQRnumbers;
107                         
108         StrBuf          *CData;
109         StrBuf          *Key;
110
111         rss_item        *Item;
112         struct recptypes recp;
113         HashPos         *Pos;
114         HashList        *Messages;
115         networker_save_message *ThisMsg;
116 };
117
118
119
120 eNextState RSSAggregator_ParseReply(AsyncIO *IO);
121
122 eNextState RSS_FetchNetworkUsetableEntry(AsyncIO *IO);