Remove. We weren't using the fields that made this different from

* camel-mime-body-part.[ch]: Remove. We weren't using the fields
	that made this different from camel-mime-part, so it basically
	just forced us to do lots of gratuitous typecasting.

	* camel-multipart.[ch]: Use CamelMimePart. Remove the multipart
	parent stuff, since we weren't using that either.

	* etc: update for CamelMimeBodyPart -> CamelMimePart

svn path=/trunk/; revision=2645
This commit is contained in:
Dan Winship
2000-04-26 21:30:32 +00:00
parent 2409d71026
commit 2a6a191e05
17 changed files with 90 additions and 343 deletions

View File

@ -1,3 +1,14 @@
2000-04-26 Dan Winship <danw@helixcode.com>
* camel-mime-body-part.[ch]: Remove. We weren't using the fields
that made this different from camel-mime-part, so it basically
just forced us to do lots of gratuitous typecasting.
* camel-multipart.[ch]: Use CamelMimePart. Remove the multipart
parent stuff, since we weren't using that either.
* etc: update for CamelMimeBodyPart -> CamelMimePart
2000-04-26 Dan Winship <danw@helixcode.com>
* camel-medium.c (set_content_object): sink the content object

View File

@ -38,7 +38,6 @@ libcamel_la_SOURCES = \
camel-folder.c \
camel-medium.c \
camel-marshal-utils.c \
camel-mime-body-part.c \
camel-mime-message.c \
camel-mime-part.c \
camel-mime-part-utils.c \
@ -79,7 +78,6 @@ libcamelinclude_HEADERS = \
camel-data-wrapper.h \
camel-exception.h \
camel-folder.h \
camel-mime-body-part.h \
camel-marshal-utils.h \
camel-medium.h \
camel-mime-message.h \

View File

@ -1,124 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* camel-mime-body-part.c : Abstract class for a mime body part */
/*
*
* Author :
* Bertrand Guiheneuf <bertrand@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
*/
#include <config.h>
#include "camel-mime-body-part.h"
static void _set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart);
static const CamelMultipart *_get_parent (CamelMimeBodyPart *mime_body_part);
static CamelMimePartClass *parent_class=NULL;
/* Returns the class for a CamelMimeBodyPart */
#define CMBP_CLASS(so) CAMEL_MIME_BODY_PART_CLASS (GTK_OBJECT(so)->klass)
static void
camel_mime_body_part_class_init (CamelMimeBodyPartClass *camel_mime_body_part_class)
{
parent_class = gtk_type_class (camel_mime_part_get_type ());
/* virtual method definition */
camel_mime_body_part_class->set_parent = _set_parent;
camel_mime_body_part_class->get_parent = _get_parent;
}
static void
camel_mime_body_part_init (gpointer object, gpointer klass)
{
camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "mime/body-part");
}
GtkType
camel_mime_body_part_get_type (void)
{
static GtkType camel_mime_body_part_type = 0;
if (!camel_mime_body_part_type) {
GtkTypeInfo camel_mime_body_part_info =
{
"CamelMimeBodyPart",
sizeof (CamelMimeBodyPart),
sizeof (CamelMimeBodyPartClass),
(GtkClassInitFunc) camel_mime_body_part_class_init,
(GtkObjectInitFunc) camel_mime_body_part_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
camel_mime_body_part_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_body_part_info);
}
return camel_mime_body_part_type;
}
CamelMimeBodyPart *
camel_mime_body_part_new (void)
{
CamelMimeBodyPart *mime_body_part;
mime_body_part = (CamelMimeBodyPart *)gtk_type_new (CAMEL_MIME_BODY_PART_TYPE);
return mime_body_part;
}
static void
_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
{
if (mime_body_part->parent) gtk_object_unref (GTK_OBJECT (mime_body_part->parent));
mime_body_part->parent = multipart;
if (multipart) gtk_object_ref (GTK_OBJECT (multipart));
}
void
camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
{
CMBP_CLASS (mime_body_part)->set_parent (mime_body_part, multipart);
}
static const CamelMultipart *
_get_parent (CamelMimeBodyPart *mime_body_part)
{
return mime_body_part->parent;
}
const CamelMultipart *
camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part)
{
return CMBP_CLASS (mime_body_part)->get_parent (mime_body_part);
}

View File

@ -1,84 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* camel-mime-body-part.h : class for a mime body part */
/*
*
* Author :
* Bertrand Guiheneuf <bertrand@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_BODY_PART_H
#define CAMEL_MIME_BODY_PART_H 1
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus }*/
#include <gtk/gtk.h>
#include "camel-types.h"
#include "camel-mime-part.h"
#define CAMEL_MIME_BODY_PART_TYPE (camel_mime_body_part_get_type ())
#define CAMEL_MIME_BODY_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPart))
#define CAMEL_MIME_BODY_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPartClass))
#define CAMEL_IS_MIME_BODY_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_BODY_PART_TYPE))
struct _CamelMimeBodyPart
{
CamelMimePart parent_object;
CamelMultipart *parent;
};
typedef struct {
CamelMimePartClass parent_class;
/* Virtual methods */
void (*set_parent) (CamelMimeBodyPart *mime_body_part,
CamelMultipart *multipart);
const CamelMultipart * (*get_parent) (CamelMimeBodyPart *mime_body_part);
} CamelMimeBodyPartClass;
/* Standard Gtk function */
GtkType camel_mime_body_part_get_type (void);
/* public methods */
CamelMimeBodyPart * camel_mime_body_part_new (void);
void camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part,
CamelMultipart *multipart);
const CamelMultipart *camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CAMEL_MIME_BODY_PART_H */

View File

@ -29,7 +29,6 @@
#include "camel-mime-part-utils.h"
#include "camel-mime-message.h"
#include "camel-multipart.h"
#include "camel-mime-body-part.h"
#include "camel-seekable-substream.h"
#include "camel-stream-filter.h"
#include "camel-stream-mem.h"
@ -187,9 +186,9 @@ camel_mime_part_construct_content_from_parser(CamelMimePart *dw, CamelMimeParser
while (camel_mime_parser_step(mp, &buf, &len) != HSCAN_MULTIPART_END) {
camel_mime_parser_unstep(mp);
bodypart = (CamelDataWrapper *)camel_mime_body_part_new();
bodypart = (CamelDataWrapper *)camel_mime_part_new();
camel_mime_part_construct_from_parser((CamelMimePart *)bodypart, mp);
camel_multipart_add_part((CamelMultipart *)content, (CamelMimeBodyPart *)bodypart);
camel_multipart_add_part((CamelMultipart *)content, (CamelMimePart *)bodypart);
}
d(printf("Created multi-part\n"));

View File

@ -629,6 +629,16 @@ camel_mime_part_encoding_from_string (const gchar *string)
/******************************/
/** Misc utility functions **/
/**
* camel_mime_part_new:
*
* Return value: a new CamelMimePart
**/
CamelMimePart *
camel_mime_part_new (void)
{
return (CamelMimePart *)gtk_object_new (CAMEL_MIME_PART_TYPE, NULL);
}
/**
* camel_mime_part_set_content:

View File

@ -120,6 +120,7 @@ CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *str
int camel_mime_part_construct_from_parser (CamelMimePart *, CamelMimeParser *);
/* utility functions */
CamelMimePart * camel_mime_part_new (void);
void camel_mime_part_set_content (CamelMimePart *camel_mime_part,
const gchar *content,
guint length,

View File

@ -31,26 +31,23 @@
#include "gmime-utils.h"
#include "camel-stream-mem.h"
#include "camel-seekable-substream.h"
#include "camel-mime-body-part.h"
#include "camel-multipart.h"
#include "camel-mime-part.h"
#define d(x)
static void add_part (CamelMultipart *multipart,
CamelMimeBodyPart *part);
CamelMimePart *part);
static void add_part_at (CamelMultipart *multipart,
CamelMimeBodyPart *part,
CamelMimePart *part,
guint index);
static void remove_part (CamelMultipart *multipart,
CamelMimeBodyPart *part);
static CamelMimeBodyPart * remove_part_at (CamelMultipart *multipart,
CamelMimePart *part);
static CamelMimePart * remove_part_at (CamelMultipart *multipart,
guint index);
static CamelMimeBodyPart * get_part (CamelMultipart *multipart,
static CamelMimePart * get_part (CamelMultipart *multipart,
guint index);
static guint get_number (CamelMultipart *multipart);
static void set_parent (CamelMultipart *multipart,
CamelMimePart *parent);
static CamelMimePart * get_parent (CamelMultipart *multipart);
static void set_boundary (CamelMultipart *multipart,
gchar *boundary);
static const gchar * get_boundary (CamelMultipart *multipart);
@ -86,8 +83,6 @@ camel_multipart_class_init (CamelMultipartClass *camel_multipart_class)
camel_multipart_class->remove_part_at = remove_part_at;
camel_multipart_class->get_part = get_part;
camel_multipart_class->get_number = get_number;
camel_multipart_class->set_parent = set_parent;
camel_multipart_class->get_parent = get_parent;
camel_multipart_class->set_boundary = set_boundary;
camel_multipart_class->get_boundary = get_boundary;
@ -137,9 +132,9 @@ camel_multipart_get_type (void)
static void
unref_part (gpointer data, gpointer user_data)
{
GtkObject *body_part = GTK_OBJECT (data);
GtkObject *part = GTK_OBJECT (data);
gtk_object_unref (body_part);
gtk_object_unref (part);
}
static void
@ -147,9 +142,6 @@ finalize (GtkObject *object)
{
CamelMultipart *multipart = CAMEL_MULTIPART (object);
if (multipart->parent)
gtk_object_unref (GTK_OBJECT (multipart->parent));
g_list_foreach (multipart->parts, unref_part, NULL);
if (multipart->boundary)
@ -185,7 +177,7 @@ camel_multipart_new (void)
static void
add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
add_part (CamelMultipart *multipart, CamelMimePart *part)
{
multipart->parts = g_list_append (multipart->parts, part);
gtk_object_ref (GTK_OBJECT (part));
@ -194,22 +186,22 @@ add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
/**
* camel_multipart_add_part:
* @multipart: a CamelMultipart
* @part: the body part to add
* @part: the part to add
*
* Appends the body part to the multipart object.
* Appends the part to the multipart object.
**/
void
camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
camel_multipart_add_part (CamelMultipart *multipart, CamelMimePart *part)
{
g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
g_return_if_fail (CAMEL_IS_MIME_BODY_PART (part));
g_return_if_fail (CAMEL_IS_MIME_PART (part));
CMP_CLASS (multipart)->add_part (multipart, part);
}
static void
add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
add_part_at (CamelMultipart *multipart, CamelMimePart *part, guint index)
{
multipart->parts = g_list_insert (multipart->parts, part, index);
gtk_object_ref (GTK_OBJECT (part));
@ -218,26 +210,26 @@ add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
/**
* camel_multipart_add_part_at:
* @multipart: a CamelMultipart
* @part: the body part to add
* @part: the part to add
* @index: index to add the multipart at
*
* Adds the body part to the multipart object after the @index'th
* Adds the part to the multipart object after the @index'th
* element. If @index is greater than the number of parts, it is
* equivalent to camel_multipart_add_part().
**/
void
camel_multipart_add_part_at (CamelMultipart *multipart,
CamelMimeBodyPart *part, guint index)
CamelMimePart *part, guint index)
{
g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
g_return_if_fail (CAMEL_IS_MIME_BODY_PART (part));
g_return_if_fail (CAMEL_IS_MIME_PART (part));
CMP_CLASS (multipart)->add_part_at (multipart, part, index);
}
static void
remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
remove_part (CamelMultipart *multipart, CamelMimePart *part)
{
if (!multipart->parts)
return;
@ -254,21 +246,21 @@ remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
**/
void
camel_multipart_remove_part (CamelMultipart *multipart,
CamelMimeBodyPart *part)
CamelMimePart *part)
{
g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
g_return_if_fail (CAMEL_IS_MIME_BODY_PART (part));
g_return_if_fail (CAMEL_IS_MIME_PART (part));
CMP_CLASS (multipart)->remove_part (multipart, part);
}
static CamelMimeBodyPart *
static CamelMimePart *
remove_part_at (CamelMultipart *multipart, guint index)
{
GList *parts_list;
GList *part_to_remove;
CamelMimeBodyPart *removed_body_part;
CamelMimePart *removed_part;
if (!(multipart->parts))
return NULL;
@ -280,14 +272,14 @@ remove_part_at (CamelMultipart *multipart, guint index)
"part to remove is NULL\n");
return NULL;
}
removed_body_part = CAMEL_MIME_BODY_PART (part_to_remove->data);
removed_part = CAMEL_MIME_PART (part_to_remove->data);
multipart->parts = g_list_remove_link (parts_list, part_to_remove);
if (part_to_remove->data)
gtk_object_unref (GTK_OBJECT (part_to_remove->data));
g_list_free_1 (part_to_remove);
return removed_body_part;
return removed_part;
}
/**
@ -300,7 +292,7 @@ remove_part_at (CamelMultipart *multipart, guint index)
* Return value: the removed part. Note that it is gtk_object_unref()ed
* before being returned, which may cause it to be destroyed.
**/
CamelMimeBodyPart *
CamelMimePart *
camel_multipart_remove_part_at (CamelMultipart *multipart, guint index)
{
g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), NULL);
@ -309,7 +301,7 @@ camel_multipart_remove_part_at (CamelMultipart *multipart, guint index)
}
static CamelMimeBodyPart *
static CamelMimePart *
get_part (CamelMultipart *multipart, guint index)
{
GList *part;
@ -319,7 +311,7 @@ get_part (CamelMultipart *multipart, guint index)
part = g_list_nth (multipart->parts, index);
if (part)
return CAMEL_MIME_BODY_PART (part->data);
return CAMEL_MIME_PART (part->data);
else
return NULL;
}
@ -331,7 +323,7 @@ get_part (CamelMultipart *multipart, guint index)
*
* Return value: the indicated subpart, or %NULL
**/
CamelMimeBodyPart *
CamelMimePart *
camel_multipart_get_part (CamelMultipart *multipart, guint index)
{
g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), NULL);
@ -361,53 +353,6 @@ camel_multipart_get_number (CamelMultipart *multipart)
}
static void
set_parent (CamelMultipart *multipart, CamelMimePart *parent)
{
multipart->parent = parent;
if (parent)
gtk_object_ref (GTK_OBJECT (parent));
}
/**
* camel_multipart_set_parent:
* @multipart: a CamelMultipart
* @parent: the CamelMimePart that is @multipart's parent
*
* Sets the parent of @multipart.
**/
void
camel_multipart_set_parent (CamelMultipart *multipart, CamelMimePart *parent)
{
g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
g_return_if_fail (CAMEL_IS_MIME_PART (parent));
CMP_CLASS (multipart)->set_parent (multipart, parent);
}
static CamelMimePart *
get_parent (CamelMultipart *multipart)
{
return multipart->parent;
}
/**
* camel_multipart_get_parent:
* @multipart: a CamelMultipart
*
* Return value: @multipart's parent part
**/
CamelMimePart *
camel_multipart_get_parent (CamelMultipart *multipart)
{
g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), NULL);
return CMP_CLASS (multipart)->get_parent (multipart);
}
static void
set_boundary (CamelMultipart *multipart, gchar *boundary)
{

View File

@ -62,14 +62,12 @@ typedef struct {
CamelDataWrapperClass parent_class;
/* Virtual methods */
void (*add_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
void (*add_part_at) (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index);
void (*remove_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
CamelMimeBodyPart * (*remove_part_at) (CamelMultipart *multipart, guint index);
CamelMimeBodyPart * (*get_part) (CamelMultipart *multipart, guint index);
void (*add_part) (CamelMultipart *multipart, CamelMimePart *part);
void (*add_part_at) (CamelMultipart *multipart, CamelMimePart *part, guint index);
void (*remove_part) (CamelMultipart *multipart, CamelMimePart *part);
CamelMimePart * (*remove_part_at) (CamelMultipart *multipart, guint index);
CamelMimePart * (*get_part) (CamelMultipart *multipart, guint index);
guint (*get_number) (CamelMultipart *multipart);
void (*set_parent) (CamelMultipart *multipart, CamelMimePart *parent);
CamelMimePart * (*get_parent) (CamelMultipart *multipart);
void (*set_boundary) (CamelMultipart *multipart, gchar *boundary);
const gchar * (*get_boundary) (CamelMultipart *multipart);
@ -83,20 +81,17 @@ GtkType camel_multipart_get_type (void);
/* public methods */
CamelMultipart * camel_multipart_new (void);
void camel_multipart_add_part (CamelMultipart *multipart,
CamelMimeBodyPart *part);
CamelMimePart *part);
void camel_multipart_add_part_at (CamelMultipart *multipart,
CamelMimeBodyPart *part,
CamelMimePart *part,
guint index);
void camel_multipart_remove_part (CamelMultipart *multipart,
CamelMimeBodyPart *part);
CamelMimeBodyPart * camel_multipart_remove_part_at (CamelMultipart *multipart,
CamelMimePart *part);
CamelMimePart * camel_multipart_remove_part_at (CamelMultipart *multipart,
guint index);
CamelMimeBodyPart * camel_multipart_get_part (CamelMultipart *multipart,
CamelMimePart * camel_multipart_get_part (CamelMultipart *multipart,
guint index);
guint camel_multipart_get_number (CamelMultipart *multipart);
void camel_multipart_set_parent (CamelMultipart *multipart,
CamelMimePart *parent);
CamelMimePart * camel_multipart_get_parent (CamelMultipart *multipart);
void camel_multipart_set_boundary (CamelMultipart *multipart,
gchar *boundary);
const gchar * camel_multipart_get_boundary (CamelMultipart *multipart);

View File

@ -32,7 +32,6 @@ typedef struct _CamelException CamelException;
typedef struct _CamelFolder CamelFolder;
typedef struct _CamelFolderSummary CamelFolderSummary;
typedef struct _CamelMedium CamelMedium;
typedef struct _CamelMimeBodyPart CamelMimeBodyPart;
typedef struct _CamelMimeMessage CamelMimeMessage;
typedef struct _CamelMimePart CamelMimePart;
typedef struct _CamelMultipart CamelMultipart;

View File

@ -40,7 +40,6 @@ extern "C" {
#include <camel/camel-folder.h>
#include <camel/camel-marshal-utils.h>
#include <camel/camel-medium.h>
#include <camel/camel-mime-body-part.h>
#include <camel/camel-mime-filter-basic.h>
#include <camel/camel-mime-filter-charset.h>
#include <camel/camel-mime-filter-index.h>

View File

@ -1,3 +1,7 @@
2000-04-26 Dan Winship <danw@helixcode.com>
* Update for CamelMimeBodyPart -> CamelMimePart
2000-04-26 Dan Winship <danw@helixcode.com>
* e-msg-composer-attachment-bar.c (attach_to_multipart): add a

View File

@ -26,8 +26,9 @@
#include "e-msg-composer-attachment.h"
#include "e-msg-composer-attachment-bar.h"
#include "camel/camel-simple-data-wrapper.h"
#include "camel/camel-data-wrapper.h"
#include "camel/camel-stream-fs.h"
#include "camel/camel-mime-part.h"
#define ICON_WIDTH 64
@ -604,11 +605,11 @@ static void
attach_to_multipart (CamelMultipart *multipart,
EMsgComposerAttachment *attachment)
{
CamelMimeBodyPart *part;
CamelMimePart *part;
struct stat st;
int fd;
part = camel_mime_body_part_new ();
part = camel_mime_part_new ();
fd = open (attachment->file_name, O_RDONLY);
if (fd != -1 && fstat (fd, &st) != -1) {
char *data;
@ -617,8 +618,7 @@ attach_to_multipart (CamelMultipart *multipart,
read (fd, data, st.st_size);
close (fd);
camel_mime_part_set_content (CAMEL_MIME_PART (part), data,
st.st_size,
camel_mime_part_set_content (part, data, st.st_size,
attachment->mime_type);
} else {
g_warning ("couldn't open %s", attachment->file_name);
@ -626,11 +626,10 @@ attach_to_multipart (CamelMultipart *multipart,
return;
}
camel_mime_part_set_disposition (CAMEL_MIME_PART (part), "attachment");
camel_mime_part_set_filename (CAMEL_MIME_PART (part),
camel_mime_part_set_disposition (part, "attachment");
camel_mime_part_set_filename (part,
g_basename (attachment->file_name));
camel_mime_part_set_description (CAMEL_MIME_PART (part),
attachment->description);
camel_mime_part_set_description (part, attachment->description);
camel_multipart_add_part (multipart, part);
}

View File

@ -26,7 +26,6 @@
#include <gnome.h>
#include <camel/camel-multipart.h>
#include <camel/camel-mime-body-part.h>
#ifdef __cplusplus
extern "C" {

View File

@ -135,7 +135,7 @@ static CamelMimeMessage *
build_message (EMsgComposer *composer)
{
CamelMimeMessage *new;
CamelMimeBodyPart *body_part;
CamelMimePart *part;
CamelMultipart *multipart;
char *text;
int i;
@ -151,14 +151,13 @@ build_message (EMsgComposer *composer)
}
multipart = camel_multipart_new ();
body_part = camel_mime_body_part_new ();
part = camel_mime_part_new ();
text = get_editor_text (BONOBO_WIDGET (composer->editor));
camel_mime_part_set_content (CAMEL_MIME_PART (body_part), text,
strlen (text), "text/html");
camel_mime_part_set_content (part, text, strlen (text), "text/html");
g_free (text);
camel_multipart_add_part (multipart, body_part);
camel_multipart_add_part (multipart, part);
e_msg_composer_attachment_bar_to_multipart
(E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),

View File

@ -1,6 +1,7 @@
2000-04-26 Dan Winship <danw@helixcode.com>
* mail-format.c: update for CamelStream changes.
* mail-format.c: update for CamelStream changes. Update for
CamelMimeBodyPart -> CamelMimePart
2000-04-25 Dan Winship <danw@helixcode.com>

View File

@ -878,10 +878,9 @@ handle_multipart_mixed (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
CamelMimeBodyPart *body_part =
camel_multipart_get_part (mp, i);
part = camel_multipart_get_part (mp, i);
call_handler_function (CAMEL_MIME_PART (body_part), root, box);
call_handler_function (part, root, box);
}
}
@ -892,7 +891,7 @@ handle_multipart_related (CamelMimePart *part, CamelMimeMessage *root, GtkBox *b
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
CamelMultipart *mp;
CamelMimeBodyPart *body_part, *display_part = NULL;
CamelMimePart *body_part, *display_part = NULL;
GMimeContentField *content_type;
const char *start;
int i, nparts;
@ -915,8 +914,7 @@ handle_multipart_related (CamelMimePart *part, CamelMimeMessage *root, GtkBox *b
const char *cid;
body_part = camel_multipart_get_part (mp, i);
cid = camel_mime_part_get_content_id (
CAMEL_MIME_PART (body_part));
cid = camel_mime_part_get_content_id (body_part);
if (!strncmp (cid, start + 1, len) &&
strlen (cid) == len) {
@ -942,13 +940,12 @@ handle_multipart_related (CamelMimePart *part, CamelMimeMessage *root, GtkBox *b
if (body_part == display_part)
continue;
part = CAMEL_MIME_PART (body_part);
cid = get_cid (part, root);
cid = get_cid (body_part, root);
g_free (cid);
}
/* Now, display the displayed part. */
call_handler_function (CAMEL_MIME_PART (display_part), root, box);
call_handler_function (display_part, root, box);
}
/* RFC 2046 says "display the last part that you are able to display". */
@ -961,8 +958,7 @@ find_preferred_alternative (CamelMultipart *multipart)
nparts = camel_multipart_get_number (multipart);
for (i = 0; i < nparts; i++) {
CamelMimePart *part = CAMEL_MIME_PART (
camel_multipart_get_part (multipart, i));
CamelMimePart *part = camel_multipart_get_part (multipart, i);
if (lookup_handler (part, &generic) &&
(!preferred_part || !generic))
@ -1007,7 +1003,7 @@ handle_multipart_appledouble (CamelMimePart *part, CamelMimeMessage *root,
* to us. The second part _may_ be displayable data. Most
* likely it's application/octet-stream though.
*/
part = CAMEL_MIME_PART (camel_multipart_get_part (multipart, 1));
part = camel_multipart_get_part (multipart, 1);
call_handler_function (part, root, box);
}
@ -1257,7 +1253,7 @@ reply_body (CamelDataWrapper *data, gboolean *html)
*/
boundary = camel_multipart_get_boundary (mp);
for (i = 0; i < nparts; i++) {
subpart = CAMEL_MIME_PART (camel_multipart_get_part (mp, i));
subpart = camel_multipart_get_part (mp, i);
disp = camel_mime_part_get_disposition (subpart);
if (disp && strcasecmp (disp, "inline") != 0)