Statistics
| Revision:

root / libsylph / imap.h @ 1491

History | View | Annotate | Download (2.7 kB)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2007 Hiroyuki Yamamoto
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef __IMAP_H__
21
#define __IMAP_H__
22
23
#ifdef HAVE_CONFIG_H
24
#  include "config.h"
25
#endif
26
27
#include <glib.h>
28
#include <time.h>
29
30
#include "folder.h"
31
#include "session.h"
32
#include "procmsg.h"
33
34
typedef struct _IMAPFolder        IMAPFolder;
35
typedef struct _IMAPSession        IMAPSession;
36
typedef struct _IMAPNameSpace        IMAPNameSpace;
37
38
#define IMAP_FOLDER(obj)        ((IMAPFolder *)obj)
39
#define IMAP_SESSION(obj)        ((IMAPSession *)obj)
40
41
#include "prefs_account.h"
42
43
typedef enum
44
{
45
        IMAP_AUTH_LOGIN                = 1 << 0,
46
        IMAP_AUTH_CRAM_MD5        = 1 << 1,
47
        IMAP_AUTH_PLAIN                = 1 << 2
48
} IMAPAuthType;
49
50
struct _IMAPFolder
51
{
52
        RemoteFolder rfolder;
53
54
        /* list of IMAPNameSpace */
55
        GList *ns_personal;
56
        GList *ns_others;
57
        GList *ns_shared;
58
};
59
60
struct _IMAPSession
61
{
62
        Session session;
63
64
        gboolean authenticated;
65
66
        gchar **capability;
67
        gboolean uidplus;
68
69
        gchar *mbox;
70
        guint cmd_count;
71
};
72
73
struct _IMAPNameSpace
74
{
75
        gchar *name;
76
        gchar separator;
77
};
78
79
#define IMAP_SUCCESS        0
80
#define IMAP_SOCKET        2
81
#define IMAP_AUTHFAIL        3
82
#define IMAP_PROTOCOL        4
83
#define IMAP_SYNTAX        5
84
#define IMAP_IOERR        6
85
#define IMAP_ERROR        7
86
87
#define IMAPBUFSIZE        8192
88
89
typedef enum
90
{
91
        IMAP_FLAG_SEEN                = 1 << 0,
92
        IMAP_FLAG_ANSWERED        = 1 << 1,
93
        IMAP_FLAG_FLAGGED        = 1 << 2,
94
        IMAP_FLAG_DELETED        = 1 << 3,
95
        IMAP_FLAG_DRAFT                = 1 << 4
96
} IMAPFlags;
97
98
#define IMAP_IS_SEEN(flags)        ((flags & IMAP_FLAG_SEEN) != 0)
99
#define IMAP_IS_ANSWERED(flags)        ((flags & IMAP_FLAG_ANSWERED) != 0)
100
#define IMAP_IS_FLAGGED(flags)        ((flags & IMAP_FLAG_FLAGGED) != 0)
101
#define IMAP_IS_DELETED(flags)        ((flags & IMAP_FLAG_DELETED) != 0)
102
#define IMAP_IS_DRAFT(flags)        ((flags & IMAP_FLAG_DRAFT) != 0)
103
104
FolderClass *imap_get_class                (void);
105
106
gint imap_msg_set_perm_flags                (MsgInfo        *msginfo,
107
                                         MsgPermFlags         flags);
108
gint imap_msg_unset_perm_flags                (MsgInfo        *msginfo,
109
                                         MsgPermFlags         flags);
110
gint imap_msg_list_set_perm_flags        (GSList                *msglist,
111
                                         MsgPermFlags         flags);
112
gint imap_msg_list_unset_perm_flags        (GSList                *msglist,
113
                                         MsgPermFlags         flags);
114
115
#endif /* __IMAP_H__ */