1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-imap-store.h : class for an imap store */
5 * Authors: Jeffrey Stedfast <fejj@ximian.com>
7 * Copyright (C) 2000 Ximian, Inc.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU Lesser General Public
11 * License as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
25 #ifndef CAMEL_IMAP_STORE_H
26 #define CAMEL_IMAP_STORE_H 1
28 #include "camel-imap-types.h"
29 #include <camel/camel-disco-store.h>
33 #include <libedataserver/e-msgport.h>
37 typedef struct _CamelImapMsg CamelImapMsg;
39 struct _CamelImapMsg {
42 void (*receive)(CamelImapStore *store, struct _CamelImapMsg *m);
43 void (*free)(CamelImapStore *store, struct _CamelImapMsg *m);
46 CamelImapMsg *camel_imap_msg_new(void (*receive)(CamelImapStore *store, struct _CamelImapMsg *m),
47 void (*free)(CamelImapStore *store, struct _CamelImapMsg *m),
49 void camel_imap_msg_queue(CamelImapStore *store, CamelImapMsg *msg);
55 #define CAMEL_IMAP_STORE_TYPE (camel_imap_store_get_type ())
56 #define CAMEL_IMAP_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_STORE_TYPE, CamelImapStore))
57 #define CAMEL_IMAP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STORE_TYPE, CamelImapStoreClass))
58 #define CAMEL_IS_IMAP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_STORE_TYPE))
63 CAMEL_IMAP_STORE_ARG_FIRST = CAMEL_DISCO_STORE_ARG_FIRST + 100,
64 CAMEL_IMAP_STORE_ARG_NAMESPACE,
65 CAMEL_IMAP_STORE_ARG_OVERRIDE_NAMESPACE,
66 CAMEL_IMAP_STORE_ARG_CHECK_ALL,
67 CAMEL_IMAP_STORE_ARG_FILTER_INBOX,
68 CAMEL_IMAP_STORE_ARG_FILTER_JUNK,
69 CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX,
72 #define CAMEL_IMAP_STORE_NAMESPACE (CAMEL_IMAP_STORE_ARG_NAMESPACE | CAMEL_ARG_STR)
73 #define CAMEL_IMAP_STORE_OVERRIDE_NAMESPACE (CAMEL_IMAP_STORE_ARG_OVERRIDE_NAMESPACE | CAMEL_ARG_INT)
74 #define CAMEL_IMAP_STORE_CHECK_ALL (CAMEL_IMAP_STORE_ARG_CHECK_ALL | CAMEL_ARG_INT)
75 #define CAMEL_IMAP_STORE_FILTER_INBOX (CAMEL_IMAP_STORE_ARG_FILTER_INBOX | CAMEL_ARG_INT)
76 #define CAMEL_IMAP_STORE_FILTER_JUNK (CAMEL_IMAP_STORE_ARG_FILTER_JUNK | CAMEL_ARG_BOO)
77 #define CAMEL_IMAP_STORE_FILTER_JUNK_INBOX (CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX | CAMEL_ARG_BOO)
79 /* CamelFolderInfo flags */
80 #define CAMEL_IMAP_FOLDER_MARKED (1<<16)
81 #define CAMEL_IMAP_FOLDER_UNMARKED (1<<17)
87 } CamelImapServerLevel;
89 #define IMAP_CAPABILITY_IMAP4 (1 << 0)
90 #define IMAP_CAPABILITY_IMAP4REV1 (1 << 1)
91 #define IMAP_CAPABILITY_STATUS (1 << 2)
92 #define IMAP_CAPABILITY_NAMESPACE (1 << 3)
93 #define IMAP_CAPABILITY_UIDPLUS (1 << 4)
94 #define IMAP_CAPABILITY_LITERALPLUS (1 << 5)
95 #define IMAP_CAPABILITY_STARTTLS (1 << 6)
96 #define IMAP_CAPABILITY_useful_lsub (1 << 7)
97 #define IMAP_CAPABILITY_utf8_search (1 << 8)
98 #define IMAP_CAPABILITY_XGWEXTENSIONS (1 << 9)
99 #define IMAP_CAPABILITY_XGWMOVE (1 << 10)
100 #define IMAP_CAPABILITY_LOGINDISABLED (1 << 11)
102 #define IMAP_PARAM_OVERRIDE_NAMESPACE (1 << 0)
103 #define IMAP_PARAM_CHECK_ALL (1 << 1)
104 #define IMAP_PARAM_FILTER_INBOX (1 << 2)
105 #define IMAP_PARAM_FILTER_JUNK (1 << 3)
106 #define IMAP_PARAM_FILTER_JUNK_INBOX (1 << 4)
107 #define IMAP_PARAM_SUBSCRIPTIONS (1 << 5)
109 #define IMAP_FETCH_ALL_HEADERS 1
110 #define IMAP_FETCH_MAILING_LIST_HEADERS 2 /* Fetches Minimal and Mailing List Headers. Default behavior */
111 #define IMAP_FETCH_MINIMAL_HEADERS 3
113 struct _CamelImapStore {
114 CamelDiscoStore parent_object;
116 CamelStream *istream;
117 CamelStream *ostream;
119 struct _CamelImapStoreSummary *summary;
121 /* Information about the command channel / connection status */
125 /* broken server - don't use BODY, dont use partial fetches for message retrival */
126 guint braindamaged:1;
128 /* broken server - wont let us append with custom flags even if the folder allows them */
129 guint nocustomappend:1;
133 CamelFolder *current_folder;
135 /* Information about the server */
136 CamelImapServerLevel server_level;
137 guint32 capabilities, parameters;
138 /* NB: namespace should be handled by summary->namespace */
139 char *namespace, dir_sep, *base_url, *storage_path;
140 GHashTable *authtypes;
142 time_t refresh_stamp;
145 char *custom_headers;
149 CamelDiscoStoreClass parent_class;
151 } CamelImapStoreClass;
154 /* Standard Camel function */
155 CamelType camel_imap_store_get_type (void);
158 gboolean camel_imap_store_connected (CamelImapStore *store, CamelException *ex);
160 ssize_t camel_imap_store_readline (CamelImapStore *store, char **dest, CamelException *ex);
164 #endif /* CAMEL_IMAP_STORE_H */