2007-01-21 [colin] 2.7.1cvs47
[claws.git] / src / procmsg.h
index 544be7eb2a591cddb89e33a3ebe05d940fe69dc1..bbd9531a82c8065f069ee87c1a42a69afaba9a9b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
@@ -36,6 +36,8 @@ typedef struct _MsgFileInfo           MsgFileInfo;
 typedef struct _MsgInfoUpdate          MsgInfoUpdate;
 typedef struct _MailFilteringData      MailFilteringData;
 
+typedef struct _MsgInfoExtraData       MsgInfoExtraData;
+
 typedef GSList MsgInfoList;
 typedef GSList MsgNumberList;
 
@@ -45,9 +47,7 @@ typedef GSList MsgNumberList;
 #define MSG_DELETED            (1U << 3)
 #define MSG_REPLIED            (1U << 4)
 #define MSG_FORWARDED          (1U << 5)
-#if 0
-#define MSG_REALLY_DELETED     (1U << 6)               /* mbox stuff */
-#endif
+#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)) | \
@@ -74,9 +74,10 @@ typedef GSList MsgNumberList;
 #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 */ 
                                                
 /* RESERVED */
-#define        MSG_RESERVED_CLAWS      (1U << 30)   /* for sylpheed-claws */
+#define        MSG_RESERVED_CLAWS      (1U << 30)   /* for claws-mail */
 #define        MSG_RESERVED            (1U << 31)
 
 typedef guint32 MsgPermFlags;
@@ -85,6 +86,7 @@ typedef guint32 MsgPermFlags;
 
 #define MSG_MOVE               (1U << 0)
 #define MSG_COPY               (1U << 1)
+#define MSG_MOVE_DONE          (1U << 15)              
 #define MSG_QUEUED             (1U << 16)
 #define MSG_DRAFT              (1U << 17)
 #define MSG_ENCRYPTED          (1U << 18)
@@ -117,6 +119,7 @@ typedef guint32 MsgTmpFlags;
 #define MSG_IS_REPLIED(msg)            (((msg).perm_flags & MSG_REPLIED) != 0)
 #define MSG_IS_LOCKED(msg)             (((msg).perm_flags & MSG_LOCKED) != 0)
 #define MSG_IS_FORWARDED(msg)          (((msg).perm_flags & MSG_FORWARDED) != 0)
+#define MSG_IS_POSTFILTERED(msg)       (((msg).perm_flags & MSG_POSTFILTERED) != 0)
 
 #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)
@@ -128,6 +131,7 @@ typedef guint32 MsgTmpFlags;
 
 #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_MOVE_DONE(msg)          (((msg).tmp_flags & MSG_MOVE_DONE) != 0)
 
 #define MSG_IS_QUEUED(msg)             (((msg).tmp_flags & MSG_QUEUED) != 0)
 #define MSG_IS_DRAFT(msg)              (((msg).tmp_flags & MSG_DRAFT) != 0)
@@ -144,9 +148,11 @@ typedef guint32 MsgTmpFlags;
 #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 MSG_IS_RETRCPT_SENT(msg)       (((msg).perm_flags & MSG_RETRCPT_SENT) != 0)
+#define MSG_IS_SPAM(msg)               (((msg).perm_flags & MSG_SPAM) != 0)
 
 #define MSGINFO_UPDATE_HOOKLIST "msginfo_update"
 #define MAIL_FILTERING_HOOKLIST "mail_filtering_hooklist"
+#define MAIL_LISTFILTERING_HOOKLIST "mail_listfiltering_hooklist"
 #define MAIL_POSTFILTERING_HOOKLIST "mail_postfiltering_hooklist"
 
 typedef enum {
@@ -164,7 +170,13 @@ struct _MsgFlags
        MsgTmpFlags  tmp_flags;
 };
 
-
+/* *********************************************************** *
+ * WARNING: When adding or removing members to this structure, *
+ * be sure to update procmsg.c::procmsg_msginfo_memusage()  to *
+ * avoid underestimating cache memory usage - especially since *
+ * this would cause an overflow and metadata loss when writing *
+ * the cache to disk.                                          *
+ * *********************************************************** */
 struct _MsgInfo
 {
        guint refcnt;
@@ -190,16 +202,11 @@ struct _MsgInfo
 
        FolderItem *folder;
        FolderItem *to_folder;
-       
+
+       FolderItem *to_filter_folder;   
        gboolean is_move;
        gboolean is_copy;
 
-       gchar *xface;
-       gchar *face;
-
-       gchar *dispositionnotificationto;
-       gchar *returnreceiptto;
-
        GSList *references;
        gchar *fromspace;
 
@@ -209,13 +216,34 @@ struct _MsgInfo
        gchar *plaintext_file;
         
         gint hidden;
-       
+
        /* used only for partially received messages */
-       gchar *partial_recv;
        gint total_size;
+       gint planned_download;
+
+       MsgInfoExtraData *extradata;
+};
+
+struct _MsgInfoExtraData
+{
+       gchar *xface;
+       gchar *face;
+
+       gchar *dispositionnotificationto;
+       gchar *returnreceiptto;
+
+       /* used only for partially received messages */
+       gchar *partial_recv;
        gchar *account_server;
        gchar *account_login;
-       gint planned_download;
+
+       /* Mailing list support */
+       gchar *list_post;
+       gchar *list_subscribe;
+       gchar *list_unsubscribe;
+       gchar *list_help;
+       gchar *list_archive;
+       gchar *list_owner;
 };
 
 struct _MsgFileInfo
@@ -233,16 +261,13 @@ struct _MsgInfoUpdate {
 struct _MailFilteringData
 {
        MsgInfo *msginfo;
+       GSList  *msglist;
+       GSList  *filtered;
+       GSList  *unfiltered;
 };
 
-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,
@@ -273,15 +298,12 @@ void      procmsg_get_filter_keyword      (MsgInfo          *msginfo,
                                         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);
+                                        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);
 
@@ -292,9 +314,11 @@ MsgInfo *procmsg_msginfo_get_full_info     (MsgInfo        *msginfo);
 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);
+gint procmsg_send_message_queue                (const gchar *file,
+                                        gchar **errstr,
+                                        FolderItem *queue, 
+                                        gint msgnum,
+                                        gboolean *queued_removed);
 
 void procmsg_msginfo_set_flags         (MsgInfo *msginfo,
                                         MsgPermFlags perm_flags,
@@ -313,14 +337,25 @@ gint procmsg_remove_special_headers       (const gchar    *in,
 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);
+void procmsg_msglist_filter            (GSList         *list, 
+                                        PrefsAccount   *ac, 
+                                        GSList         **filtered,
+                                        GSList         **unfiltered,
+                                        gboolean        do_filter);
+
 MsgInfo *procmsg_msginfo_new_from_mimeinfo
                                        (MsgInfo        *src_msginfo, 
                                         MimeInfo       *mimeinfo);
 
+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);
+int procmsg_spam_learner_learn         (MsgInfo *msginfo, GSList *msglist, gboolean spam);
+gboolean procmsg_have_queued_mails_fast (void);
+gboolean procmsg_is_sending(void);
+
 #endif /* __PROCMSG_H__ */