Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / nntp / camel-nntp-store-summary.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2002 Ximian Inc.
4  *
5  * Authors: Michael Zucchi <notzed@ximian.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
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 GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 /* currently, this is just a straigt s/imap/nntp from the IMAP file*/
23
24
25 #ifndef _CAMEL_NNTP_STORE_SUMMARY_H
26 #define _CAMEL_NNTP_STORE_SUMMARY_H
27
28 #include <camel/camel-object.h>
29 #include <camel/camel-store-summary.h>
30
31 #define CAMEL_NNTP_STORE_SUMMARY(obj)         CAMEL_CHECK_CAST (obj, camel_nntp_store_summary_get_type (), CamelNNTPStoreSummary)
32 #define CAMEL_NNTP_STORE_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_nntp_store_summary_get_type (), CamelNNTPStoreSummaryClass)
33 #define CAMEL_IS_NNTP_STORE_SUMMARY(obj)      CAMEL_CHECK_TYPE (obj, camel_nntp_store_summary_get_type ())
34
35 G_BEGIN_DECLS
36
37 typedef struct _CamelNNTPStoreSummary      CamelNNTPStoreSummary;
38 typedef struct _CamelNNTPStoreSummaryClass CamelNNTPStoreSummaryClass;
39
40 typedef struct _CamelNNTPStoreInfo CamelNNTPStoreInfo;
41
42 enum {
43         CAMEL_NNTP_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
44         CAMEL_NNTP_STORE_INFO_LAST,
45 };
46
47 struct _CamelNNTPStoreInfo {
48         CamelStoreInfo info;
49         char *full_name;
50         guint32 first;          /* from LIST or NEWGROUPS return */
51         guint32 last;
52 };
53
54 #define NNTP_DATE_SIZE 14
55
56 struct _CamelNNTPStoreSummary {
57         CamelStoreSummary summary;
58
59         struct _CamelNNTPStoreSummaryPrivate *priv;
60
61         /* header info */
62         guint32 version;        /* version of base part of file */
63         char last_newslist[NNTP_DATE_SIZE];
64 };
65
66 struct _CamelNNTPStoreSummaryClass {
67         CamelStoreSummaryClass summary_class;
68 };
69
70 CamelType                        camel_nntp_store_summary_get_type      (void);
71 CamelNNTPStoreSummary      *camel_nntp_store_summary_new        (void);
72
73 /* TODO: this api needs some more work, needs to support lists */
74 /*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_new(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);*/
75 /*void camel_nntp_store_summary_namespace_set(CamelNNTPStoreSummary *s, CamelNNTPStoreNamespace *ns);*/
76 /*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_path(CamelNNTPStoreSummary *s, const char *path);*/
77 /*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_full(CamelNNTPStoreSummary *s, const char *full_name);*/
78
79 /* helper macro's */
80 #define camel_nntp_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_NNTP_STORE_INFO_FULL_NAME))
81
82 /* converts to/from utf8 canonical nasmes */
83 char *camel_nntp_store_summary_full_to_path(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);
84
85 char *camel_nntp_store_summary_path_to_full(CamelNNTPStoreSummary *s, const char *path, char dir_sep);
86 char *camel_nntp_store_summary_dotted_to_full(CamelNNTPStoreSummary *s, const char *dotted, char dir_sep);
87
88 CamelNNTPStoreInfo *camel_nntp_store_summary_full_name(CamelNNTPStoreSummary *s, const char *full_name);
89 CamelNNTPStoreInfo *camel_nntp_store_summary_add_from_full(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);
90
91 /* a convenience lookup function. always use this if path known */
92 char *camel_nntp_store_summary_full_from_path(CamelNNTPStoreSummary *s, const char *path);
93
94 G_END_DECLS
95
96 #endif /* ! _CAMEL_NNTP_STORE_SUMMARY_H */