Split camel-imapx library and merge into camel so that providers can be written on...
[platform/upstream/evolution-data-server.git] / camel / camel-imapx-store-summary.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
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 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
23 #error "Only <camel/camel.h> can be included directly."
24 #endif
25
26
27 #ifndef CAMEL_IMAPX_STORE_SUMMARY_H
28 #define CAMEL_IMAPX_STORE_SUMMARY_H
29
30 #include <camel/camel-store-summary.h>
31
32 /* Standard GObject macros */
33 #define CAMEL_TYPE_IMAPX_STORE_SUMMARY \
34         (camel_imapx_store_summary_get_type ())
35 #define CAMEL_IMAPX_STORE_SUMMARY(obj) \
36         (G_TYPE_CHECK_INSTANCE_CAST \
37         ((obj), CAMEL_TYPE_IMAPX_STORE_SUMMARY, CamelIMAPXStoreSummary))
38 #define CAMEL_IMAPX_STORE_SUMMARY_CLASS(cls) \
39         (G_TYPE_CHECK_CLASS_CAST \
40         ((cls), CAMEL_TYPE_IMAPX_STORE_SUMMARY, CamelIMAPXStoreSummaryClass))
41 #define CAMEL_IS_IMAPX_STORE_SUMMARY(obj) \
42         (G_TYPE_CHECK_INSTANCE_TYPE \
43         ((obj), CAMEL_TYPE_IMAPX_STORE_SUMMARY))
44 #define CAMEL_IS_IMAPX_STORE_SUMMARY_CLASS(cls) \
45         (G_TYPE_CHECK_CLASS_TYPE \
46         ((cls), CAMEL_TYPE_IMAPX_STORE_SUMMARY))
47 #define CAMEL_IMAPX_STORE_SUMMARY_GET_CLASS(obj) \
48         (G_TYPE_INSTANCE_GET_CLASS \
49         ((obj), CAMEL_TYPE_IMAPX_STORE_SUMMARY, CamelIMAPXStoreSummaryClass))
50
51 G_BEGIN_DECLS
52
53 typedef struct _CamelIMAPXStoreSummary CamelIMAPXStoreSummary;
54 typedef struct _CamelIMAPXStoreSummaryClass CamelIMAPXStoreSummaryClass;
55
56 typedef struct _CamelIMAPXStoreInfo CamelIMAPXStoreInfo;
57
58 enum {
59         CAMEL_IMAPX_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
60         CAMEL_IMAPX_STORE_INFO_LAST
61 };
62
63 struct _CamelIMAPXStoreInfo {
64         CamelStoreInfo info;
65         gchar *full_name;
66 };
67
68 typedef struct _CamelIMAPXStoreNamespace CamelIMAPXStoreNamespace;
69
70 struct _CamelIMAPXStoreNamespace {
71         CamelIMAPXStoreNamespace *next;
72         gchar *path;            /* display path */
73         gchar *full_name;       /* real name */
74         gchar sep;              /* directory separator */
75 };
76
77 typedef struct _CamelIMAPXNamespaceList {
78         CamelIMAPXStoreNamespace *personal;
79         CamelIMAPXStoreNamespace *other;
80         CamelIMAPXStoreNamespace *shared;
81 } CamelIMAPXNamespaceList;
82
83 struct _CamelIMAPXStoreSummary {
84         CamelStoreSummary parent;
85
86         /* header info */
87         guint32 version;        /* version of base part of file */
88         guint32 capabilities;
89         CamelIMAPXNamespaceList *namespaces; /* eventually to be a list */
90 };
91
92 struct _CamelIMAPXStoreSummaryClass {
93         CamelStoreSummaryClass parent_class;
94 };
95
96 GType           camel_imapx_store_summary_get_type (void);
97 CamelIMAPXStoreSummary *
98                 camel_imapx_store_summary_new   (void);
99
100 /* TODO: this api needs some more work, needs to support lists */
101 CamelIMAPXStoreNamespace *
102                 camel_imapx_store_summary_namespace_new
103                                                 (CamelIMAPXStoreSummary *s,
104                                                  const gchar *full_name,
105                                                  gchar dir_sep);
106 void            camel_imapx_store_summary_namespace_set
107                                                 (CamelIMAPXStoreSummary *s,
108                                                  CamelIMAPXStoreNamespace *ns);
109 CamelIMAPXStoreNamespace *
110                 camel_imapx_store_summary_namespace_find_path
111                                                 (CamelIMAPXStoreSummary *s,
112                                                  const gchar *path);
113 CamelIMAPXStoreNamespace *
114                 camel_imapx_store_summary_namespace_find_full
115                                                 (CamelIMAPXStoreSummary *s,
116                                                  const gchar *full_name);
117
118 /* converts to/from utf8 canonical nasmes */
119 gchar *         camel_imapx_store_summary_full_to_path
120                                                 (CamelIMAPXStoreSummary *s,
121                                                  const gchar *full_name,
122                                                  gchar dir_sep);
123 gchar *         camel_imapx_store_summary_path_to_full
124                                                 (CamelIMAPXStoreSummary *s,
125                                                  const gchar *path,
126                                                  gchar dir_sep);
127
128 CamelIMAPXStoreInfo *
129                 camel_imapx_store_summary_full_name
130                                                 (CamelIMAPXStoreSummary *s,
131                                                  const gchar *full_name);
132 CamelIMAPXStoreInfo *
133                 camel_imapx_store_summary_add_from_full
134                                                 (CamelIMAPXStoreSummary *s,
135                                                  const gchar *full_name,
136                                                  gchar dir_sep);
137
138 /* a convenience lookup function. always use this if path known */
139 gchar *         camel_imapx_store_summary_full_from_path
140                                                 (CamelIMAPXStoreSummary *s,
141                                                  const gchar *path);
142
143 void            camel_imapx_store_summary_set_namespaces
144                                                 (CamelIMAPXStoreSummary *summary,
145                                                  const CamelIMAPXNamespaceList *nsl);
146
147 /* helpe macro's */
148 #define camel_imapx_store_info_full_name(s, i) \
149         (camel_store_info_string ( \
150                 (CamelStoreSummary *) s, (const CamelStoreInfo *) i, \
151                 CAMEL_IMAPX_STORE_INFO_FULL_NAME))
152
153 G_END_DECLS
154
155 #endif /* CAMEL_IMAP_STORE_SUMMARY_H */