1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
/*
* Bring external RSS feeds into rooms.
*
* Copyright (c) 2007-2012 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
*
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
*
*
*/
#include "internet_addressing.h"
#define RSS_UNSET (1<<0)
#define RSS_RSS (1<<1)
#define RSS_ATOM (1<<2)
#define RSS_REQUIRE_BUF (1<<3)
typedef struct rss_aggregator rss_aggregator;
typedef struct rss_item rss_item;
typedef struct rss_room_counter rss_room_counter;
typedef void (*rss_handler_func)(StrBuf *CData,
rss_item *ri,
rss_aggregator *Cfg,
const char** Attr);
typedef struct __rss_xml_handler {
int Flags;
rss_handler_func Handler;
}rss_xml_handler;
struct rss_item {
int done_parsing;
int item_tag_nesting;
time_t pubdate;
StrBuf *guid;
StrBuf *title;
StrBuf *link;
StrBuf *linkTitle;
StrBuf *reLink;
StrBuf *reLinkTitle;
StrBuf *description;
StrBuf *channel_title;
StrBuf *author_or_creator;
StrBuf *author_url;
StrBuf *author_email;
};
void flush_rss_item(rss_item *ri);
struct rss_room_counter {
int count;
long QRnumber;
};
typedef struct __networker_save_message {
struct CtdlMessage Msg;
StrBuf *MsgGUID;
StrBuf *Message;
StrBuf *author_email;
StrBuf *author_or_creator;
StrBuf *title;
StrBuf *description;
StrBuf *link;
StrBuf *linkTitle;
StrBuf *reLink;
StrBuf *reLinkTitle;
} networker_save_message;
typedef struct RSSCfgLine RSSCfgLine;
struct RSSCfgLine {
RSSCfgLine *next;
StrBuf *Url;
time_t last_known_good;
};
typedef struct __pRSSConfig {
const RSSCfgLine *pCfg;
long QRnumber;
}pRSSConfig;
struct rss_aggregator {
AsyncIO IO;
XML_Parser xp;
int ItemType;
int roomlist_parts;
time_t last_error_when;
time_t next_poll;
StrBuf *Url;
StrBuf *RedirectUrl;
StrBuf *rooms;
pRSSConfig Cfg;
HashList *OtherQRnumbers;
StrBuf *CData;
StrBuf *Key;
rss_item *Item;
recptypes recp;
HashPos *Pos;
HashList *Messages;
networker_save_message *ThisMsg;
};
eNextState RSSAggregator_ParseReply(AsyncIO *IO);
eNextState RSS_FetchNetworkUsetableEntry(AsyncIO *IO);
|