1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Authors: Jeffrey Stedfast <fejj@ximian.com>
5 * Copyright 2000 Ximian, Inc. (www.ximian.com)
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.
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.
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.
23 #ifndef CAMEL_IMAP_UTILS_H
24 #define CAMEL_IMAP_UTILS_H 1
26 #include <sys/types.h>
28 #include "camel-folder-summary.h"
29 #include "camel-imap-types.h"
33 const char *imap_next_word (const char *buf);
36 struct _namespace *next;
42 struct _namespace *personal;
43 struct _namespace *other;
44 struct _namespace *shared;
47 void imap_namespaces_destroy (struct _namespaces *namespaces);
48 struct _namespaces *imap_parse_namespace_response (const char *response);
50 gboolean imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags,
51 char *sep, char **folder);
53 char **imap_parse_folder_name (CamelImapStore *store, const char *folder_name);
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);
60 enum { IMAP_STRING, IMAP_NSTRING, IMAP_ASTRING };
62 char *imap_parse_string_generic (const char **str_p, size_t *len, int type);
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)
71 void imap_parse_body (const char **body_p, CamelFolder *folder,
72 CamelMessageContentInfo *ci);
74 gboolean imap_is_atom (const char *in);
75 char *imap_quote_string (const char *str);
77 void imap_skip_list (const char **str_p);
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);
83 char *imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix);
84 char *imap_namespace_concat (CamelImapStore *store, const char *name);
86 char *imap_mailbox_encode (const unsigned char *in, size_t inlen);
87 char *imap_mailbox_decode (const unsigned char *in, size_t inlen);
89 typedef gboolean (*IMAPPathFindFoldersCallback) (const char *physical_path, const char *path, gpointer user_data);
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);
96 #endif /* CAMEL_IMAP_UTILS_H */