/[james]/sargasso2/feed.h
ViewVC logotype

Contents of /sargasso2/feed.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 77 - (show annotations) (download) (as text)
Tue Sep 26 21:31:28 2006 UTC (17 years, 7 months ago) by james
File MIME type: text/x-chdr
File size: 1426 byte(s)
Rewrite of Sargasso in C.

1 /*
2 * This file is part of Sargasso, http://zamez.org/sargasso
3 * Licensed under the GNU General Public License,
4 * http://www.opensource.org/licenses/gpl-license
5 * Copyright 2006 James Bursa <james@zamez.org>
6 */
7
8 #ifndef FEED_H
9 #define FEED_H
10
11 #include <stdbool.h>
12 #include <curl/curl.h>
13 #include <libxml/parser.h>
14
15
16 #define FEED_MAX_ITEMS 50
17
18 typedef enum { FEED_NEW, FEED_FETCHING, FEED_OK, FEED_ERROR, FEED_UPDATE }
19 feed_status;
20
21 struct feed {
22 char *url;
23 feed_status status;
24 bool updated;
25 const char *error;
26 CURL *curl;
27 struct curl_slist *headers;
28 char *status_line;
29 char *etag;
30 unsigned int redirect_count;
31 char *redirect;
32 char *data;
33 size_t data_size;
34 xmlChar *title;
35 xmlChar *description;
36 xmlChar *link;
37 xmlChar *copyright;
38 xmlChar *pub_date;
39 xmlChar *category;
40 struct {
41 xmlChar *title;
42 xmlChar *description;
43 xmlChar *link;
44 xmlChar *author;
45 xmlChar *pub_date;
46 xmlChar *category;
47 xmlChar *guid;
48 bool new_item;
49 } item[FEED_MAX_ITEMS];
50 unsigned int item_count;
51 };
52
53 extern struct feed *feeds;
54 extern unsigned int feed_count;
55 extern bool feed_work_needed;
56 extern const char *feed_error;
57
58
59 bool feed_init(void);
60 void feed_quit(void);
61 bool feed_add(const char *url);
62 bool feed_remove(unsigned int i);
63 bool feed_work(void);
64 void feed_update(void);
65 bool feed_list_load(const char *path);
66 bool feed_list_save(const char *path);
67 void feed_print(struct feed *feed);
68
69
70 #endif

  ViewVC Help
Powered by ViewVC 1.1.26