Statistics
| Revision:

root / libsylph / imap.h @ 1005

History | View | Annotate | Download (2.7 kB)

1 1 hiro
/*
2 578 hiro
 * LibSylph -- E-Mail client library
3 578 hiro
 * Copyright (C) 1999-2005 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 1 hiro
        IMAP_AUTH_CRAM_MD5        = 1 << 1
47 1 hiro
} IMAPAuthType;
48 1 hiro
49 1 hiro
struct _IMAPFolder
50 1 hiro
{
51 1 hiro
        RemoteFolder rfolder;
52 1 hiro
53 1 hiro
        /* list of IMAPNameSpace */
54 1 hiro
        GList *ns_personal;
55 1 hiro
        GList *ns_others;
56 1 hiro
        GList *ns_shared;
57 1 hiro
};
58 1 hiro
59 1 hiro
struct _IMAPSession
60 1 hiro
{
61 1 hiro
        Session session;
62 1 hiro
63 1 hiro
        gboolean authenticated;
64 1 hiro
65 1 hiro
        gchar **capability;
66 1 hiro
        gboolean uidplus;
67 1 hiro
68 1 hiro
        gchar *mbox;
69 1 hiro
        guint cmd_count;
70 1 hiro
};
71 1 hiro
72 1 hiro
struct _IMAPNameSpace
73 1 hiro
{
74 1 hiro
        gchar *name;
75 1 hiro
        gchar separator;
76 1 hiro
};
77 1 hiro
78 1 hiro
#define IMAP_SUCCESS        0
79 1 hiro
#define IMAP_SOCKET        2
80 1 hiro
#define IMAP_AUTHFAIL        3
81 1 hiro
#define IMAP_PROTOCOL        4
82 1 hiro
#define IMAP_SYNTAX        5
83 1 hiro
#define IMAP_IOERR        6
84 1 hiro
#define IMAP_ERROR        7
85 1 hiro
86 1 hiro
#define IMAPBUFSIZE        8192
87 1 hiro
88 1 hiro
typedef enum
89 1 hiro
{
90 1 hiro
        IMAP_FLAG_SEEN                = 1 << 0,
91 1 hiro
        IMAP_FLAG_ANSWERED        = 1 << 1,
92 1 hiro
        IMAP_FLAG_FLAGGED        = 1 << 2,
93 1 hiro
        IMAP_FLAG_DELETED        = 1 << 3,
94 1 hiro
        IMAP_FLAG_DRAFT                = 1 << 4
95 1 hiro
} IMAPFlags;
96 1 hiro
97 1 hiro
#define IMAP_IS_SEEN(flags)        ((flags & IMAP_FLAG_SEEN) != 0)
98 1 hiro
#define IMAP_IS_ANSWERED(flags)        ((flags & IMAP_FLAG_ANSWERED) != 0)
99 1 hiro
#define IMAP_IS_FLAGGED(flags)        ((flags & IMAP_FLAG_FLAGGED) != 0)
100 1 hiro
#define IMAP_IS_DELETED(flags)        ((flags & IMAP_FLAG_DELETED) != 0)
101 1 hiro
#define IMAP_IS_DRAFT(flags)        ((flags & IMAP_FLAG_DRAFT) != 0)
102 1 hiro
103 1 hiro
FolderClass *imap_get_class                (void);
104 1 hiro
105 1 hiro
gint imap_msg_set_perm_flags                (MsgInfo        *msginfo,
106 1 hiro
                                         MsgPermFlags         flags);
107 1 hiro
gint imap_msg_unset_perm_flags                (MsgInfo        *msginfo,
108 1 hiro
                                         MsgPermFlags         flags);
109 1 hiro
gint imap_msg_list_set_perm_flags        (GSList                *msglist,
110 1 hiro
                                         MsgPermFlags         flags);
111 1 hiro
gint imap_msg_list_unset_perm_flags        (GSList                *msglist,
112 1 hiro
                                         MsgPermFlags         flags);
113 1 hiro
114 1 hiro
#endif /* __IMAP_H__ */