*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifndef __PROCMSG_H__
#define MSG_DELETED (1U << 3)
#define MSG_REPLIED (1U << 4)
#define MSG_FORWARDED (1U << 5)
-#define MSG_POSTFILTERED (1U << 14)
-#define MSG_CLABEL_SBIT (7) /* start bit of color label */
-#define MAKE_MSG_CLABEL(h, m, l) (((h) << (MSG_CLABEL_SBIT + 2)) | \
- ((m) << (MSG_CLABEL_SBIT + 1)) | \
- ((l) << (MSG_CLABEL_SBIT + 0)))
-
-#define MSG_CLABEL_NONE MAKE_MSG_CLABEL(0U, 0U, 0U)
-#define MSG_CLABEL_1 MAKE_MSG_CLABEL(0U, 0U, 1U)
-#define MSG_CLABEL_2 MAKE_MSG_CLABEL(0U, 1U, 0U)
-#define MSG_CLABEL_3 MAKE_MSG_CLABEL(0U, 1U, 1U)
-#define MSG_CLABEL_4 MAKE_MSG_CLABEL(1U, 0U, 0U)
-#define MSG_CLABEL_5 MAKE_MSG_CLABEL(1U, 0U, 1U)
-#define MSG_CLABEL_6 MAKE_MSG_CLABEL(1U, 1U, 0U)
-#define MSG_CLABEL_7 MAKE_MSG_CLABEL(1U, 1U, 1U)
-
-#define MSG_CLABEL_ORANGE MSG_CLABEL_1
-#define MSG_CLABEL_RED MSG_CLABEL_2
-#define MSG_CLABEL_PINK MSG_CLABEL_3
-#define MSG_CLABEL_SKYBLUE MSG_CLABEL_4
-#define MSG_CLABEL_BLUE MSG_CLABEL_5
-#define MSG_CLABEL_GREEN MSG_CLABEL_6
-#define MSG_CLABEL_BROWN MSG_CLABEL_7
+#define MSG_CLABEL_SBIT (6) /* start bit of color label */
+/* color labels use 4 bits: 6, 7, 8, 9; bit weight is 7<8<9<6,
+ IOW the color label value itself must be computed from MsgPermFlags
+ bits like this:
+ value = bit-7-value*2^0
+ + bit-8-value*2^1
+ + bit-9-value*2^2
+ + bit-6-value*2^3 */
+
+/* color label permflags masks */
+#define MAKE_MSG_CLABEL(x, h, m, l) (\
+ ((x) << (MSG_CLABEL_SBIT + 0)) | \
+ ((h) << (MSG_CLABEL_SBIT + 3)) | \
+ ((m) << (MSG_CLABEL_SBIT + 2)) | \
+ ((l) << (MSG_CLABEL_SBIT + 1)))
+#define MSG_CLABEL_NONE MAKE_MSG_CLABEL(0U, 0U, 0U, 0U)
+#define MSG_CLABEL_1 MAKE_MSG_CLABEL(0U, 0U, 0U, 1U)
+#define MSG_CLABEL_2 MAKE_MSG_CLABEL(0U, 0U, 1U, 0U)
+#define MSG_CLABEL_3 MAKE_MSG_CLABEL(0U, 0U, 1U, 1U)
+#define MSG_CLABEL_4 MAKE_MSG_CLABEL(0U, 1U, 0U, 0U)
+#define MSG_CLABEL_5 MAKE_MSG_CLABEL(0U, 1U, 0U, 1U)
+#define MSG_CLABEL_6 MAKE_MSG_CLABEL(0U, 1U, 1U, 0U)
+#define MSG_CLABEL_7 MAKE_MSG_CLABEL(0U, 1U, 1U, 1U)
+#define MSG_CLABEL_8 MAKE_MSG_CLABEL(1U, 0U, 0U, 0U)
+#define MSG_CLABEL_9 MAKE_MSG_CLABEL(1U, 0U, 0U, 1U)
+#define MSG_CLABEL_10 MAKE_MSG_CLABEL(1U, 0U, 1U, 0U)
+#define MSG_CLABEL_11 MAKE_MSG_CLABEL(1U, 0U, 1U, 1U)
+#define MSG_CLABEL_12 MAKE_MSG_CLABEL(1U, 1U, 0U, 0U)
+#define MSG_CLABEL_13 MAKE_MSG_CLABEL(1U, 1U, 0U, 1U)
+#define MSG_CLABEL_14 MAKE_MSG_CLABEL(1U, 1U, 1U, 0U)
+#define MSG_CLABEL_15 MAKE_MSG_CLABEL(1U, 1U, 1U, 1U)
+#define MSG_CLABEL_FLAG_MASK (MSG_CLABEL_15)
#define MSG_IGNORE_THREAD (1U << 10) /* ignore threads */
#define MSG_LOCKED (1U << 11) /* msg is locked */
#define MSG_RETRCPT_SENT (1U << 12) /* new one */
#define MSG_SPAM (1U << 13) /* new one */
+#define MSG_POSTFILTERED (1U << 14)
+#define MSG_WATCH_THREAD (1U << 15) /* watch threads */
/* RESERVED */
#define MSG_RESERVED_CLAWS (1U << 30) /* for claws-mail */
typedef guint32 MsgPermFlags;
-#define MSG_CLABEL_FLAG_MASK (MSG_CLABEL_7)
-
#define MSG_MOVE (1U << 0)
#define MSG_COPY (1U << 1)
#define MSG_MOVE_DONE (1U << 15)
#define MSG_IS_FORWARDED(msg) (((msg).perm_flags & MSG_FORWARDED) != 0)
#define MSG_IS_POSTFILTERED(msg) (((msg).perm_flags & MSG_POSTFILTERED) != 0)
+/* color label decoding/encoding (permflag storage bits <-> color list index value)*/
+#define MSG_COLORLABEL_TO_FLAGS(val) (((((guint)(val)) & 7) << (MSG_CLABEL_SBIT+1)) \
+ | (((guint)(val) & 8) << (MSG_CLABEL_SBIT-3)))
+#define MSG_COLORLABEL_FROM_FLAGS(val) ((((guint)(val) >> (MSG_CLABEL_SBIT+1)) & 7 ) \
+ | (((guint)(val) >> (MSG_CLABEL_SBIT-3)) & 8))
#define MSG_GET_COLORLABEL(msg) (((msg).perm_flags & MSG_CLABEL_FLAG_MASK))
-#define MSG_GET_COLORLABEL_VALUE(msg) (MSG_GET_COLORLABEL(msg) >> MSG_CLABEL_SBIT)
-#define MSG_SET_COLORLABEL_VALUE(msg, val) \
- MSG_SET_PERM_FLAGS(msg, ((((guint)(val)) & 7) << MSG_CLABEL_SBIT))
-
-#define MSG_COLORLABEL_TO_FLAGS(val) ((((guint)(val)) & 7) << MSG_CLABEL_SBIT)
-#define MSG_COLORLABEL_FROM_FLAGS(val) (val >> MSG_CLABEL_SBIT)
+#define MSG_GET_COLORLABEL_VALUE(msg) (MSG_COLORLABEL_FROM_FLAGS(MSG_GET_COLORLABEL(msg)))
+#define MSG_SET_COLORLABEL_VALUE(msg, val) MSG_SET_PERM_FLAGS(msg, MSG_COLORLABEL_TO_FLAGS(val))
#define MSG_IS_MOVE(msg) (((msg).tmp_flags & MSG_MOVE) != 0)
#define MSG_IS_COPY(msg) (((msg).tmp_flags & MSG_COPY) != 0)
#define MSG_IS_RETRCPT_PENDING(msg) (((msg).perm_flags & MSG_RETRCPT_PENDING) != 0)
#define MSG_IS_RETRCPT_SENT(msg) (((msg).perm_flags & MSG_RETRCPT_SENT) != 0)
#define MSG_IS_SPAM(msg) (((msg).perm_flags & MSG_SPAM) != 0)
+#define MSG_IS_WATCH_THREAD(msg) (((msg).perm_flags & MSG_WATCH_THREAD) != 0)
#define MSGINFO_UPDATE_HOOKLIST "msginfo_update"
#define MAIL_FILTERING_HOOKLIST "mail_filtering_hooklist"
off_t size;
time_t mtime;
time_t date_t;
+ time_t thread_date;
MsgFlags flags;
gint total_size;
gint planned_download;
+ GSList *tags;
+
MsgInfoExtraData *extradata;
};
GSList *msglist;
GSList *filtered;
GSList *unfiltered;
+ PrefsAccount *account;
};
-GHashTable *procmsg_msg_hash_table_create (GSList *mlist);
-void procmsg_msg_hash_table_append (GHashTable *msg_table,
- GSList *mlist);
-GHashTable *procmsg_to_folder_hash_table_create (GSList *mlist);
-
GSList *procmsg_read_cache (FolderItem *item,
gboolean scan_file);
-gint procmsg_get_last_num_in_msg_list(GSList *mlist);
void procmsg_msg_list_free (GSList *mlist);
void procmsg_get_mark_sum (const gchar *folder,
gint *new_msgs,
gchar **key,
PrefsFilterType type);
-void procmsg_empty_trash (FolderItem *trash);
void procmsg_empty_all_trash (void);
gint procmsg_send_queue (FolderItem *queue,
gboolean save_msgs,
gchar **errstr);
gboolean procmsg_queue_is_empty (FolderItem *queue);
-gint procmsg_save_to_outbox (FolderItem *outbox,
- const gchar *file,
- gboolean is_queued);
void procmsg_print_message (MsgInfo *msginfo,
const gchar *cmdline);
void procmsg_msginfo_free (MsgInfo *msginfo);
guint procmsg_msginfo_memusage (MsgInfo *msginfo);
-gint procmsg_cmp_msgnum_for_sort (gconstpointer a,
- gconstpointer b);
gint procmsg_send_message_queue (const gchar *file,
gchar **errstr,
FolderItem *queue,
gboolean procmsg_msg_has_flagged_parent (MsgInfo *info,
MsgPermFlags perm_flags);
gboolean procmsg_msg_has_marked_parent (MsgInfo *info);
-GSList *procmsg_find_children (MsgInfo *info);
-void procmsg_update_unread_children (MsgInfo *info,
- gboolean newly_marked);
void procmsg_msginfo_set_to_folder (MsgInfo *msginfo,
FolderItem *to_folder);
-gboolean procmsg_msginfo_filter (MsgInfo *msginfo,
- PrefsAccount *ac_prefs);
void procmsg_msglist_filter (GSList *list,
PrefsAccount *ac,
GSList **filtered,
void procmsg_register_spam_learner (int (*learn_func)(MsgInfo *info, GSList *list, gboolean spam));
void procmsg_unregister_spam_learner (int (*learn_func)(MsgInfo *info, GSList *list, gboolean spam));
gboolean procmsg_spam_can_learn (void);
-void procmsg_spam_set_folder (const char *item_identifier);
-FolderItem *procmsg_spam_get_folder (void);
+void procmsg_spam_set_folder (const char *item_identifier, FolderItem *(*spam_get_folder_func)(MsgInfo *info));
+FolderItem *procmsg_spam_get_folder (MsgInfo *msginfo);
int procmsg_spam_learner_learn (MsgInfo *msginfo, GSList *msglist, gboolean spam);
gboolean procmsg_have_queued_mails_fast (void);
+gboolean procmsg_have_trashed_mails_fast (void);
gboolean procmsg_is_sending(void);
-
+gchar *procmsg_msginfo_get_tags_str(MsgInfo *msginfo);
+void procmsg_msginfo_update_tags(MsgInfo *msginfo, gboolean set, gint id);
+void procmsg_msginfo_clear_tags(MsgInfo *msginfo);
#endif /* __PROCMSG_H__ */