Back to index

citadel  8.12
rss_atom_parser.h
Go to the documentation of this file.
00001 /*
00002  * Bring external RSS feeds into rooms.
00003  *
00004  * Copyright (c) 2007-2012 by the citadel.org team
00005  *
00006  * This program is open source software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License version 3.
00008  * 
00009  * 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * 
00017  * 
00018  * 
00019  */
00020 
00021 
00022 #define RSS_UNSET       (1<<0)
00023 #define RSS_RSS         (1<<1)
00024 #define RSS_ATOM        (1<<2)
00025 #define RSS_REQUIRE_BUF (1<<3)
00026 
00027 typedef struct rss_aggregator rss_aggregator;
00028 typedef struct rss_item rss_item;
00029 typedef struct rss_room_counter rss_room_counter;
00030 
00031 typedef void (*rss_handler_func)(StrBuf *CData, 
00032                              rss_item *ri, 
00033                              rss_aggregator *Cfg, 
00034                              const char** Attr);
00035 
00036 
00037 typedef struct __rss_xml_handler {
00038        int              Flags;
00039        rss_handler_func Handler;
00040 }rss_xml_handler;
00041 
00042 struct rss_item {
00043        int     done_parsing;
00044        int     item_tag_nesting;
00045        time_t  pubdate;
00046        StrBuf *guid;
00047        StrBuf *title;
00048        StrBuf *link;
00049        StrBuf *linkTitle;
00050        StrBuf *reLink;
00051        StrBuf *reLinkTitle;
00052        StrBuf *description;
00053        StrBuf *channel_title;
00054        StrBuf *author_or_creator;
00055        StrBuf *author_url;
00056        StrBuf *author_email;
00057 };
00058 void flush_rss_item(rss_item *ri);
00059 
00060 struct rss_room_counter {
00061        int count;
00062        long QRnumber;
00063 };
00064 
00065 typedef struct __networker_save_message {
00066        struct CtdlMessage Msg;
00067        StrBuf *MsgGUID;
00068        StrBuf *Message;
00069        struct UseTable ut;
00070 } networker_save_message;
00071 
00072 struct rss_aggregator {
00073        AsyncIO        IO;
00074        XML_Parser     xp;
00075 
00076        int            ItemType;
00077        int            roomlist_parts;
00078 
00079        time_t         last_error_when;
00080        time_t         next_poll;
00081        StrBuf        *Url;
00082        StrBuf        *rooms;
00083        long           QRnumber;
00084        HashList      *OtherQRnumbers;
00085                      
00086        StrBuf        *CData;
00087        StrBuf        *Key;
00088 
00089        rss_item      *Item;
00090        struct recptypes recp;
00091        HashPos         *Pos;
00092        HashList        *Messages;
00093        networker_save_message *ThisMsg;
00094 };
00095 
00096 
00097 
00098 eNextState RSSAggregator_ParseReply(AsyncIO *IO);
00099 
00100 eNextState RSS_FetchNetworkUsetableEntry(AsyncIO *IO);