1 /*
2  * libEtPan! -- a mail stuff library
3  *
4  * Copyright (C) 2001, 2014 - DINH Viet Hoa
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the libEtPan! project nor the names of its
16  *    contributors may be used to endorse or promote products derived
17  *    from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 #ifndef NEWSFEED_TYPES_H
32 
33 #define NEWSFEED_TYPES_H
34 
35 #include <libetpan/carray.h>
36 #include <sys/types.h>
37 
38 enum {
39   NEWSFEED_NO_ERROR = 0,
40   NEWSFEED_ERROR_CANCELLED,
41   NEWSFEED_ERROR_INTERNAL,
42   NEWSFEED_ERROR_BADURL,
43   NEWSFEED_ERROR_RESOLVE_PROXY,
44   NEWSFEED_ERROR_RESOLVE_HOST,
45   NEWSFEED_ERROR_CONNECT,
46   NEWSFEED_ERROR_STREAM,
47   NEWSFEED_ERROR_PROTOCOL,
48   NEWSFEED_ERROR_PARSE,
49   NEWSFEED_ERROR_ACCESS,
50   NEWSFEED_ERROR_AUTHENTICATION,
51   NEWSFEED_ERROR_FTP,
52   NEWSFEED_ERROR_PARTIAL_FILE,
53   NEWSFEED_ERROR_FETCH,
54   NEWSFEED_ERROR_HTTP,
55   NEWSFEED_ERROR_FILE,
56   NEWSFEED_ERROR_PUT,
57   NEWSFEED_ERROR_MEMORY,
58   NEWSFEED_ERROR_SSL,
59   NEWSFEED_ERROR_LDAP,
60   NEWSFEED_ERROR_UNSUPPORTED_PROTOCOL
61 };
62 
63 struct newsfeed {
64   char * feed_url;
65   char * feed_title;
66   char * feed_description;
67   char * feed_language;
68   char * feed_author;
69   char * feed_generator;
70   time_t feed_date;
71   carray * feed_item_list;
72   int feed_response_code;
73 
74   unsigned int feed_timeout;
75 };
76 
77 struct newsfeed_item {
78   char * fi_url;
79   char * fi_title;
80   char * fi_summary;
81   char * fi_text;
82   char * fi_author;
83   char * fi_id;
84   time_t fi_date_published;
85   time_t fi_date_modified;
86   struct newsfeed * fi_feed; /* owner */
87   struct newsfeed_item_enclosure * fi_enclosure;
88 };
89 
90 struct newsfeed_item_enclosure {
91   char * fie_url;
92   char * fie_type;
93   size_t fie_size;
94 };
95 
96 #endif
97