2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
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.
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.
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.
26 #include <sys/types.h>
29 typedef struct _MsgInfo MsgInfo;
35 /* permanent flags (0x0000ffff) */
41 MSG_FORWARDED = 1 << 5,
42 MSG_REALLY_DELETED = 1 << 6,
44 MSG_LABEL = 1 << 9 | 1 << 8 | 1 << 7,
45 MSG_LABEL_NONE = 0 << 9 | 0 << 8 | 0 << 7,
46 MSG_LABEL_ORANGE = 0 << 9 | 0 << 8 | 1 << 7,
47 MSG_LABEL_RED = 0 << 9 | 1 << 8 | 0 << 7,
48 MSG_LABEL_PINK = 0 << 9 | 1 << 8 | 1 << 7,
49 MSG_LABEL_SKYBLUE = 1 << 9 | 0 << 8 | 0 << 7,
50 MSG_LABEL_BLUE = 1 << 9 | 0 << 8 | 1 << 7,
51 MSG_LABEL_GREEN = 1 << 9 | 1 << 8 | 0 << 7,
52 MSG_LABEL_BROWN = 1 << 9 | 1 << 8 | 1 << 7,
54 MSG_IGNORE_THREAD = 1 << 10,
56 /* temporary flags (0xffff0000) */
62 MSG_ENCRYPTED = 1 << 27,
69 #define MSG_PERMANENT_FLAG_MASK (MSG_NEW | \
75 MSG_REALLY_DELETED | \
78 #define MSG_CACHED_FLAG_MASK (MSG_MIME)
80 #define MSG_SET_FLAGS(msg, flags) { (msg) |= (flags); }
81 #define MSG_UNSET_FLAGS(msg, flags) { (msg) &= ~(flags); }
82 #define MSG_IS_NEW(msg) ((msg & MSG_NEW) != 0)
83 #define MSG_IS_UNREAD(msg) ((msg & MSG_UNREAD) != 0)
84 #define MSG_IS_MARKED(msg) ((msg & MSG_MARKED) != 0)
85 #define MSG_IS_DELETED(msg) ((msg & MSG_DELETED) != 0)
86 #define MSG_IS_REPLIED(msg) ((msg & MSG_REPLIED) != 0)
87 #define MSG_IS_FORWARDED(msg) ((msg & MSG_FORWARDED) != 0)
89 #define MSG_IS_MOVE(msg) ((msg & MSG_MOVE) != 0)
90 #define MSG_IS_COPY(msg) ((msg & MSG_COPY) != 0)
91 #define MSG_IS_REALLY_DELETED(msg) ((msg & MSG_REALLY_DELETED) != 0)
93 #define MSG_IS_QUEUED(msg) ((msg & MSG_QUEUED) != 0)
94 #define MSG_IS_DRAFT(msg) ((msg & MSG_DRAFT) != 0)
95 #define MSG_IS_ENCRYPTED(msg) ((msg & MSG_ENCRYPTED) != 0)
96 #define MSG_IS_IMAP(msg) ((msg & MSG_IMAP) != 0)
97 #define MSG_IS_MIME(msg) ((msg & MSG_MIME) != 0)
98 #define MSG_IS_NEWS(msg) ((msg & MSG_NEWS) != 0)
99 #define MSG_IS_CACHED(msg) ((msg & MSG_CACHED) != 0)
100 #define MSG_GET_LABEL(msg) (msg & MSG_LABEL)
101 #define MSG_IS_IGNORE_THREAD(msg) ((msg & MSG_IGNORE_THREAD) != 0)
103 #define WRITE_CACHE_DATA_INT(n, fp) \
104 fwrite(&n, sizeof(n), 1, fp)
106 #define WRITE_CACHE_DATA(data, fp) \
110 if (data == NULL || (len = strlen(data)) == 0) { \
112 WRITE_CACHE_DATA_INT(len, fp); \
114 len = strlen(data); \
115 WRITE_CACHE_DATA_INT(len, fp); \
116 fwrite(data, len, 1, fp); \
140 FolderItem *to_folder;
144 gchar *dispositionnotificationto;
145 gchar *returnreceiptto;
153 /* used only for encrypted messages */
154 gchar *plaintext_file;
155 guint decryption_failed : 1;
158 GHashTable *procmsg_msg_hash_table_create (GSList *mlist);
159 void procmsg_msg_hash_table_append (GHashTable *msg_table,
161 GHashTable *procmsg_to_folder_hash_table_create (GSList *mlist);
163 GSList *procmsg_read_cache (FolderItem *item,
165 void procmsg_set_flags (GSList *mlist,
167 gint procmsg_get_last_num_in_cache (GSList *mlist);
168 void procmsg_msg_list_free (GSList *mlist);
169 void procmsg_write_cache (MsgInfo *msginfo,
171 void procmsg_write_flags (MsgInfo *msginfo,
173 void procmsg_get_mark_sum (const gchar *folder,
177 FILE *procmsg_open_mark_file (const gchar *folder,
180 void procmsg_move_messages (GSList *mlist);
181 void procmsg_copy_messages (GSList *mlist);
183 gchar *procmsg_get_message_file_path (MsgInfo *msginfo);
184 gchar *procmsg_get_message_file (MsgInfo *msginfo);
185 FILE *procmsg_open_message (MsgInfo *msginfo);
186 gboolean procmsg_msg_exist (MsgInfo *msginfo);
188 void procmsg_empty_trash (void);
189 gint procmsg_send_queue (void);
190 void procmsg_print_message (MsgInfo *msginfo,
191 const gchar *cmdline);
193 MsgInfo *procmsg_msginfo_copy (MsgInfo *msginfo);
194 void procmsg_msginfo_free (MsgInfo *msginfo);
196 gint procmsg_cmp_msgnum_for_sort (gconstpointer a,
199 #endif /* __PROCMSG_H__ */