Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / imap / camel-imap-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  *  Authors: Jeffrey Stedfast <fejj@ximian.com>
4  *
5  *  Copyright 2000 Ximian, Inc. (www.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
23 #ifndef CAMEL_IMAP_UTILS_H
24 #define CAMEL_IMAP_UTILS_H 1
25
26 #include <sys/types.h>
27
28 #include "camel-folder-summary.h"
29 #include "camel-imap-types.h"
30
31 G_BEGIN_DECLS
32
33 const char *imap_next_word (const char *buf);
34
35 struct _namespace {
36         struct _namespace *next;
37         char *prefix;
38         char delim;
39 };
40
41 struct _namespaces {
42         struct _namespace *personal;
43         struct _namespace *other;
44         struct _namespace *shared;
45 };
46
47 void imap_namespaces_destroy (struct _namespaces *namespaces);
48 struct _namespaces *imap_parse_namespace_response (const char *response);
49
50 gboolean imap_parse_list_response  (CamelImapStore *store, const char *buf, int *flags,
51                                     char *sep, char **folder);
52
53 char   **imap_parse_folder_name    (CamelImapStore *store, const char *folder_name);
54
55 guint32 imap_label_to_flags(CamelMessageInfo *info);
56 char    *imap_create_flag_list     (guint32 flags);
57 guint32  imap_parse_flag_list      (char **flag_list);
58
59
60 enum { IMAP_STRING, IMAP_NSTRING, IMAP_ASTRING };
61
62 char    *imap_parse_string_generic (const char **str_p, size_t *len, int type);
63
64 #define imap_parse_string(str_p, len_p) \
65         imap_parse_string_generic (str_p, len_p, IMAP_STRING)
66 #define imap_parse_nstring(str_p, len_p) \
67         imap_parse_string_generic (str_p, len_p, IMAP_NSTRING)
68 #define imap_parse_astring(str_p, len_p) \
69         imap_parse_string_generic (str_p, len_p, IMAP_ASTRING)
70
71 void     imap_parse_body           (const char **body_p, CamelFolder *folder,
72                                     CamelMessageContentInfo *ci);
73
74 gboolean imap_is_atom              (const char *in);
75 char    *imap_quote_string         (const char *str);
76
77 void     imap_skip_list            (const char **str_p);
78
79 char    *imap_uid_array_to_set     (CamelFolderSummary *summary, GPtrArray *uids, int uid, ssize_t maxlen, int *lastuid);
80 GPtrArray *imap_uid_set_to_array   (CamelFolderSummary *summary, const char *uids);
81 void     imap_uid_array_free       (GPtrArray *arr);
82
83 char *imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix);
84 char *imap_namespace_concat (CamelImapStore *store, const char *name);
85
86 char *imap_mailbox_encode (const unsigned char *in, size_t inlen);
87 char *imap_mailbox_decode (const unsigned char *in, size_t inlen);
88
89 typedef gboolean (*IMAPPathFindFoldersCallback) (const char *physical_path, const char *path, gpointer user_data);
90
91 char *imap_path_to_physical (const char *prefix, const char *vpath);
92 gboolean imap_path_find_folders (const char *prefix, IMAPPathFindFoldersCallback callback, gpointer data);
93
94 G_END_DECLS
95
96 #endif /* CAMEL_IMAP_UTILS_H */