aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-message.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-14 01:41:18 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-14 01:41:18 +0800
commitec22bcd92061fcf6ce599d5fd777a9159beaff02 (patch)
treee0eef90af8229dd7a1453ab72a3403ceaea8db5b /camel/camel-mime-message.c
parentc232c3eeaaf85c3e92a1c6bf7a802f7ffee30451 (diff)
downloadgsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.gz
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.bz2
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.lz
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.xz
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.zst
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.zip
New field (message_list) which will hold a reference on each message
1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-folder.h (struct _CamelFolder): New field (message_list) which will hold a reference on each message obtained by the folder, which is necessary in order for the caching procedure to work (Getting the same message from a folder twice will return the same CamelMimeMessage object). * camel/camel-folder.c (camel_folder_get_message): When the store retreives a message put it in its message list. (_finalize): free message list. * ChangeLog: fix typo (parmanent) svn path=/trunk/; revision=1112
Diffstat (limited to 'camel/camel-mime-message.c')
-rw-r--r--camel/camel-mime-message.c64
1 files changed, 52 insertions, 12 deletions
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 417ccc9ff0..3d33f43446 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -207,7 +207,7 @@ camel_mime_message_new_with_session (CamelSession *session)
}
-/* two utils func */
+/* some utils func */
static void
_set_field (CamelMimeMessage *mime_message, gchar *name, gchar *value, gchar **variable)
@@ -225,6 +225,16 @@ _get_field (CamelMimeMessage *mime_message, gchar *name, gchar *variable)
{
return variable;
}
+
+static gboolean
+_check_not_expunged (CamelMimeMessage *mime_message)
+{
+ if (mime_message->expunged) {
+ CAMEL_LOG_WARNING ("CamelMimeMessage:: An invalid operation has been tempted on an expunged message\n");
+ }
+ return (!mime_message->expunged);
+}
+
/* * */
@@ -237,7 +247,9 @@ _set_received_date (CamelMimeMessage *mime_message, gchar *received_date)
void
camel_mime_message_set_received_date (CamelMimeMessage *mime_message, gchar *received_date)
{
- CMM_CLASS (mime_message)->set_received_date (mime_message, received_date);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->set_received_date (mime_message, received_date);
}
@@ -250,7 +262,9 @@ _get_received_date (CamelMimeMessage *mime_message)
const gchar *
camel_mime_message_get_received_date (CamelMimeMessage *mime_message)
{
- return CMM_CLASS (mime_message)->get_received_date (mime_message);
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
+ return CMM_CLASS (mime_message)->get_received_date (mime_message);
}
@@ -263,7 +277,9 @@ _get_sent_date (CamelMimeMessage *mime_message)
const gchar *
camel_mime_message_get_sent_date (CamelMimeMessage *mime_message)
{
- return CMM_CLASS (mime_message)->get_sent_date (mime_message);
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
+ return CMM_CLASS (mime_message)->get_sent_date (mime_message);
}
@@ -276,7 +292,9 @@ _set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to)
void
camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, gchar *reply_to)
{
- CMM_CLASS (mime_message)->set_reply_to (mime_message, reply_to);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->set_reply_to (mime_message, reply_to);
}
@@ -289,7 +307,9 @@ _get_reply_to (CamelMimeMessage *mime_message)
const gchar *
camel_mime_message_get_reply_to (CamelMimeMessage *mime_message)
{
- return CMM_CLASS (mime_message)->get_reply_to (mime_message);
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
+ return CMM_CLASS (mime_message)->get_reply_to (mime_message);
}
@@ -304,7 +324,9 @@ _set_subject (CamelMimeMessage *mime_message, gchar *subject)
void
camel_mime_message_set_subject (CamelMimeMessage *mime_message, gchar *subject)
{
- CMM_CLASS (mime_message)->set_subject (mime_message, subject);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->set_subject (mime_message, subject);
}
@@ -317,7 +339,9 @@ _get_subject (CamelMimeMessage *mime_message)
const gchar *
camel_mime_message_get_subject (CamelMimeMessage *mime_message)
{
- return CMM_CLASS (mime_message)->get_subject (mime_message);
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
+ return CMM_CLASS (mime_message)->get_subject (mime_message);
}
@@ -332,7 +356,9 @@ _set_from (CamelMimeMessage *mime_message, gchar *from)
void
camel_mime_message_set_from (CamelMimeMessage *mime_message, gchar *from)
{
- CMM_CLASS (mime_message)->set_from (mime_message, from);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->set_from (mime_message, from);
}
@@ -345,7 +371,9 @@ _get_from (CamelMimeMessage *mime_message)
const gchar *
camel_mime_message_get_from (CamelMimeMessage *mime_message)
{
- return CMM_CLASS (mime_message)->get_from (mime_message);
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
+ return CMM_CLASS (mime_message)->get_from (mime_message);
}
@@ -393,7 +421,9 @@ _add_recipient (CamelMimeMessage *mime_message, gchar *recipient_type, gchar *re
void
camel_mime_message_add_recipient (CamelMimeMessage *mime_message, gchar *recipient_type, gchar *recipient)
{
- CMM_CLASS (mime_message)->add_recipient (mime_message, recipient_type, recipient);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->add_recipient (mime_message, recipient_type, recipient);
}
@@ -442,7 +472,9 @@ _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type,
void
camel_mime_message_remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient)
{
- CMM_CLASS (mime_message)->remove_recipient (mime_message, recipient_type, recipient);
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
+ CMM_CLASS (mime_message)->remove_recipient (mime_message, recipient_type, recipient);
}
@@ -455,6 +487,8 @@ _get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type)
const GList *
camel_mime_message_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type)
{
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
return CMM_CLASS (mime_message)->get_recipients (mime_message, recipient_type);
}
@@ -479,6 +513,8 @@ _set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
void
camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
{
+ g_assert (mime_message);
+ g_return_if_fail (_check_not_expunged (mime_message));
CMM_CLASS (mime_message)->set_flag (mime_message, flag, value);
}
@@ -495,6 +531,8 @@ _get_flag (CamelMimeMessage *mime_message, const gchar *flag)
gboolean
camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag)
{
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), FALSE);
return CMM_CLASS (mime_message)->get_flag (mime_message, flag);
}
@@ -524,6 +562,8 @@ _get_flag_list (CamelMimeMessage *mime_message)
GList *
camel_mime_message_get_flag_list (CamelMimeMessage *mime_message)
{
+ g_assert (mime_message);
+ g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
return CMM_CLASS (mime_message)->get_flag_list (mime_message);
}