Statistics
| Revision:

root / src / imap.h @ 1

History | View | Annotate | Download (2.7 KB)

1
/*
2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2003 Hiroyuki Yamamoto
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program 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
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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
} IMAPAuthType;
48

    
49
struct _IMAPFolder
50
{
51
        RemoteFolder rfolder;
52

    
53
        /* list of IMAPNameSpace */
54
        GList *ns_personal;
55
        GList *ns_others;
56
        GList *ns_shared;
57
};
58

    
59
struct _IMAPSession
60
{
61
        Session session;
62

    
63
        gboolean authenticated;
64

    
65
        gchar **capability;
66
        gboolean uidplus;
67

    
68
        gchar *mbox;
69
        guint cmd_count;
70
};
71

    
72
struct _IMAPNameSpace
73
{
74
        gchar *name;
75
        gchar separator;
76
};
77

    
78
#define IMAP_SUCCESS        0
79
#define IMAP_SOCKET        2
80
#define IMAP_AUTHFAIL        3
81
#define IMAP_PROTOCOL        4
82
#define IMAP_SYNTAX        5
83
#define IMAP_IOERR        6
84
#define IMAP_ERROR        7
85

    
86
#define IMAPBUFSIZE        8192
87

    
88
typedef enum
89
{
90
        IMAP_FLAG_SEEN                = 1 << 0,
91
        IMAP_FLAG_ANSWERED        = 1 << 1,
92
        IMAP_FLAG_FLAGGED        = 1 << 2,
93
        IMAP_FLAG_DELETED        = 1 << 3,
94
        IMAP_FLAG_DRAFT                = 1 << 4
95
} IMAPFlags;
96

    
97
#define IMAP_IS_SEEN(flags)        ((flags & IMAP_FLAG_SEEN) != 0)
98
#define IMAP_IS_ANSWERED(flags)        ((flags & IMAP_FLAG_ANSWERED) != 0)
99
#define IMAP_IS_FLAGGED(flags)        ((flags & IMAP_FLAG_FLAGGED) != 0)
100
#define IMAP_IS_DELETED(flags)        ((flags & IMAP_FLAG_DELETED) != 0)
101
#define IMAP_IS_DRAFT(flags)        ((flags & IMAP_FLAG_DRAFT) != 0)
102

    
103
FolderClass *imap_get_class                (void);
104

    
105
gint imap_msg_set_perm_flags                (MsgInfo        *msginfo,
106
                                         MsgPermFlags         flags);
107
gint imap_msg_unset_perm_flags                (MsgInfo        *msginfo,
108
                                         MsgPermFlags         flags);
109
gint imap_msg_list_set_perm_flags        (GSList                *msglist,
110
                                         MsgPermFlags         flags);
111
gint imap_msg_list_unset_perm_flags        (GSList                *msglist,
112
                                         MsgPermFlags         flags);
113

    
114
#endif /* __IMAP_H__ */