diff options
| author | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
| commit | 0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch) | |
| tree | af916a30553c78ce9d4f2d8658656a175c5b6921 /libsylph/imap.h | |
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'libsylph/imap.h')
| -rw-r--r-- | libsylph/imap.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/libsylph/imap.h b/libsylph/imap.h new file mode 100644 index 0000000..ac928b4 --- /dev/null +++ b/libsylph/imap.h | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | /* | ||
| 2 | * LibSylph -- E-Mail client library | ||
| 3 | * Copyright (C) 1999-2011 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 | #define IMAP_EAGAIN 8 | ||
| 87 | |||
| 88 | #define IMAPBUFSIZE 8192 | ||
| 89 | |||
| 90 | typedef enum | ||
| 91 | { | ||
| 92 | IMAP_FLAG_SEEN = 1 << 0, | ||
| 93 | IMAP_FLAG_ANSWERED = 1 << 1, | ||
| 94 | IMAP_FLAG_FLAGGED = 1 << 2, | ||
| 95 | IMAP_FLAG_DELETED = 1 << 3, | ||
| 96 | IMAP_FLAG_DRAFT = 1 << 4, | ||
| 97 | |||
| 98 | /* color label keywords : 1 << 7 ... 1 << 9 | ||
| 99 | compatible with procmsg.h: MSG_CLABEL* macros */ | ||
| 100 | } IMAPFlags; | ||
| 101 | |||
| 102 | #define IMAP_IS_SEEN(flags) ((flags & IMAP_FLAG_SEEN) != 0) | ||
| 103 | #define IMAP_IS_ANSWERED(flags) ((flags & IMAP_FLAG_ANSWERED) != 0) | ||
| 104 | #define IMAP_IS_FLAGGED(flags) ((flags & IMAP_FLAG_FLAGGED) != 0) | ||
| 105 | #define IMAP_IS_DELETED(flags) ((flags & IMAP_FLAG_DELETED) != 0) | ||
| 106 | #define IMAP_IS_DRAFT(flags) ((flags & IMAP_FLAG_DRAFT) != 0) | ||
| 107 | |||
| 108 | #define IMAP_GET_COLORLABEL(flags) (flags & (7 << MSG_CLABEL_SBIT)) | ||
| 109 | #define IMAP_GET_COLORLABEL_VALUE(flags) \ | ||
| 110 | (IMAP_GET_COLORLABEL(flags) >> MSG_CLABEL_SBIT) | ||
| 111 | #define IMAP_SET_COLORLABEL_VALUE(flags, v) \ | ||
| 112 | ((flags) |= ((v & 7) << MSG_CLABEL_SBIT)) | ||
| 113 | |||
| 114 | FolderClass *imap_get_class (void); | ||
| 115 | |||
| 116 | gint imap_msg_set_perm_flags (MsgInfo *msginfo, | ||
| 117 | MsgPermFlags flags); | ||
| 118 | gint imap_msg_unset_perm_flags (MsgInfo *msginfo, | ||
| 119 | MsgPermFlags flags); | ||
| 120 | gint imap_msg_list_set_perm_flags (GSList *msglist, | ||
| 121 | MsgPermFlags flags); | ||
| 122 | gint imap_msg_list_unset_perm_flags (GSList *msglist, | ||
| 123 | MsgPermFlags flags); | ||
| 124 | |||
| 125 | gint imap_msg_list_set_colorlabel_flags (GSList *msglist, | ||
| 126 | guint color); | ||
| 127 | |||
| 128 | gboolean imap_is_session_active (IMAPFolder *folder); | ||
| 129 | |||
| 130 | #endif /* __IMAP_H__ */ | ||
