On Wed, 30 Aug 2006, Philip Van Hoof wrote: > Hey Thomas, > > This is great. Thanks a lot! > > o. Can you attach the patch in stead of inline it? sure - attached o. Can you give me a script with SVN commands to rename everything? also attached > o. Can you update the ChangeLog (it will create a little conflict atm) it is already updated !??!? > > I'm driving home now. I will look at this in a few minutes. > > If you need assistance with something, or maybe even a SVN account: I'll > be on IRC in an hour or something. > if everything worked fine with my patch an svn account would be nice ;) > > On Wed, 2006-08-30 at 17:31 +0200, Thomas Hisch wrote: >> hey, >> >> here is the patch. libtinymail-camel builds fine. but there is an >> undefined reference to `tny_account_iface_get_account_store' >> in libtinymail-gnome-desktop which i haven't fixed yet. >> >> thi >>
Attachment:
svnscript.sh
Description: application/shellscript
Index: libtinymail-camel/tny-camel-header.c =================================================================== --- libtinymail-camel/tny-camel-header.c (Revision 827) +++ libtinymail-camel/tny-camel-header.c (Arbeitskopie) @@ -25,12 +25,12 @@ #include <string.h> #include <tny-header-iface.h> -#include <tny-header.h> +#include <tny-camel-header.h> #include <tny-folder.h> #include "tny-camel-common-priv.h" #include "tny-folder-priv.h" -#include "tny-header-priv.h" +#include "tny-camel-header-priv.h" #include <tny-camel-shared.h> @@ -43,7 +43,7 @@ static const gchar *invalid = "Invalid"; static void -destroy_write (TnyHeader *self) +destroy_write (TnyCamelHeader *self) { /* Also check out tny-msg.c: tny_msg_finalize (read the stupid hack) */ if (((WriteInfo*)self->info)->msg) @@ -56,7 +56,7 @@ } static void -prepare_for_write (TnyHeader *self) +prepare_for_write (TnyCamelHeader *self) { if (!self->write) { @@ -70,7 +70,7 @@ } void -_tny_header_set_camel_message_info (TnyHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit) +_tny_camel_header_set_camel_message_info (TnyCamelHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit) { if (!knowit && G_UNLIKELY (self->info)) g_warning ("Strange behaviour: Overwriting existing message info"); @@ -85,7 +85,7 @@ } void -_tny_header_set_camel_mime_message (TnyHeader *self, CamelMimeMessage *camel_mime_message) +_tny_camel_header_set_camel_mime_message (TnyCamelHeader *self, CamelMimeMessage *camel_mime_message) { if (G_UNLIKELY (self->info)) g_warning ("Strange behaviour: Overwriting existing message info"); @@ -104,7 +104,7 @@ static const gchar* -tny_header_get_replyto (TnyHeaderIface *self) +tny_camel_header_get_replyto (TnyHeaderIface *self) { const gchar *retval = invalid; @@ -115,9 +115,9 @@ static void -tny_header_set_bcc (TnyHeaderIface *self, const gchar *bcc) +tny_camel_header_set_bcc (TnyHeaderIface *self, const gchar *bcc) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); CamelInternetAddress *addr = camel_internet_address_new (); _foreach_email_add_to_inet_addr (bcc, addr); @@ -133,9 +133,9 @@ } static void -tny_header_set_cc (TnyHeaderIface *self, const gchar *cc) +tny_camel_header_set_cc (TnyHeaderIface *self, const gchar *cc) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); CamelInternetAddress *addr = camel_internet_address_new (); _foreach_email_add_to_inet_addr (cc, addr); @@ -150,9 +150,9 @@ } static void -tny_header_set_from (TnyHeaderIface *self, const gchar *from) +tny_camel_header_set_from (TnyHeaderIface *self, const gchar *from) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); CamelInternetAddress *addr = camel_internet_address_new (); gchar *dup; @@ -169,9 +169,9 @@ } static void -tny_header_set_subject (TnyHeaderIface *self, const gchar *subject) +tny_camel_header_set_subject (TnyHeaderIface *self, const gchar *subject) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); prepare_for_write (me); camel_mime_message_set_subject (((WriteInfo*)me->info)->msg, subject); @@ -180,9 +180,9 @@ } static void -tny_header_set_to (TnyHeaderIface *self, const gchar *to) +tny_camel_header_set_to (TnyHeaderIface *self, const gchar *to) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); CamelInternetAddress *addr = camel_internet_address_new (); gchar *dup; @@ -202,7 +202,7 @@ static void -tny_header_set_replyto (TnyHeaderIface *self, const gchar *to) +tny_camel_header_set_replyto (TnyHeaderIface *self, const gchar *to) { /* TODO set replyto */ @@ -211,9 +211,9 @@ static const gchar* -tny_header_get_cc (TnyHeaderIface *self) +tny_camel_header_get_cc (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); const gchar *retval; if (G_UNLIKELY (!me->info)) @@ -228,9 +228,9 @@ } static const gchar* -tny_header_get_bcc (TnyHeaderIface *self) +tny_camel_header_get_bcc (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); const gchar *retval; if (G_UNLIKELY (!me->info)) @@ -245,14 +245,14 @@ } static TnyHeaderFlags -tny_header_get_flags (TnyHeaderIface *self) +tny_camel_header_get_flags (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); TnyHeaderFlags retval; if (me->write) { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); + g_warning ("tny_camel_header_get_flags: This is a header for a new message!\n"); return retval; } @@ -262,13 +262,13 @@ } static void -tny_header_set_flags (TnyHeaderIface *self, TnyHeaderFlags mask) +tny_camel_header_set_flags (TnyHeaderIface *self, TnyHeaderFlags mask) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); if (me->write) { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); + g_warning ("tny_camel_header_get_flags: This is a header for a new message!\n"); return; } @@ -278,13 +278,13 @@ } static void -tny_header_unset_flags (TnyHeaderIface *self, TnyHeaderFlags mask) +tny_camel_header_unset_flags (TnyHeaderIface *self, TnyHeaderFlags mask) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); if (me->write) { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); + g_warning ("tny_camel_header_get_flags: This is a header for a new message!\n"); return; } @@ -294,9 +294,9 @@ } static time_t -tny_header_get_date_received (TnyHeaderIface *self) +tny_camel_header_get_date_received (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); time_t retval; @@ -312,9 +312,9 @@ } static time_t -tny_header_get_date_sent (TnyHeaderIface *self) +tny_camel_header_get_date_sent (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); time_t retval; @@ -327,9 +327,9 @@ } static const gchar* -tny_header_get_from (TnyHeaderIface *self) +tny_camel_header_get_from (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); const gchar *retval; @@ -353,9 +353,9 @@ } static const gchar* -tny_header_get_subject (TnyHeaderIface *self) +tny_camel_header_get_subject (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); const gchar *retval; if (G_UNLIKELY (!me->info)) @@ -371,9 +371,9 @@ static const gchar* -tny_header_get_to (TnyHeaderIface *self) +tny_camel_header_get_to (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); gchar *retval; if (G_UNLIKELY (!me->info)) @@ -388,9 +388,9 @@ } static const gchar* -tny_header_get_message_id (TnyHeaderIface *self) +tny_camel_header_get_message_id (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); gchar *retval; if (G_UNLIKELY (!me->info)) @@ -408,9 +408,9 @@ static const gchar* -tny_header_get_uid (TnyHeaderIface *self) +tny_camel_header_get_uid (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); const gchar *retval; if (G_UNLIKELY (!me->info) || G_UNLIKELY (me->write)) @@ -422,9 +422,9 @@ } static void -tny_header_finalize (GObject *object) +tny_camel_header_finalize (GObject *object) { - TnyHeader *self = (TnyHeader*) object; + TnyCamelHeader *self = (TnyCamelHeader*) object; if (G_UNLIKELY (self->write)) { @@ -449,15 +449,15 @@ } /** - * tny_header_new: + * tny_camel_header_new: * * - * Return value: A new #TnyHeader instance implemented for Camel + * Return value: A new #TnyCamelHeader instance implemented for Camel **/ -TnyHeader* -tny_header_new (void) +TnyCamelHeader* +tny_camel_header_new (void) { - TnyHeader *self = g_object_new (TNY_TYPE_HEADER, NULL); + TnyCamelHeader *self = g_object_new (TNY_TYPE_CAMEL_HEADER, NULL); self->info = NULL; self->write = 0; @@ -466,9 +466,9 @@ } void -_tny_header_set_folder (TnyHeader *self, TnyFolder *folder, TnyFolderPriv *fpriv) +_tny_camel_header_set_folder (TnyCamelHeader *self, TnyFolder *folder, TnyFolderPriv *fpriv) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); fpriv->headers_managed++; me->folder = (TnyFolderIface*)folder; @@ -476,9 +476,9 @@ } static TnyFolderIface* -tny_header_get_folder (TnyHeaderIface *self) +tny_camel_header_get_folder (TnyHeaderIface *self) { - TnyHeader *me = TNY_HEADER (self); + TnyCamelHeader *me = TNY_CAMEL_HEADER (self); if (me->folder) g_object_ref (G_OBJECT (me->folder)); @@ -491,47 +491,47 @@ { TnyHeaderIfaceClass *klass = (TnyHeaderIfaceClass *)g_iface; - klass->get_from_func = tny_header_get_from; - klass->get_message_id_func = tny_header_get_message_id; - klass->get_to_func = tny_header_get_to; - klass->get_subject_func = tny_header_get_subject; - klass->get_date_received_func = tny_header_get_date_received; - klass->get_date_sent_func = tny_header_get_date_sent; - klass->get_cc_func = tny_header_get_cc; - klass->get_bcc_func = tny_header_get_bcc; - klass->get_replyto_func = tny_header_get_replyto; - klass->get_uid_func = tny_header_get_uid; - klass->get_folder_func = tny_header_get_folder; - klass->set_bcc_func = tny_header_set_bcc; - klass->set_cc_func = tny_header_set_cc; - klass->set_to_func = tny_header_set_to; - klass->set_from_func = tny_header_set_from; - klass->set_subject_func = tny_header_set_subject; - klass->set_replyto_func = tny_header_set_replyto; - klass->set_flags_func = tny_header_set_flags; - klass->unset_flags_func = tny_header_unset_flags; - klass->get_flags_func = tny_header_get_flags; + klass->get_from_func = tny_camel_header_get_from; + klass->get_message_id_func = tny_camel_header_get_message_id; + klass->get_to_func = tny_camel_header_get_to; + klass->get_subject_func = tny_camel_header_get_subject; + klass->get_date_received_func = tny_camel_header_get_date_received; + klass->get_date_sent_func = tny_camel_header_get_date_sent; + klass->get_cc_func = tny_camel_header_get_cc; + klass->get_bcc_func = tny_camel_header_get_bcc; + klass->get_replyto_func = tny_camel_header_get_replyto; + klass->get_uid_func = tny_camel_header_get_uid; + klass->get_folder_func = tny_camel_header_get_folder; + klass->set_bcc_func = tny_camel_header_set_bcc; + klass->set_cc_func = tny_camel_header_set_cc; + klass->set_to_func = tny_camel_header_set_to; + klass->set_from_func = tny_camel_header_set_from; + klass->set_subject_func = tny_camel_header_set_subject; + klass->set_replyto_func = tny_camel_header_set_replyto; + klass->set_flags_func = tny_camel_header_set_flags; + klass->unset_flags_func = tny_camel_header_unset_flags; + klass->get_flags_func = tny_camel_header_get_flags; return; } static void -tny_header_class_init (TnyHeaderClass *class) +tny_camel_header_class_init (TnyCamelHeaderClass *class) { GObjectClass *object_class; parent_class = g_type_class_peek_parent (class); object_class = (GObjectClass*) class; - object_class->finalize = tny_header_finalize; + object_class->finalize = tny_camel_header_finalize; return; } GType -tny_header_get_type (void) +tny_camel_header_get_type (void) { static GType type = 0; @@ -548,13 +548,13 @@ { static const GTypeInfo info = { - sizeof (TnyHeaderClass), + sizeof (TnyCamelHeaderClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) tny_header_class_init, /* class_init */ + (GClassInitFunc) tny_camel_header_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (TnyHeader), + sizeof (TnyCamelHeader), 0, /* n_preallocs */ NULL, /* instance_init */ NULL @@ -568,7 +568,7 @@ }; type = g_type_register_static (G_TYPE_OBJECT, - "TnyHeader", + "TnyCamelHeader", &info, 0); g_type_add_interface_static (type, TNY_TYPE_HEADER_IFACE, Index: libtinymail-camel/tny-msg-priv.h =================================================================== --- libtinymail-camel/tny-msg-priv.h (Revision 827) +++ libtinymail-camel/tny-msg-priv.h (Arbeitskopie) @@ -37,7 +37,7 @@ CamelMimeMessage* _tny_msg_get_camel_mime_message (TnyMsg *self); void _tny_msg_set_camel_mime_message (TnyMsg *self, CamelMimeMessage *message); -void _tny_header_set_not_uncachable (TnyHeader *self); +void _tny_camel_header_set_not_uncachable (TnyCamelHeader *self); void _tny_msg_set_folder (TnyMsgIface *self, TnyFolderIface *folder); #endif Index: libtinymail-camel/tny-header-priv.h =================================================================== --- libtinymail-camel/tny-header-priv.h (Revision 827) +++ libtinymail-camel/tny-header-priv.h (Arbeitskopie) @@ -1,53 +0,0 @@ -#ifndef TNY_HEADER_PRIV_H -#define TNY_HEADER_PRIV_H - -/* libtinymail-camel - The Tiny Mail base library for Camel - * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof gnome org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with self library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <camel/camel.h> -#include <camel/camel-folder-summary.h> -#include <tny-folder.h> -#include "tny-folder-priv.h" - -typedef struct _WriteInfo WriteInfo; -struct _WriteInfo -{ - CamelMimeMessage *msg; - gchar *mime_from; -}; - -#pragma pack(1) /* Size will be 21 in stead of 24 */ -struct _TnyHeader -{ - GObject parent; - gpointer info; - TnyFolderIface *folder; - guchar write:1; -}; - -struct _TnyHeaderClass -{ - GObjectClass parent_class; -}; - -void _tny_header_set_camel_message_info (TnyHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit); -void _tny_header_set_folder (TnyHeader *self, TnyFolder *folder, TnyFolderPriv *tpriv); -void _tny_header_set_camel_mime_message (TnyHeader *self, CamelMimeMessage *camel_mime_message); - -#endif Index: libtinymail-camel/tny-folder.c =================================================================== --- libtinymail-camel/tny-folder.c (Revision 827) +++ libtinymail-camel/tny-folder.c (Arbeitskopie) @@ -29,7 +29,7 @@ #include <tny-msg-iface.h> #include <tny-header-iface.h> #include <tny-msg.h> -#include <tny-header.h> +#include <tny-camel-header.h> #include <tny-store-account-iface.h> #include <tny-camel-store-account.h> #include <tny-list-iface.h> @@ -47,7 +47,7 @@ #include "tny-camel-account-priv.h" #include "tny-camel-store-account-priv.h" #include "tny-folder-priv.h" -#include "tny-header-priv.h" +#include "tny-camel-header-priv.h" #include "tny-msg-priv.h" #include "tny-camel-common-priv.h" #include <tny-camel-shared.h> @@ -320,10 +320,10 @@ CamelMessageInfo *mi = camel_folder_get_message_info (cfol, uid); /* TODO: Proxy instantiation (happens a lot, could use a pool) */ - header = TNY_HEADER_IFACE (tny_header_new ()); + header = TNY_HEADER_IFACE (tny_camel_header_new ()); - _tny_header_set_folder (TNY_HEADER (header), TNY_FOLDER (self), priv); - _tny_header_set_camel_message_info (TNY_HEADER(header), mi, FALSE); + _tny_camel_header_set_folder (TNY_CAMEL_HEADER (header), TNY_FOLDER (self), priv); + _tny_camel_header_set_camel_message_info (TNY_CAMEL_HEADER (header), mi, FALSE); /* Get rid of the reference already. I know this is ugly */ camel_folder_free_message_info (cfol, mi); @@ -618,14 +618,13 @@ if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE) { - TnyHeaderIface *nheader = TNY_HEADER_IFACE (tny_header_new ()); + TnyHeaderIface *nheader = TNY_HEADER_IFACE (tny_camel_header_new ()); /* I don't reuse the header because that would keep a reference on it. Meaning that the CamelFolder can't be destroyed (the - fpriv->headers_managed stuff in tny-header.c). The TnyHeader - type can also work with a CamelMimeMessage, so why not use - that. Right? */ - + fpriv->headers_managed stuff in tny-header.c). The + TnyCamelHeader type can also work with a CamelMimeMessage, + so why not use that. Right? */ message = TNY_MSG_IFACE (tny_msg_new ()); @@ -633,7 +632,7 @@ _tny_msg_set_camel_mime_message (TNY_MSG (message), camel_message); /* Also check out tny-msg.c: tny_msg_finalize (read the stupid hack) */ - _tny_header_set_camel_mime_message (TNY_HEADER (nheader), camel_message); + _tny_camel_header_set_camel_mime_message (TNY_CAMEL_HEADER (nheader), camel_message); tny_msg_iface_set_header (message, nheader); g_object_unref (G_OBJECT (nheader)); Index: libtinymail-camel/tny-camel-header.h =================================================================== --- libtinymail-camel/tny-camel-header.h (Revision 827) +++ libtinymail-camel/tny-camel-header.h (Arbeitskopie) @@ -1,5 +1,5 @@ -#ifndef TNY_HEADER_H -#define TNY_HEADER_H +#ifndef TNY_CAMEL_HEADER_H +#define TNY_CAMEL_HEADER_H /* libtinymail-camel - The Tiny Mail base library for Camel * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof gnome org> @@ -27,20 +27,20 @@ G_BEGIN_DECLS -#define TNY_TYPE_HEADER (tny_header_get_type ()) -#define TNY_HEADER(obj) ((TnyHeader*)obj) -/* #define TNY_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_HEADER, TnyHeader)) */ -#define TNY_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_HEADER, TnyHeaderClass)) -#define TNY_IS_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_HEADER)) -#define TNY_IS_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_HEADER)) -#define TNY_HEADER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_HEADER, TnyHeaderClass)) +#define TNY_TYPE_CAMEL_HEADER (tny_camel_header_get_type ()) +#define TNY_CAMEL_HEADER(obj) ((TnyCamelHeader*)obj) +/* #define TNY_CAMEL_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_HEADER, TnyCamelHeader)) */ +#define TNY_CAMEL_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_HEADER, TnyCamelHeaderClass)) +#define TNY_IS_CAMEL_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_HEADER)) +#define TNY_IS_CAMEL_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_CAMEL_HEADER)) +#define TNY_CAMEL_HEADER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_HEADER, TnyCamelHeaderClass)) -typedef struct _TnyHeader TnyHeader; -typedef struct _TnyHeaderClass TnyHeaderClass; +typedef struct _TnyCamelHeader TnyCamelHeader; +typedef struct _TnyCamelHeaderClass TnyCamelHeaderClass; -GType tny_header_get_type (void); -TnyHeader* tny_header_new (void); +GType tny_camel_header_get_type (void); +TnyCamelHeader* tny_camel_header_new (void); G_END_DECLS Index: libtinymail-camel/tny-msg.c =================================================================== --- libtinymail-camel/tny-msg.c (Revision 827) +++ libtinymail-camel/tny-msg.c (Arbeitskopie) @@ -33,7 +33,7 @@ #include <tny-header-iface.h> #include <tny-mime-part.h> #include <tny-stream-camel.h> -#include <tny-header.h> +#include <tny-camel-header.h> #include <tny-camel-shared.h> @@ -43,7 +43,7 @@ #include "tny-msg-priv.h" #include "tny-mime-part-priv.h" -#include "tny-header-priv.h" +#include "tny-camel-header-priv.h" #define TNY_MSG_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_MSG, TnyMsgPriv)) @@ -301,7 +301,7 @@ { if (priv->header) { /* Stupid hack, else the unreffer below would fuck it up */ - TnyHeader *hdr = (TnyHeader*)priv->header; + TnyCamelHeader *hdr = (TnyCamelHeader*)priv->header; hdr->write = 0; } /* http://bugzilla.gnome.org/show_bug.cgi?id=343683 */ Index: libtinymail-camel/tny-header.c =================================================================== --- libtinymail-camel/tny-header.c (Revision 827) +++ libtinymail-camel/tny-header.c (Arbeitskopie) @@ -1,579 +0,0 @@ -/* libtinymail-camel - The Tiny Mail base library for Camel - * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof gnome org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with self library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <glib/gi18n-lib.h> - -#include <glib.h> -#include <string.h> - -#include <tny-header-iface.h> -#include <tny-header.h> -#include <tny-folder.h> - -#include "tny-camel-common-priv.h" -#include "tny-folder-priv.h" -#include "tny-header-priv.h" - -#include <tny-camel-shared.h> - -#include <camel/camel-folder.h> -#include <camel/camel.h> -#include <camel/camel-folder-summary.h> - -static GObjectClass *parent_class = NULL; - -static const gchar *invalid = "Invalid"; - -static void -destroy_write (TnyHeader *self) -{ - /* Also check out tny-msg.c: tny_msg_finalize (read the stupid hack) */ - if (((WriteInfo*)self->info)->msg) - camel_object_unref (CAMEL_OBJECT (((WriteInfo*)self->info)->msg)); - - if (((WriteInfo*)self->info)->mime_from) - g_free (((WriteInfo*)self->info)->mime_from); - - g_free (self->info); -} - -static void -prepare_for_write (TnyHeader *self) -{ - if (!self->write) - { - self->info = g_new0 (WriteInfo, 1); - ((WriteInfo*)self->info)->msg = camel_mime_message_new (); - ((WriteInfo*)self->info)->mime_from = NULL; - self->write = 1; - } - - return; -} - -void -_tny_header_set_camel_message_info (TnyHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit) -{ - if (!knowit && G_UNLIKELY (self->info)) - g_warning ("Strange behaviour: Overwriting existing message info"); - - if (self->write) - destroy_write (self); - - self->info = camel_message_info; - self->write = 0; - - return; -} - -void -_tny_header_set_camel_mime_message (TnyHeader *self, CamelMimeMessage *camel_mime_message) -{ - if (G_UNLIKELY (self->info)) - g_warning ("Strange behaviour: Overwriting existing message info"); - - if (self->write) - destroy_write (self); - - self->info = g_new0 (WriteInfo, 1); - self->write = 1; - ((WriteInfo*)self->info)->mime_from = NULL; - ((WriteInfo*)self->info)->msg = camel_mime_message; - camel_object_ref (CAMEL_OBJECT (camel_mime_message)); - - return; -} - - -static const gchar* -tny_header_get_replyto (TnyHeaderIface *self) -{ - const gchar *retval = invalid; - - /* TODO get_replyto */ - - return retval; -} - - -static void -tny_header_set_bcc (TnyHeaderIface *self, const gchar *bcc) -{ - TnyHeader *me = TNY_HEADER (self); - CamelInternetAddress *addr = camel_internet_address_new (); - - _foreach_email_add_to_inet_addr (bcc, addr); - - prepare_for_write (me); - - camel_mime_message_set_recipients (((WriteInfo*)me->info)->msg, - CAMEL_RECIPIENT_TYPE_BCC, addr); - - camel_object_unref (CAMEL_OBJECT (addr)); - - return; -} - -static void -tny_header_set_cc (TnyHeaderIface *self, const gchar *cc) -{ - TnyHeader *me = TNY_HEADER (self); - CamelInternetAddress *addr = camel_internet_address_new (); - - _foreach_email_add_to_inet_addr (cc, addr); - - prepare_for_write (me); - - camel_mime_message_set_recipients (((WriteInfo*)me->info)->msg, - CAMEL_RECIPIENT_TYPE_CC, addr); - camel_object_unref (CAMEL_OBJECT (addr)); - - return; -} - -static void -tny_header_set_from (TnyHeaderIface *self, const gchar *from) -{ - TnyHeader *me = TNY_HEADER (self); - CamelInternetAddress *addr = camel_internet_address_new (); - gchar *dup; - - dup = g_strdup (from); - _string_to_camel_inet_addr (dup, addr); - g_free (dup); - - prepare_for_write (me); - - camel_mime_message_set_from (((WriteInfo*)me->info)->msg, addr); - camel_object_unref (CAMEL_OBJECT (addr)); - - return; -} - -static void -tny_header_set_subject (TnyHeaderIface *self, const gchar *subject) -{ - TnyHeader *me = TNY_HEADER (self); - - prepare_for_write (me); - camel_mime_message_set_subject (((WriteInfo*)me->info)->msg, subject); - - return; -} - -static void -tny_header_set_to (TnyHeaderIface *self, const gchar *to) -{ - TnyHeader *me = TNY_HEADER (self); - CamelInternetAddress *addr = camel_internet_address_new (); - gchar *dup; - - dup = g_strdup (to); - _foreach_email_add_to_inet_addr (dup, addr); - g_free (dup); - - prepare_for_write (me); - - camel_mime_message_set_recipients (((WriteInfo*)me->info)->msg, - CAMEL_RECIPIENT_TYPE_TO, addr); - - camel_object_unref (CAMEL_OBJECT (addr)); - - return; -} - - -static void -tny_header_set_replyto (TnyHeaderIface *self, const gchar *to) -{ - /* TODO set replyto */ - - return; -} - - -static const gchar* -tny_header_get_cc (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - const gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - retval = camel_medium_get_header (CAMEL_MEDIUM (((WriteInfo*)me->info)->msg), "cc"); - else - retval = camel_message_info_cc ((CamelMessageInfo*)me->info); - - return retval; -} - -static const gchar* -tny_header_get_bcc (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - const gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - retval = camel_medium_get_header (CAMEL_MEDIUM (((WriteInfo*)me->info)->msg), "bcc"); - else - retval = invalid; - - return retval; -} - -static TnyHeaderFlags -tny_header_get_flags (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - TnyHeaderFlags retval; - - if (me->write) - { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); - return retval; - } - - retval = camel_message_info_flags ((CamelMessageInfo*)me->info); - - return retval; -} - -static void -tny_header_set_flags (TnyHeaderIface *self, TnyHeaderFlags mask) -{ - TnyHeader *me = TNY_HEADER (self); - - if (me->write) - { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); - return; - } - - camel_message_info_set_flags ((CamelMessageInfo*)me->info, mask, ~0); - - return; -} - -static void -tny_header_unset_flags (TnyHeaderIface *self, TnyHeaderFlags mask) -{ - TnyHeader *me = TNY_HEADER (self); - - if (me->write) - { - g_warning ("tny_header_get_flags: This is a header for a new message!\n"); - return; - } - - camel_message_info_set_flags ((CamelMessageInfo*)me->info, mask, 0); - - return; -} - -static time_t -tny_header_get_date_received (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - - time_t retval; - - if (G_UNLIKELY (!me->info)) - return retval; - - if (G_UNLIKELY (me->write)) - retval = camel_mime_message_get_date_received (((WriteInfo*)me->info)->msg, NULL); - else - retval = camel_message_info_date_received ((CamelMessageInfo*)me->info); - - return retval; -} - -static time_t -tny_header_get_date_sent (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - - time_t retval; - - if (G_UNLIKELY (!me->info) || G_UNLIKELY (me->write)) - return retval; - - retval = camel_message_info_date_received ((CamelMessageInfo*)me->info); - - return retval; -} - -static const gchar* -tny_header_get_from (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - - const gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - { - if (G_LIKELY (!((WriteInfo*)me->info)->mime_from)) - { - CamelInternetAddress *addr = (CamelInternetAddress*) - camel_mime_message_get_from (((WriteInfo*)me->info)->msg); - ((WriteInfo*)me->info)->mime_from = camel_address_format (CAMEL_ADDRESS (addr)); - } - - retval = (const gchar*)((WriteInfo*)me->info)->mime_from; - } else - retval = camel_message_info_from ((CamelMimeMessage*)me->info); - - return retval; -} - -static const gchar* -tny_header_get_subject (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - const gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - retval = camel_mime_message_get_subject (((WriteInfo*)me->info)->msg); - else - retval = camel_message_info_subject ((CamelMessageInfo*)me->info); - - return retval; -} - - -static const gchar* -tny_header_get_to (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - retval = (gchar*) camel_medium_get_header (CAMEL_MEDIUM (((WriteInfo*)me->info)->msg), "to"); - else - retval = (gchar*) camel_message_info_to ((CamelMessageInfo*)me->info); - - return (const gchar*)retval; -} - -static const gchar* -tny_header_get_message_id (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - gchar *retval; - - if (G_UNLIKELY (!me->info)) - return invalid; - - if (G_UNLIKELY (me->write)) - retval = (gchar*) camel_mime_message_get_message_id (((WriteInfo*)me->info)->msg); - else - retval = (gchar*) camel_message_info_message_id ((CamelMessageInfo*)me->info); - - return (const gchar*)retval; - - -} - - -static const gchar* -tny_header_get_uid (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - const gchar *retval; - - if (G_UNLIKELY (!me->info) || G_UNLIKELY (me->write)) - return invalid; - - retval = camel_message_info_uid ((CamelMessageInfo*)me->info); - - return retval; -} - -static void -tny_header_finalize (GObject *object) -{ - TnyHeader *self = (TnyHeader*) object; - - if (G_UNLIKELY (self->write)) - { - destroy_write (self); - } - - if (self->folder) - { - TnyFolderPriv *fpriv = TNY_FOLDER_GET_PRIVATE (self->folder); - - fpriv->headers_managed--; - _tny_folder_check_uncache (((TnyFolder*)self->folder), fpriv); - } - - /* Normally we do camel_folder_free_message_info here, but we already got - rid of our initial reference at tny-folder.c:add_message_with_uid - I know this is actually ugly */ - - (*parent_class->finalize) (object); - - return; -} - -/** - * tny_header_new: - * - * - * Return value: A new #TnyHeader instance implemented for Camel - **/ -TnyHeader* -tny_header_new (void) -{ - TnyHeader *self = g_object_new (TNY_TYPE_HEADER, NULL); - - self->info = NULL; - self->write = 0; - - return self; -} - -void -_tny_header_set_folder (TnyHeader *self, TnyFolder *folder, TnyFolderPriv *fpriv) -{ - TnyHeader *me = TNY_HEADER (self); - fpriv->headers_managed++; - me->folder = (TnyFolderIface*)folder; - - return; -} - -static TnyFolderIface* -tny_header_get_folder (TnyHeaderIface *self) -{ - TnyHeader *me = TNY_HEADER (self); - - if (me->folder) - g_object_ref (G_OBJECT (me->folder)); - - return (TnyFolderIface*)me->folder; -} - -static void -tny_header_iface_init (gpointer g_iface, gpointer iface_data) -{ - TnyHeaderIfaceClass *klass = (TnyHeaderIfaceClass *)g_iface; - - klass->get_from_func = tny_header_get_from; - klass->get_message_id_func = tny_header_get_message_id; - klass->get_to_func = tny_header_get_to; - klass->get_subject_func = tny_header_get_subject; - klass->get_date_received_func = tny_header_get_date_received; - klass->get_date_sent_func = tny_header_get_date_sent; - klass->get_cc_func = tny_header_get_cc; - klass->get_bcc_func = tny_header_get_bcc; - klass->get_replyto_func = tny_header_get_replyto; - klass->get_uid_func = tny_header_get_uid; - klass->get_folder_func = tny_header_get_folder; - klass->set_bcc_func = tny_header_set_bcc; - klass->set_cc_func = tny_header_set_cc; - klass->set_to_func = tny_header_set_to; - klass->set_from_func = tny_header_set_from; - klass->set_subject_func = tny_header_set_subject; - klass->set_replyto_func = tny_header_set_replyto; - klass->set_flags_func = tny_header_set_flags; - klass->unset_flags_func = tny_header_unset_flags; - klass->get_flags_func = tny_header_get_flags; - - return; -} - - -static void -tny_header_class_init (TnyHeaderClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_peek_parent (class); - object_class = (GObjectClass*) class; - - object_class->finalize = tny_header_finalize; - - return; -} - - -GType -tny_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (!camel_type_init_done)) - { - if (!g_thread_supported ()) - g_thread_init (NULL); - - camel_type_init (); - camel_type_init_done = TRUE; - } - - if (G_UNLIKELY(type == 0)) - { - static const GTypeInfo info = - { - sizeof (TnyHeaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) tny_header_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (TnyHeader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL - }; - - static const GInterfaceInfo tny_header_iface_info = - { - (GInterfaceInitFunc) tny_header_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "TnyHeader", - &info, 0); - - g_type_add_interface_static (type, TNY_TYPE_HEADER_IFACE, - &tny_header_iface_info); - } - - return type; -} Index: libtinymail-camel/tny-camel-header-priv.h =================================================================== --- libtinymail-camel/tny-camel-header-priv.h (Revision 827) +++ libtinymail-camel/tny-camel-header-priv.h (Arbeitskopie) @@ -1,5 +1,5 @@ -#ifndef TNY_HEADER_PRIV_H -#define TNY_HEADER_PRIV_H +#ifndef TNY_CAMEL_HEADER_PRIV_H +#define TNY_CAMEL_HEADER_PRIV_H /* libtinymail-camel - The Tiny Mail base library for Camel * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof gnome org> @@ -33,7 +33,7 @@ }; #pragma pack(1) /* Size will be 21 in stead of 24 */ -struct _TnyHeader +struct _TnyCamelHeader { GObject parent; gpointer info; @@ -41,13 +41,13 @@ guchar write:1; }; -struct _TnyHeaderClass +struct _TnyCamelHeaderClass { GObjectClass parent_class; }; -void _tny_header_set_camel_message_info (TnyHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit); -void _tny_header_set_folder (TnyHeader *self, TnyFolder *folder, TnyFolderPriv *tpriv); -void _tny_header_set_camel_mime_message (TnyHeader *self, CamelMimeMessage *camel_mime_message); +void _tny_camel_header_set_camel_message_info (TnyCamelHeader *self, CamelMessageInfo *camel_message_info, gboolean knowit); +void _tny_camel_header_set_folder (TnyCamelHeader *self, TnyFolder *folder, TnyFolderPriv *tpriv); +void _tny_camel_header_set_camel_mime_message (TnyCamelHeader *self, CamelMimeMessage *camel_mime_message); #endif Index: libtinymail-camel/tny-header.h =================================================================== --- libtinymail-camel/tny-header.h (Revision 827) +++ libtinymail-camel/tny-header.h (Arbeitskopie) @@ -1,48 +0,0 @@ -#ifndef TNY_HEADER_H -#define TNY_HEADER_H - -/* libtinymail-camel - The Tiny Mail base library for Camel - * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof gnome org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with self library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <glib.h> -#include <glib-object.h> -#include <tny-header-iface.h> -#include <camel/camel-folder-summary.h> - -G_BEGIN_DECLS - -#define TNY_TYPE_HEADER (tny_header_get_type ()) -#define TNY_HEADER(obj) ((TnyHeader*)obj) -/* #define TNY_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_HEADER, TnyHeader)) */ -#define TNY_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_HEADER, TnyHeaderClass)) -#define TNY_IS_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_HEADER)) -#define TNY_IS_HEADER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_HEADER)) -#define TNY_HEADER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_HEADER, TnyHeaderClass)) - -typedef struct _TnyHeader TnyHeader; -typedef struct _TnyHeaderClass TnyHeaderClass; - - -GType tny_header_get_type (void); -TnyHeader* tny_header_new (void); - - -G_END_DECLS - -#endif Index: libtinymail-camel/tny-camel-transport-account.c =================================================================== --- libtinymail-camel/tny-camel-transport-account.c (Revision 827) +++ libtinymail-camel/tny-camel-transport-account.c (Arbeitskopie) @@ -37,12 +37,12 @@ static GObjectClass *parent_class = NULL; #include <tny-msg.h> -#include <tny-header.h> +#include <tny-camel-header.h> #include <tny-camel-transport-account.h> #include "tny-camel-common-priv.h" #include "tny-msg-priv.h" -#include "tny-header-priv.h" +#include "tny-camel-header-priv.h" #include "tny-camel-account-priv.h" #include "tny-camel-transport-account-priv.h" Index: libtinymail-camel/Makefile.am =================================================================== --- libtinymail-camel/Makefile.am (Revision 827) +++ libtinymail-camel/Makefile.am (Arbeitskopie) @@ -7,7 +7,7 @@ libtinymail_camel_1_0_headers = \ tny-mime-part.h \ - tny-header.h \ + tny-camel-header.h \ tny-msg.h \ tny-folder.h \ tny-camel-account.h \ @@ -25,11 +25,11 @@ tny-camel-store-account-priv.h \ tny-camel-transport-account-priv.h \ tny-msg-priv.h \ - tny-header-priv.h \ + tny-camel-header-priv.h \ tny-folder-priv.h \ $(libtinymail_camel_1_0_headers) \ tny-msg.c \ - tny-header.c \ + tny-camel-header.c \ tny-mime-part-priv.h \ tny-mime-part.c \ tny-folder.c \ Index: ChangeLog =================================================================== --- ChangeLog (Revision 827) +++ ChangeLog (Arbeitskopie) @@ -1,3 +1,7 @@ +2006-08-30 Thomas Hisch <t hisch gmail com> + + * Renamed TnyHeader to TnyCamelHeader + 2006-08-30 Philip Van Hoof <pvanhoof gnome org> * Renamed TnyAccount to TnyCamelAccount