Statistics
| Revision:

root / libsylph / imap.h @ 2356

History | View | Annotate | Download (2.7 kB)

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