X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=blobdiff_plain;f=src%2Fprocmsg.h;h=fef815ffd82ef605adcf3add8240a41789bf9297;hp=f493b98838fc1859eea5c7eb45bd7b427b401d5e;hb=72387ad26c74ac501ec9f5ce925273275379a115;hpb=c41017a0bd664e6dfd99ebb7201c44122a31097f;ds=sidebyside diff --git a/src/procmsg.h b/src/procmsg.h index f493b9883..fef815ffd 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2002 Hiroyuki Yamamoto + * Copyright (C) 1999-2003 Hiroyuki Yamamoto * * 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 @@ -30,36 +30,35 @@ #include #include -typedef struct _MsgInfo MsgInfo; -typedef struct _MsgFlags MsgFlags; +typedef struct _MsgInfo MsgInfo; +typedef struct _MsgFlags MsgFlags; +typedef struct _MsgInfoUpdate MsgInfoUpdate; +typedef struct _MailFilteringData MailFilteringData; -#include "folder.h" -#include "procmime.h" +typedef GSList MsgInfoList; +typedef GSList MsgNumberList; -typedef enum -{ - MSG_NEW = 1 << 0, - MSG_UNREAD = 1 << 1, - MSG_MARKED = 1 << 2, - MSG_DELETED = 1 << 3, - MSG_REPLIED = 1 << 4, - MSG_FORWARDED = 1 << 5, - - MSG_REALLY_DELETED = 1 << 6, /* mbox stuff */ +#define MSG_NEW (1U << 0) +#define MSG_UNREAD (1U << 1) +#define MSG_MARKED (1U << 2) +#define MSG_DELETED (1U << 3) +#define MSG_REPLIED (1U << 4) +#define MSG_FORWARDED (1U << 5) +#define MSG_REALLY_DELETED (1U << 6) /* mbox stuff */ #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))) - MSG_CLABEL_NONE = MAKE_MSG_CLABEL(0, 0, 0), - MSG_CLABEL_1 = MAKE_MSG_CLABEL(0, 0, 1), - MSG_CLABEL_2 = MAKE_MSG_CLABEL(0, 1, 0), - MSG_CLABEL_3 = MAKE_MSG_CLABEL(0, 1, 1), - MSG_CLABEL_4 = MAKE_MSG_CLABEL(1, 0, 0), - MSG_CLABEL_5 = MAKE_MSG_CLABEL(1, 0, 1), - MSG_CLABEL_6 = MAKE_MSG_CLABEL(1, 1, 0), - MSG_CLABEL_7 = MAKE_MSG_CLABEL(1, 1, 1), +#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 @@ -69,33 +68,29 @@ typedef enum #define MSG_CLABEL_GREEN MSG_CLABEL_6 #define MSG_CLABEL_BROWN MSG_CLABEL_7 - MSG_IGNORE_THREAD = 1 << 10, /* ignore threads */ - MSG_LOCKED = 1 << 11, /* msg is locked */ - MSG_RETRCPT_PENDING = 1 << 12, /* return receipt pending */ +#define MSG_IGNORE_THREAD (1U << 10) /* ignore threads */ +#define MSG_LOCKED (1U << 11) /* msg is locked */ +#define MSG_RETRCPT_PENDING (1U << 12) /* return receipt pending */ +/* RESERVED */ +#define MSG_RESERVED_CLAWS (1U << 30) /* for sylpheed-claws */ +#define MSG_RESERVED (1U << 31) - /* RESERVED */ - MSG_RESERVED_CLAWS = 1 << 30, /* for sylpheed-claws */ - MSG_RESERVED_MAIN = 1 << 31 /* for sylpheed-main */ -} MsgPermFlags; +typedef guint32 MsgPermFlags; #define MSG_CLABEL_FLAG_MASK (MSG_CLABEL_7) -typedef enum -{ - MSG_MOVE = 1 << 0, - MSG_COPY = 1 << 1, - - MSG_QUEUED = 1 << 16, - MSG_DRAFT = 1 << 17, - MSG_ENCRYPTED = 1 << 18, - MSG_IMAP = 1 << 19, - MSG_NEWS = 1 << 20, - MSG_SIGNED = 1 << 21, +#define MSG_MOVE (1U << 0) +#define MSG_COPY (1U << 1) +#define MSG_QUEUED (1U << 16) +#define MSG_DRAFT (1U << 17) +#define MSG_ENCRYPTED (1U << 18) +#define MSG_IMAP (1U << 19) +#define MSG_NEWS (1U << 20) +#define MSG_SIGNED (1U << 21) +#define MSG_MIME (1U << 29) +#define MSG_CACHED (1U << 31) - MSG_MIME = 1 << 29, - - MSG_CACHED = 1 << 31 -} MsgTmpFlags; +typedef guint32 MsgTmpFlags; #define MSG_CACHED_FLAG_MASK (MSG_MIME | MSG_ENCRYPTED | MSG_SIGNED) @@ -143,23 +138,12 @@ typedef enum #define MSG_IS_IGNORE_THREAD(msg) (((msg).perm_flags & MSG_IGNORE_THREAD) != 0) #define MSG_IS_RETRCPT_PENDING(msg) (((msg).perm_flags & MSG_RETRCPT_PENDING) != 0) +#define MSGINFO_UPDATE_HOOKLIST "msginfo_update" +#define MAIL_FILTERING_HOOKLIST "mail_filtering_hooklist" -#define WRITE_CACHE_DATA_INT(n, fp) \ - fwrite(&n, sizeof(n), 1, fp) - -#define WRITE_CACHE_DATA(data, fp) \ -{ \ - gint len; \ - \ - if (data == NULL || (len = strlen(data)) == 0) { \ - len = 0; \ - WRITE_CACHE_DATA_INT(len, fp); \ - } else { \ - len = strlen(data); \ - WRITE_CACHE_DATA_INT(len, fp); \ - fwrite(data, len, 1, fp); \ - } \ -} +#include "folder.h" +#include "procmime.h" +#include "prefs_filtering.h" struct _MsgFlags { @@ -167,6 +151,7 @@ struct _MsgFlags MsgTmpFlags tmp_flags; }; + struct _MsgInfo { guint refcnt; @@ -209,6 +194,15 @@ struct _MsgInfo guint decryption_failed : 1; }; +struct _MsgInfoUpdate { + MsgInfo *msginfo; +}; + +struct _MailFilteringData +{ + MsgInfo *msginfo; +}; + GHashTable *procmsg_msg_hash_table_create (GSList *mlist); void procmsg_msg_hash_table_append (GHashTable *msg_table, GSList *mlist); @@ -216,28 +210,15 @@ GHashTable *procmsg_to_folder_hash_table_create (GSList *mlist); GSList *procmsg_read_cache (FolderItem *item, gboolean scan_file); -void procmsg_set_flags (GSList *mlist, - FolderItem *item); gint procmsg_get_last_num_in_msg_list(GSList *mlist); void procmsg_msg_list_free (GSList *mlist); -void procmsg_write_cache (MsgInfo *msginfo, - FILE *fp); -void procmsg_write_flags (MsgInfo *msginfo, - FILE *fp); -void procmsg_flush_mark_queue (FolderItem *item, - FILE *fp); -void procmsg_add_flags (FolderItem *item, - gint num, - MsgFlags flags); void procmsg_get_mark_sum (const gchar *folder, - gint *new, - gint *unread, - gint *total, + gint *new_msgs, + gint *unread_msgs, + gint *total_msgs, gint *min, gint *max, gint first); -FILE *procmsg_open_mark_file (const gchar *folder, - gboolean append); GNode *procmsg_get_thread_tree (GSList *mlist); @@ -253,6 +234,11 @@ FILE *procmsg_open_message_decrypted (MsgInfo *msginfo, #endif gboolean procmsg_msg_exist (MsgInfo *msginfo); +void procmsg_get_filter_keyword (MsgInfo *msginfo, + gchar **header, + gchar **key, + PrefsFilterType type); + void procmsg_empty_trash (void); gint procmsg_send_queue (FolderItem *queue, gboolean save_msgs); @@ -279,15 +265,17 @@ void procmsg_msginfo_set_flags (MsgInfo *msginfo, void procmsg_msginfo_unset_flags (MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmpFlags tmp_flags); - -/* callback system for updates */ -typedef void (*MsgInfoUpdateFunc) (MsgInfo *info, - gpointer data); -gint msginfo_update_callback_register(MsgInfoUpdateFunc func, gpointer data); -void msginfo_update_callback_unregister(gint id); - -void msginfo_update_item (MsgInfo *info); gint procmsg_remove_special_headers (const gchar *in, const gchar *out); +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); + #endif /* __PROCMSG_H__ */