simplifies several flag-handling pieces of code in the mailer, and lets you change a message's flags without having to fetch the message body. It also means that fully-constructed CamelMimeMessages are now essentially constant, which will help simplify locking issues later since it means two threads interested in the same message can just work with separate copies of it. * camel-mime-message.h (struct _CamelMimeMessage): Removed flags and user_flags (moved to summary). Removed expunged and message_number which were unused. Removed message_uid and folder which are no longer needed in the new scheme. (struct CamelMimeMessageClass): Removed message_changed signal and get/set_message_number methods. * camel-mime-message.c: Updates for CamelMimeMessage changes. (camel_mime_message_get/set_flags, camel_mime_message_get/set_user_flag): Replaced with methods in CamelFolder. (camel_flag_get, camel_flag_set, camel_flag_list_size, camel_flag_list_free): Moved verbatim to camel-folder-summary.c * camel-folder.c (camel_folder_get/set_message_flags, camel_folder_get/set_message_user_flag): New methods (and corresponding useless default implementations) (camel_folder_class_init): add a message_changed signal * camel-folder-summary.c (camel_flag_get, camel_flag_set, camel_flag_list_size, camel_flag_list_free): Moved here from camel-mime-message.c * providers/mbox/camel-mbox-folder.c (message_changed): Removed. (mbox_get_message_flags, mbox_set_message_flags, mbox_get_message_user_flag, mbox_set_message_user_flag): Tweak summary bits as appropriate. (Functionality moved here from message_changed.) (mbox_get_message_by_uid): Update for CamelMimeMessage changes (less stuff to initialize). * providers/imap/camel-imap-folder.c (message_changed): Remove this. It was just copied from the mbox provider and doesn't deal with the real IMAP flag stuff anyway. (So there's currently no flag support in the IMAP provider.) (imap_get_message_by_uid): Update for CamelMimeMessage changes. * providers/vee/camel-vee-folder.c: (message_changed): Remove old one. Add a new one to listen for message_changed on each folder and re-emit message_changed signals that correspond to messages in the vfolder. (vee_get/set_message_flags, vee_get/set_message_user_flag): Proxy flag setting to the underlying real messages. (vee_append_message): Removed for now; there's no way to translate this into the new CamelMimeMessage/CamelFolder scheme, but (a) there's also no code which would ever call it and (b) we're probably going want a better interface than append_message for message drag and drop to work anyway. To be revisited. svn path=/trunk/; revision=3598
119 lines
4.1 KiB
C
119 lines
4.1 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
|
|
/* camelMimeMessage.h : class for a mime message
|
|
*
|
|
* Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
|
|
* Michael Zucchi <notzed@helixcode.com>
|
|
*
|
|
* Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
|
|
*
|
|
* 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 (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
* USA
|
|
*/
|
|
|
|
|
|
#ifndef CAMEL_MIME_MESSAGE_H
|
|
#define CAMEL_MIME_MESSAGE_H 1
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#pragma }
|
|
#endif /* __cplusplus }*/
|
|
|
|
#include <camel/camel-mime-part.h>
|
|
#include <camel/camel-mime-utils.h>
|
|
#include <camel/camel-internet-address.h>
|
|
|
|
#define CAMEL_RECIPIENT_TYPE_TO "To"
|
|
#define CAMEL_RECIPIENT_TYPE_CC "Cc"
|
|
#define CAMEL_RECIPIENT_TYPE_BCC "Bcc"
|
|
|
|
|
|
#define CAMEL_MIME_MESSAGE_TYPE (camel_mime_message_get_type ())
|
|
#define CAMEL_MIME_MESSAGE(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessage))
|
|
#define CAMEL_MIME_MESSAGE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessageClass))
|
|
#define CAMEL_IS_MIME_MESSAGE(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_MESSAGE_TYPE))
|
|
|
|
|
|
/* specify local time */
|
|
#define CAMEL_MESSAGE_DATE_CURRENT (~0)
|
|
|
|
struct _CamelMimeMessage
|
|
{
|
|
CamelMimePart parent_object;
|
|
|
|
/* header fields */
|
|
time_t date;
|
|
int date_offset; /* GMT offset */
|
|
char *date_str; /* cached copy of date string */
|
|
|
|
gchar *subject;
|
|
gchar *reply_to;
|
|
|
|
gchar *from;
|
|
|
|
GHashTable *recipients; /* hash table of CamelInternetAddress's */
|
|
};
|
|
|
|
typedef struct {
|
|
CamelMimePartClass parent_class;
|
|
|
|
/* Virtual methods */
|
|
|
|
} CamelMimeMessageClass;
|
|
|
|
|
|
|
|
/* Standard Gtk function */
|
|
GtkType camel_mime_message_get_type (void);
|
|
|
|
|
|
/* public methods */
|
|
CamelMimeMessage * camel_mime_message_new (void);
|
|
|
|
|
|
void camel_mime_message_set_date (CamelMimeMessage *mime_message, time_t date, int offset);
|
|
void camel_mime_message_get_date (CamelMimeMessage *mime_message, time_t *date, int *offset);
|
|
char *camel_mime_message_get_date_string (CamelMimeMessage *mime_message);
|
|
|
|
const gchar * camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
|
|
const gchar * camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
|
|
void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message,
|
|
const gchar *reply_to);
|
|
const gchar * camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
|
|
void camel_mime_message_set_subject (CamelMimeMessage *mime_message,
|
|
const gchar *subject);
|
|
const gchar * camel_mime_message_get_subject (CamelMimeMessage *mime_message);
|
|
void camel_mime_message_set_from (CamelMimeMessage *mime_message,
|
|
const gchar *from);
|
|
const gchar * camel_mime_message_get_from (CamelMimeMessage *mime_message);
|
|
|
|
|
|
void camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
|
|
const char *type, const char *name, const char *address);
|
|
void camel_mime_message_remove_recipient_address (CamelMimeMessage *mime_message,
|
|
const char *type, const char *address);
|
|
void camel_mime_message_remove_recipient_name (CamelMimeMessage *mime_message,
|
|
const char *type, const char *name);
|
|
|
|
const CamelInternetAddress *camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
|
|
const char *type);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* CAMEL_MIME_MESSAGE_H */
|