0.8.11claws26
[claws.git] / src / procmsg.h
index 5b92d89c49a67a8f7a6ca54b25975ef45a83aa54..98cefd569744b44aff2cf08a3f85470117c13fc6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 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
 #ifndef __PROCMSG_H__
 #define __PROCMSG_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
 #include <stdio.h>
 #include <time.h>
@@ -28,8 +32,7 @@
 
 typedef struct _MsgInfo                MsgInfo;
 typedef struct _MsgFlags       MsgFlags;
-
-#include "folder.h"
+typedef struct _MsgInfoUpdate  MsgInfoUpdate;
 
 typedef enum
 {
@@ -66,6 +69,7 @@ typedef enum
 
        MSG_IGNORE_THREAD   = 1 << 10,   /* ignore threads */
        MSG_LOCKED          = 1 << 11,   /* msg is locked  */
+       MSG_RETRCPT_PENDING = 1 << 12,   /* return receipt pending */
 
        /* RESERVED */
        MSG_RESERVED_CLAWS  = 1 << 30,  /* for sylpheed-claws */
@@ -84,13 +88,14 @@ typedef enum
        MSG_ENCRYPTED   = 1 << 18,
        MSG_IMAP        = 1 << 19,
        MSG_NEWS        = 1 << 20,
+       MSG_SIGNED      = 1 << 21,
 
        MSG_MIME        = 1 << 29,
 
        MSG_CACHED      = 1 << 31
 } MsgTmpFlags;
 
-#define MSG_CACHED_FLAG_MASK   (MSG_MIME | MSG_ENCRYPTED)
+#define MSG_CACHED_FLAG_MASK   (MSG_MIME | MSG_ENCRYPTED | MSG_SIGNED)
 
 #define MSG_SET_FLAGS(msg, flags)      { (msg) |= (flags); }
 #define MSG_UNSET_FLAGS(msg, flags)    { (msg) &= ~(flags); }
@@ -116,12 +121,16 @@ typedef enum
 #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_IS_MOVE(msg)               (((msg).tmp_flags & MSG_MOVE) != 0)
 #define MSG_IS_COPY(msg)               (((msg).tmp_flags & MSG_COPY) != 0)
 
 #define MSG_IS_QUEUED(msg)             (((msg).tmp_flags & MSG_QUEUED) != 0)
 #define MSG_IS_DRAFT(msg)              (((msg).tmp_flags & MSG_DRAFT) != 0)
 #define MSG_IS_ENCRYPTED(msg)          (((msg).tmp_flags & MSG_ENCRYPTED) != 0)
+#define MSG_IS_SIGNED(msg)             (((msg).tmp_flags & MSG_SIGNED) != 0)
 #define MSG_IS_IMAP(msg)               (((msg).tmp_flags & MSG_IMAP) != 0)
 #define MSG_IS_NEWS(msg)               (((msg).tmp_flags & MSG_NEWS) != 0)
 #define MSG_IS_MIME(msg)               (((msg).tmp_flags & MSG_MIME) != 0)
@@ -130,24 +139,12 @@ typedef enum
 /* Claws related flags */
 #define MSG_IS_REALLY_DELETED(msg)     (((msg).perm_flags & MSG_REALLY_DELETED) != 0)
 #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 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"
 
 struct _MsgFlags
 {
@@ -157,6 +154,8 @@ struct _MsgFlags
 
 struct _MsgInfo
 {
+       guint refcnt;
+
        guint  msgnum;
        off_t  size;
        time_t mtime;
@@ -174,6 +173,7 @@ struct _MsgInfo
        gchar *subject;
        gchar *msgid;
        gchar *inreplyto;
+       gchar *xref;
 
        FolderItem *folder;
        FolderItem *to_folder;
@@ -194,6 +194,10 @@ struct _MsgInfo
        guint decryption_failed : 1;
 };
 
+struct _MsgInfoUpdate {
+       MsgInfo *msginfo;
+};
+
 GHashTable *procmsg_msg_hash_table_create      (GSList         *mlist);
 void procmsg_msg_hash_table_append             (GHashTable     *msg_table,
                                                 GSList         *mlist);
@@ -201,20 +205,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_cache   (GSList         *mlist);
+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_get_mark_sum            (const gchar    *folder,
                                         gint           *new,
                                         gint           *unread,
-                                        gint           *total);
-FILE   *procmsg_open_mark_file         (const gchar    *folder,
-                                        gboolean        append);
+                                        gint           *total,
+                                        gint           *min,
+                                        gint           *max,
+                                        gint            first);
 
 GNode  *procmsg_get_thread_tree                (GSList         *mlist);
 
@@ -224,18 +223,47 @@ void      procmsg_copy_messages           (GSList         *mlist);
 gchar  *procmsg_get_message_file_path  (MsgInfo        *msginfo);
 gchar  *procmsg_get_message_file       (MsgInfo        *msginfo);
 FILE   *procmsg_open_message           (MsgInfo        *msginfo);
+#if USE_GPGME
+FILE   *procmsg_open_message_decrypted (MsgInfo        *msginfo,
+                                        MimeInfo      **mimeinfo);
+#endif
 gboolean procmsg_msg_exist             (MsgInfo        *msginfo);
 
 void   procmsg_empty_trash             (void);
-gint   procmsg_send_queue              (void);
+gint   procmsg_send_queue              (FolderItem     *queue,
+                                        gboolean        save_msgs);
+gint   procmsg_save_to_outbox          (FolderItem     *outbox,
+                                        const gchar    *file,
+                                        gboolean        is_queued);
 void   procmsg_print_message           (MsgInfo        *msginfo,
                                         const gchar    *cmdline);
 
+MsgInfo *procmsg_msginfo_new           ();
+MsgInfo *procmsg_msginfo_new_ref       (MsgInfo        *msginfo);
 MsgInfo *procmsg_msginfo_copy          (MsgInfo        *msginfo);
+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);
 
+void procmsg_msginfo_set_flags         (MsgInfo *msginfo,
+                                        MsgPermFlags perm_flags,
+                                         MsgTmpFlags tmp_flags);
+void procmsg_msginfo_unset_flags       (MsgInfo *msginfo,
+                                        MsgPermFlags perm_flags,
+                                         MsgTmpFlags tmp_flags);
+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);
 #endif /* __PROCMSG_H__ */