+2000-05-07 Dan Winship <danw@helixcode.com>
+
+ Make camel not leak like a sieve.
+
+ * camel-object.c: New subclass of GtkObject which is now the base
+ of the Camel object hierarchy. Currently the only difference
+ between CamelObject and GtkObject is that CamelObjects don't start
+ out floating.
+
+ * *.h: Move a bunch of typedefs to camel-types.h. Standardize on
+ using <camel/foo.h> in header files rather than <foo.h>, "foo.h",
+ or "camel/foo.h". Remove some unneeded includes.
+
+ * camel-address.c, camel-data-wrapper.c, camel-folder-search.c,
+ camel-folder-summary.c, camel-folder.c, camel-mime-filter.c,
+ camel-mime-parser.c, camel-service.c, camel-session.c,
+ camel-stream.c: These are now subclasses of CamelObject.
+
+ * camel-data-wrapper.c (set_output_stream):
+ * camel-medium.c (set_content_object):
+ * camel-seekable-substream.c
+ (init_with_seekable_stream_and_bounds):
+ * providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid):
+ remove gtk_object_sink calls.
+
+ * camel-stream-buffer.c (init_vbuf):
+ * camel-stream-filter.c (camel_stream_filter_new_with_stream):
+ ref the original stream.
+
+ * camel-folder-summary.c (camel_folder_summary_finalise): unref
+ the filters when finalizing.
+
+ * camel-mime-part-utils.c
+ (simple_data_wrapper_construct_from_parser,
+ camel_mime_part_construct_content_from_parser):
+ * camel-mime-part.c (camel_mime_part_set_content): Unref objects
+ that are created only to be handed off to other objects. If
+ they're going to be needed later, they will have been additionally
+ ref'ed by the object that needs them.
+
+ * providers/pop3/camel-pop3-folder.c (get_message_by_number):
+ unref the message stream after creating the data from it.
+
+ * camel-stream.c, camel-stream-buffer.c, camel-stream-filter.c,
+ camel-stream-fs.c, camel-stream-mem.c: Remove camel_stream_close,
+ since its semantics are dubious (what happens when you close a
+ stream other people still have references on?).
+
+ * providers/nntp/camel-nntp-store.c:
+ * providers/smtp/camel-smtp-transport.c:
+ * providers/pop3/camel-pop3-store.c:
+ replace camel_stream_close calls with gtk_object_unref.
+
+ * providers/mbox/camel-mbox-folder.c:
+ * providers/nntp/camel-nntp-folder.c:
+ * providers/sendmail/camel-sendmail-transport.c:
+ replace camel_stream_close with camel_stream_flush +
+ gtk_object_unref
+
2000-05-06 Dan Winship <danw@helixcode.com>
* providers/pop3/camel-pop3-store.c (query_auth_types): A machine
camel-mime-part-utils.c \
camel-movemail.c \
camel-multipart.c \
+ camel-object.c \
camel-op-queue.c \
camel-provider.c \
camel-seekable-stream.c \
camel-mime-part-utils.h \
camel-movemail.h \
camel-multipart.h \
+ camel-object.h \
camel-op-queue.h \
camel-provider.h \
camel-seekable-stream.h \
static void camel_address_init (CamelAddress *obj);
static void camel_address_finalise (GtkObject *obj);
-static GtkObjectClass *camel_address_parent;
+static CamelObjectClass *camel_address_parent;
enum SIGNALS {
LAST_SIGNAL
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = gtk_type_unique (camel_object_get_type (), &type_info);
}
return type;
{
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- camel_address_parent = gtk_type_class (gtk_object_get_type ());
+ camel_address_parent = gtk_type_class (camel_object_get_type ());
object_class->finalize = camel_address_finalise;
#ifndef _CAMEL_ADDRESS_H
#define _CAMEL_ADDRESS_H
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#define CAMEL_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_address_get_type (), CamelAddress)
#define CAMEL_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_address_get_type (), CamelAddressClass)
#define IS_CAMEL_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_address_get_type ())
-typedef struct _CamelAddress CamelAddress;
typedef struct _CamelAddressClass CamelAddressClass;
struct _CamelAddress {
- GtkObject parent;
+ CamelObject parent;
GPtrArray *addresses;
};
struct _CamelAddressClass {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
int (*decode) (CamelAddress *, const char *raw);
char *(*encode) (CamelAddress *);
#define d(x)
-static GtkObjectClass *parent_class = NULL;
+static CamelObjectClass *parent_class = NULL;
/* Returns the class for a CamelDataWrapper */
#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass)
GtkObjectClass *gtk_object_class =
GTK_OBJECT_CLASS (camel_data_wrapper_class);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (camel_object_get_type ());
/* virtual method definition */
camel_data_wrapper_class->write_to_stream = write_to_stream;
(GtkClassInitFunc) NULL,
};
- camel_data_wrapper_type = gtk_type_unique (gtk_object_get_type (), &camel_data_wrapper_info);
+ camel_data_wrapper_type = gtk_type_unique (camel_object_get_type (), &camel_data_wrapper_info);
}
return camel_data_wrapper_type;
if (camel_data_wrapper->output_stream)
gtk_object_unref (GTK_OBJECT (camel_data_wrapper->output_stream));
- parent_class->finalize (object);
+ GTK_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
gtk_object_unref (GTK_OBJECT (data_wrapper->output_stream));
data_wrapper->output_stream = stream;
- if (stream) {
+ if (stream)
gtk_object_ref (GTK_OBJECT (stream));
- gtk_object_sink (GTK_OBJECT (stream));
- }
d(printf("data_wrapper:: set_output_stream(%p)\n", stream));
}
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "gmime-content-field.h"
+#include <camel/camel-object.h>
+#include <camel/gmime-content-field.h>
#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
#define CAMEL_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
struct _CamelDataWrapper
{
- GtkObject parent_object;
+ CamelObject parent_object;
CamelStream *input_stream;
CamelStream *output_stream;
typedef struct {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* Virtual methods */
void (*set_output_stream) (CamelDataWrapper *data_wrapper,
#endif /* __cplusplus }*/
#include <glib.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
typedef enum {
#include "camel-exception-list.def"
#include <errno.h>
-static CamelFolderClass *parent_class=NULL;
+static CamelFolderClass *parent_class = NULL;
/* Returns the class for CamelFolderPtProxy and CamelFolder objects */
#define CFPP_CLASS(so) CAMEL_FOLDER_PT_PROXY_CLASS (GTK_OBJECT(so)->klass)
(GtkClassInitFunc) NULL,
};
- camel_folder_pt_proxy_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_pt_proxy_info);
+ camel_folder_pt_proxy_type = gtk_type_unique (camel_folder_get_type (), &camel_folder_pt_proxy_info);
}
return camel_folder_pt_proxy_type;
#pragma }
#endif /* __cplusplus }*/
-#include "camel-folder.h"
-#include "camel-op-queue.h"
-#include "camel-thread-proxy.h"
+#include <camel/camel-folder.h>
+#include <camel/camel-op-queue.h>
+#include <camel/camel-thread-proxy.h>
#define CAMEL_FOLDER_PT_PROXY_TYPE (camel_folder_pt_proxy_get_type ())
static void camel_folder_search_init (CamelFolderSearch *obj);
static void camel_folder_search_finalise (GtkObject *obj);
-static GtkObjectClass *camel_folder_search_parent;
+static CamelObjectClass *camel_folder_search_parent;
enum SIGNALS {
LAST_SIGNAL
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = gtk_type_unique (camel_object_get_type (), &type_info);
}
return type;
{
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- camel_folder_search_parent = gtk_type_class (gtk_object_get_type ());
+ camel_folder_search_parent = gtk_type_class (camel_object_get_type ());
object_class->finalize = camel_folder_search_finalise;
#ifndef _CAMEL_FOLDER_SEARCH_H
#define _CAMEL_FOLDER_SEARCH_H
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#include <e-util/e-sexp.h>
#include <libibex/ibex.h>
#include <camel/camel-folder.h>
#define CAMEL_FOLDER_SEARCH_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_folder_search_get_type (), CamelFolderSearchClass)
#define IS_CAMEL_FOLDER_SEARCH(obj) GTK_CHECK_TYPE (obj, camel_folder_search_get_type ())
-typedef struct _CamelFolderSearch CamelFolderSearch;
typedef struct _CamelFolderSearchClass CamelFolderSearchClass;
struct _CamelFolderSearch {
- GtkObject parent;
+ CamelObject parent;
struct _CamelFolderSearchPrivate *priv;
};
struct _CamelFolderSearchClass {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* general bool/comparison options, usually these wont need to be set, unless it is compiling into another language */
ESExpResult * (*and)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
static void camel_folder_summary_init (CamelFolderSummary *obj);
static void camel_folder_summary_finalise (GtkObject *obj);
-static GtkObjectClass *camel_folder_summary_parent;
+static CamelObjectClass *camel_folder_summary_parent;
enum SIGNALS {
LAST_SIGNAL
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = gtk_type_unique (camel_object_get_type (), &type_info);
}
return type;
{
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- camel_folder_summary_parent = gtk_type_class (gtk_object_get_type ());
+ camel_folder_summary_parent = gtk_type_class (camel_object_get_type ());
object_class->finalize = camel_folder_summary_finalise;
g_hash_table_destroy(p->filter_charset);
g_free(p);
+ if (p->filter_index)
+ gtk_object_unref ((GtkObject *)p->filter_index);
+ if (p->filter_64)
+ gtk_object_unref ((GtkObject *)p->filter_64);
+ if (p->filter_qp)
+ gtk_object_unref ((GtkObject *)p->filter_qp);
+ if (p->filter_save)
+ gtk_object_unref ((GtkObject *)p->filter_save);
+
((GtkObjectClass *)(camel_folder_summary_parent))->finalize((GtkObject *)obj);
}
camel_folder_summary_set_filename(s, "index.summary");
camel_folder_summary_save(s);
- gtk_object_unref(mp);
- gtk_object_unref(s);
+ gtk_object_unref(GTK_OBJECT(mp));
+ gtk_object_unref(GTK_OBJECT(s));
printf("summarised %d messages\n", camel_folder_summary_count(s));
#if 0
#ifndef _CAMEL_FOLDER_SUMMARY_H
#define _CAMEL_FOLDER_SUMMARY_H
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#include <stdio.h>
#include <time.h>
#include <camel/camel-mime-parser.h>
};
struct _CamelFolderSummary {
- GtkObject parent;
+ CamelObject parent;
struct _CamelFolderSummaryPrivate *priv;
};
struct _CamelFolderSummaryClass {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* load/save the global info */
int (*summary_header_load)(CamelFolderSummary *, FILE *);
#include "camel-store.h"
#include "string-utils.h"
-static GtkObjectClass *parent_class=NULL;
+static CamelObjectClass *parent_class = NULL;
/* Returns the class for a CamelFolder */
#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT (so)->klass)
{
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (camel_object_get_type ());
/* virtual method definition */
camel_folder_class->init = _init;
(GtkClassInitFunc) NULL,
};
- camel_folder_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_info);
+ camel_folder_type = gtk_type_unique (camel_object_get_type (), &camel_folder_info);
}
return camel_folder_type;
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#include <time.h>
-#include "camel-types.h"
#define CAMEL_FOLDER_TYPE (camel_folder_get_type ())
#define CAMEL_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
} CamelFolderOpenMode;
-#warning old summary stuff to be removed!
-
typedef struct {
gchar *name;
gint nb_message; /* ick, these should be renamed to something better */
struct _CamelFolder
{
- GtkObject parent_object;
+ CamelObject parent_object;
CamelFolderOpenMode open_mode;
CamelFolderState open_state;
typedef struct {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* signals */
void (*folder_changed) (CamelFolder *, int type);
#ifndef _CAMEL_INTERNET_ADDRESS_H
#define _CAMEL_INTERNET_ADDRESS_H
-#include <gtk/gtk.h>
#include <camel/camel-address.h>
#define CAMEL_INTERNET_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_internet_address_get_type (), CamelInternetAddress)
#define CAMEL_INTERNET_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_internet_address_get_type (), CamelInternetAddressClass)
#define IS_CAMEL_INTERNET_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_internet_address_get_type ())
-typedef struct _CamelInternetAddress CamelInternetAddress;
typedef struct _CamelInternetAddressClass CamelInternetAddressClass;
struct _CamelInternetAddress {
if (medium->content)
gtk_object_unref (GTK_OBJECT (medium->content));
gtk_object_ref (GTK_OBJECT (content));
- gtk_object_sink (GTK_OBJECT (content));
medium->content = content;
}
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
#include <camel/camel-data-wrapper.h>
#define CAMEL_MEDIUM_TYPE (camel_medium_get_type ())
#ifndef _CAMEL_MIME_FILTER_BASIC_H
#define _CAMEL_MIME_FILTER_BASIC_H
-#include <gtk/gtk.h>
#include <camel/camel-mime-filter.h>
#define CAMEL_MIME_FILTER_BASIC(obj) GTK_CHECK_CAST (obj, camel_mime_filter_basic_get_type (), CamelMimeFilterBasic)
#define CAMEL_MIME_FILTER_BASIC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_basic_get_type (), CamelMimeFilterBasicClass)
#define IS_CAMEL_MIME_FILTER_BASIC(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_basic_get_type ())
-typedef struct _CamelMimeFilterBasic CamelMimeFilterBasic;
typedef struct _CamelMimeFilterBasicClass CamelMimeFilterBasicClass;
typedef enum {
#ifndef _CAMEL_MIME_FILTER_CHARSET_H
#define _CAMEL_MIME_FILTER_CHARSET_H
-#include <gtk/gtk.h>
#include <camel/camel-mime-filter.h>
#include <unicode.h>
#define CAMEL_MIME_FILTER_CHARSET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_charset_get_type (), CamelMimeFilterCharsetClass)
#define IS_CAMEL_MIME_FILTER_CHARSET(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_charset_get_type ())
-typedef struct _CamelMimeFilterCharset CamelMimeFilterCharset;
typedef struct _CamelMimeFilterCharsetClass CamelMimeFilterCharsetClass;
struct _CamelMimeFilterCharset {
#ifndef _CAMEL_MIME_FILTER_INDEX_H
#define _CAMEL_MIME_FILTER_INDEX_H
-#include <gtk/gtk.h>
-#include <libibex/ibex.h>
-
#include <camel/camel-mime-filter.h>
+#include <libibex/ibex.h>
#define CAMEL_MIME_FILTER_INDEX(obj) GTK_CHECK_CAST (obj, camel_mime_filter_index_get_type (), CamelMimeFilterIndex)
#define CAMEL_MIME_FILTER_INDEX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_index_get_type (), CamelMimeFilterIndexClass)
#define IS_CAMEL_MIME_FILTER_INDEX(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_index_get_type ())
-typedef struct _CamelMimeFilterIndex CamelMimeFilterIndex;
typedef struct _CamelMimeFilterIndexClass CamelMimeFilterIndexClass;
struct _CamelMimeFilterIndex {
#ifndef _CAMEL_MIME_FILTER_SAVE_H
#define _CAMEL_MIME_FILTER_SAVE_H
-#include <gtk/gtk.h>
-
#include <camel/camel-mime-filter.h>
#define CAMEL_MIME_FILTER_SAVE(obj) GTK_CHECK_CAST (obj, camel_mime_filter_save_get_type (), CamelMimeFilterSave)
#define CAMEL_MIME_FILTER_SAVE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_save_get_type (), CamelMimeFilterSaveClass)
#define IS_CAMEL_MIME_FILTER_SAVE(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_save_get_type ())
-typedef struct _CamelMimeFilterSave CamelMimeFilterSave;
typedef struct _CamelMimeFilterSaveClass CamelMimeFilterSaveClass;
struct _CamelMimeFilterSave {
static void camel_mime_filter_class_init (CamelMimeFilterClass *klass);
static void camel_mime_filter_init (CamelMimeFilter *obj);
-static GtkObjectClass *camel_mime_filter_parent;
+static CamelObjectClass *camel_mime_filter_parent;
enum SIGNALS {
LAST_SIGNAL
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = gtk_type_unique (camel_object_get_type (), &type_info);
}
return type;
{
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- camel_mime_filter_parent = gtk_type_class (gtk_object_get_type ());
+ camel_mime_filter_parent = gtk_type_class (camel_object_get_type ());
object_class->finalize = finalise;
#ifndef _CAMEL_MIME_FILTER_H
#define _CAMEL_MIME_FILTER_H
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#include <sys/types.h>
#define CAMEL_MIME_FILTER(obj) GTK_CHECK_CAST (obj, camel_mime_filter_get_type (), CamelMimeFilter)
#define CAMEL_MIME_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_get_type (), CamelMimeFilterClass)
#define IS_CAMEL_MIME_FILTER(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_get_type ())
-typedef struct _CamelMimeFilter CamelMimeFilter;
typedef struct _CamelMimeFilterClass CamelMimeFilterClass;
struct _CamelMimeFilter {
- GtkObject parent;
+ CamelObject parent;
struct _CamelMimeFilterPrivate *priv;
};
struct _CamelMimeFilterClass {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* virtual functions */
void (*filter)(CamelMimeFilter *f,
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
#include <camel/camel-mime-part.h>
#include <camel/camel-mime-utils.h>
#include <camel/camel-internet-address.h>
"HSCAN_MESSAGE_END",
};
-static GtkObjectClass *camel_mime_parser_parent;
+static CamelObjectClass *camel_mime_parser_parent;
enum SIGNALS {
LAST_SIGNAL
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = gtk_type_unique (camel_object_get_type (), &type_info);
}
return type;
{
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- camel_mime_parser_parent = gtk_type_class (gtk_object_get_type ());
+ camel_mime_parser_parent = gtk_type_class (camel_object_get_type ());
object_class->finalize = finalise;
#ifndef _CAMEL_MIME_PARSER_H
#define _CAMEL_MIME_PARSER_H
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
#include <camel/camel-mime-utils.h>
#include <camel/camel-mime-filter.h>
#define CAMEL_MIME_PARSER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_parser_get_type (), CamelMimeParserClass)
#define IS_CAMEL_MIME_PARSER(obj) GTK_CHECK_TYPE (obj, camel_mime_parser_get_type ())
-typedef struct _CamelMimeParser CamelMimeParser;
typedef struct _CamelMimeParserClass CamelMimeParserClass;
/* NOTE: if you add more states, you may need to bump the
};
struct _CamelMimeParser {
- GtkObject parent;
+ CamelObject parent;
struct _CamelMimeParserPrivate *priv;
};
struct _CamelMimeParserClass {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
void (*message)(CamelMimeParser *, void *headers);
void (*part)(CamelMimeParser *);
d(printf("Small message part, kept in memory!\n"));
mem = camel_stream_mem_new_with_byte_array(buffer);
camel_data_wrapper_set_output_stream (dw, mem);
+ gtk_object_unref ((GtkObject *)mem);
} else {
CamelStream *sub;
CamelStreamFilter *filter;
camel_stream_filter_add(filter, fch);
}
camel_data_wrapper_set_output_stream (dw, (CamelStream *)filter);
+ gtk_object_unref ((GtkObject *)filter);
} else {
camel_data_wrapper_set_output_stream (dw, sub);
}
+ gtk_object_unref ((GtkObject *)sub);
}
camel_mime_parser_filter_remove(mp, decid);
bodypart = (CamelDataWrapper *)camel_mime_part_new();
camel_mime_part_construct_from_parser((CamelMimePart *)bodypart, mp);
camel_multipart_add_part((CamelMultipart *)content, (CamelMimePart *)bodypart);
+ gtk_object_unref ((GtkObject *)bodypart);
}
d(printf("Created multi-part\n"));
camel_data_wrapper_set_mime_type_field (content,
camel_mime_part_get_content_type ((CamelMimePart *)dw));
camel_medium_set_content_object((CamelMedium *)dw, content);
+ gtk_object_unref ((GtkObject *)content);
}
}
#pragma }
#endif /* __cplusplus }*/
-#include "camel-mime-part.h"
+#include <camel/camel-mime-part.h>
void camel_mime_part_construct_content_from_parser(CamelMimePart *, CamelMimeParser *mp);
CamelDataWrapper *dw;
CamelStream *stream;
- dw = camel_data_wrapper_new();
+ dw = camel_data_wrapper_new ();
camel_data_wrapper_set_mime_type (dw, type);
stream = camel_stream_mem_new_with_buffer (data, length);
camel_data_wrapper_construct_from_stream (dw, stream);
+ gtk_object_unref (GTK_OBJECT (stream));
camel_medium_set_content_object (medium, dw);
+ gtk_object_unref (GTK_OBJECT (dw));
} else {
if (medium->content)
- gtk_object_unref ( (GtkObject *)medium->content);
+ gtk_object_unref (GTK_OBJECT (medium->content));
medium->content = NULL;
}
}
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-medium.h"
+#include <camel/camel-medium.h>
#include <camel/camel-mime-utils.h>
#include <camel/camel-mime-parser.h>
#pragma }
#endif /* __cplusplus }*/
-#include "camel-exception.h"
+#include <camel/camel-exception.h>
int camel_movemail (const char *source, const char *dest, CamelException *ex);
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-data-wrapper.h"
+#include <camel/camel-data-wrapper.h>
#define CAMEL_MULTIPART_TYPE (camel_multipart_get_type ())
#define CAMEL_MULTIPART(obj) (GTK_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
#ifndef _CAMEL_NEWS_ADDRESS_H
#define _CAMEL_NEWS_ADDRESS_H
-#include <gtk/gtk.h>
+#include <camel/camel-address.h>
#define CAMEL_NEWS_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_news_address_get_type (), CamelNewsAddress)
#define CAMEL_NEWS_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_news_address_get_type (), CamelNewsAddressClass)
#define IS_CAMEL_NEWS_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_news_address_get_type ())
-typedef struct _CamelNewsAddress CamelNewsAddress;
typedef struct _CamelNewsAddressClass CamelNewsAddressClass;
struct _CamelNewsAddress {
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-object.c: Base class for Camel */
+
+/*
+ * Author:
+ * Dan Winship <danw@helixcode.com>
+ *
+ * Copyright 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-object.h"
+
+static void
+camel_object_init (gpointer object, gpointer klass)
+{
+ GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
+}
+
+GtkType
+camel_object_get_type (void)
+{
+ static GtkType camel_object_type = 0;
+
+ if (!camel_object_type) {
+ GtkTypeInfo camel_object_info =
+ {
+ "CamelObject",
+ sizeof (CamelObject),
+ sizeof (CamelObjectClass),
+ (GtkClassInitFunc) NULL,
+ (GtkObjectInitFunc) camel_object_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ camel_object_type = gtk_type_unique (gtk_object_get_type (), &camel_object_info);
+ }
+
+ return camel_object_type;
+}
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-object.h: Base class for Camel */
+
+/*
+ * Author:
+ * Dan Winship <danw@helixcode.com>
+ *
+ * Copyright 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_OBJECT_H
+#define CAMEL_OBJECT_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus }*/
+
+#include <gtk/gtk.h>
+#include <camel/camel-types.h>
+
+#define CAMEL_OBJECT_TYPE (camel_object_get_type ())
+#define CAMEL_OBJECT(obj) (GTK_CHECK_CAST((obj), CAMEL_OBJECT_TYPE, CamelObject))
+#define CAMEL_OBJECT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_OBJECT_TYPE, CamelObjectClass))
+#define CAMEL_IS_OBJECT(o) (GTK_CHECK_TYPE((o), CAMEL_OBJECT_TYPE))
+
+
+struct _CamelObject
+{
+ GtkObject parent_object;
+
+};
+
+
+typedef struct {
+ GtkObjectClass parent_class;
+
+} CamelObjectClass;
+
+
+/* Standard Gtk function */
+GtkType camel_object_get_type (void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_OBJECT_H */
#endif /* __cplusplus }*/
#include <glib.h>
-#include "camel-marshal-utils.h"
+#include <camel/camel-marshal-utils.h>
#endif /* __cplusplus }*/
#include <gtk/gtk.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
#define CAMEL_PROVIDER(obj) ((CamelProvider *)(obj))
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
+#include <camel/camel-stream.h>
#include <sys/types.h>
#include <unistd.h>
-#include "camel-types.h"
-#include "camel-stream.h"
#define CAMEL_SEEKABLE_STREAM_TYPE (camel_seekable_stream_get_type ())
#define CAMEL_SEEKABLE_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
/* Store the parent stream. */
seekable_substream->parent_stream = parent_stream;
gtk_object_ref (GTK_OBJECT (parent_stream));
- gtk_object_sink (GTK_OBJECT (parent_stream));
/* Set the bound of the substream. */
camel_seekable_stream_set_bounds ((CamelSeekableStream *)seekable_substream, start, end);
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-seekable-stream.h"
+#include <camel/camel-seekable-stream.h>
#define CAMEL_SEEKABLE_SUBSTREAM_TYPE (camel_seekable_substream_get_type ())
#define CAMEL_SEEKABLE_SUBSTREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream))
#include <ctype.h>
#include <stdlib.h>
-static GtkObjectClass *parent_class=NULL;
+static CamelObjectClass *parent_class = NULL;
/* Returns the class for a CamelService */
#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass)
GtkObjectClass *gtk_object_class =
GTK_OBJECT_CLASS (camel_service_class);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (camel_object_get_type ());
/* virtual method definition */
camel_service_class->connect = _connect;
(GtkClassInitFunc) NULL,
};
- camel_service_type = gtk_type_unique (gtk_object_get_type (),
+ camel_service_type = gtk_type_unique (camel_object_get_type (),
&camel_service_info);
}
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
+#include <camel/camel-url.h>
#include <netdb.h>
-#include "camel-types.h"
-#include "camel-url.h"
#define CAMEL_SERVICE_TYPE (camel_service_get_type ())
#define CAMEL_SERVICE(obj) (GTK_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
#define CAMEL_IS_SERVICE(o) (GTK_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
-
struct _CamelService {
- GtkObject parent_object;
+ CamelObject parent_object;
CamelSession *session;
gboolean connected;
};
-
typedef struct {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
gboolean (*connect) (CamelService *service,
CamelException *ex);
(GtkClassInitFunc) NULL,
};
- camel_session_type = gtk_type_unique (gtk_object_get_type (),
+ camel_session_type = gtk_type_unique (camel_object_get_type (),
&camel_session_info);
}
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-provider.h"
+#include <camel/camel-object.h>
+#include <camel/camel-provider.h>
#define CAMEL_SESSION_TYPE (camel_session_get_type ())
#define CAMEL_SESSION(obj) (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
struct _CamelSession
{
- GtkObject parent_object;
+ CamelObject parent_object;
CamelAuthCallback authenticator;
};
typedef struct {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
} CamelSessionClass;
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-service.h"
+#include <camel/camel-service.h>
#define CAMEL_STORE_TYPE (camel_store_get_type ())
#define CAMEL_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
static void stream_flush (CamelStream *stream);
static gboolean stream_eos (CamelStream *stream);
-static void stream_close (CamelStream *stream);
static void finalize (GtkObject *object);
static void destroy (GtkObject *object);
camel_stream_class->write = stream_write;
camel_stream_class->flush = stream_flush;
camel_stream_class->eos = stream_eos;
- camel_stream_class->close = stream_close;
gtk_object_class->finalize = finalize;
gtk_object_class->destroy = destroy;
if (sbf->stream)
gtk_object_unref(GTK_OBJECT(sbf->stream));
sbf->stream = s;
+ gtk_object_ref(GTK_OBJECT(sbf->stream));
}
static void
return camel_stream_eos(sbf->stream) && sbf->ptr == sbf->end;
}
-static void
-stream_close (CamelStream *stream)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-
- stream_flush(stream);
- camel_stream_close(sbf->stream);
-}
-
/**
* camel_stream_buffer_gets:
* @sbf: A CamelStreamBuffer.
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
+#include <camel/camel-seekable-stream.h>
#include <stdio.h>
-#include "camel-seekable-stream.h"
#define CAMEL_STREAM_BUFFER_TYPE (camel_stream_buffer_get_type ())
#define CAMEL_STREAM_BUFFER(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBuffer))
static gint do_write (CamelStream *stream, const gchar *buffer, gint n);
static void do_flush (CamelStream *stream);
static gboolean do_eos (CamelStream *stream);
-static void do_close (CamelStream *stream);
static void do_reset (CamelStream *stream);
static CamelStreamClass *camel_stream_filter_parent;
camel_stream_class->write = do_write;
camel_stream_class->flush = do_flush;
camel_stream_class->eos = do_eos;
- camel_stream_class->close = do_close;
camel_stream_class->reset = do_reset;
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
CamelStreamFilter *new = CAMEL_STREAM_FILTER ( gtk_type_new (camel_stream_filter_get_type ()));
new->source = stream;
+ gtk_object_ref ((GtkObject *)stream);
+
return new;
}
return camel_stream_eos(filter->source);
}
-static void do_close (CamelStream *stream)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
- p->filteredlen = 0;
- camel_stream_close(filter->source);
-}
-
static void do_reset (CamelStream *stream)
{
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
#ifndef _CAMEL_STREAM_FILTER_H
#define _CAMEL_STREAM_FILTER_H
-#include <gtk/gtk.h>
-
#include <camel/camel-stream.h>
#include <camel/camel-mime-filter.h>
#define CAMEL_STREAM_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_stream_filter_get_type (), CamelStreamFilterClass)
#define IS_CAMEL_STREAM_FILTER(obj) GTK_CHECK_TYPE (obj, camel_stream_filter_get_type ())
-typedef struct _CamelStreamFilter CamelStreamFilter;
typedef struct _CamelStreamFilterClass CamelStreamFilterClass;
struct _CamelStreamFilter {
static gint stream_read (CamelStream *stream, gchar *buffer, gint n);
static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
static void stream_flush (CamelStream *stream);
-static void stream_close (CamelStream *stream);
static off_t stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy);
static void finalize (GtkObject *object);
camel_stream_class->read = stream_read;
camel_stream_class->write = stream_write;
camel_stream_class->flush = stream_flush;
- camel_stream_class->close = stream_close;
camel_seekable_stream_class->seek = stream_seek;
fsync ((CAMEL_STREAM_FS (stream))->fd);
}
-static void
-stream_close (CamelStream *stream)
-{
- CamelStreamFs *fs = (CamelStreamFs *)stream;
- if (fs->fd != -1) {
- close (fs->fd);
- fs->fd = -1;
- } else {
- g_warning("StreamFs::close() on a closed or failed stream");
- }
-}
-
static off_t
stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
{
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
#include <camel/camel-seekable-stream.h>
/* for open flags */
#include <fcntl.h>
#include <errno.h>
-static CamelStreamClass *parent_class=NULL;
+static CamelStreamClass *parent_class = NULL;
/* Returns the class for a CamelStreamMEM */
#define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS (GTK_OBJECT(so)->klass)
static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
static void stream_flush (CamelStream *stream);
static gboolean stream_eos (CamelStream *stream);
-static void stream_close (CamelStream *stream);
static off_t stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy);
static void finalize (GtkObject *object);
CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (camel_stream_get_type ());
/* virtual method definition */
camel_stream_class->write = stream_write;
camel_stream_class->flush = stream_flush;
camel_stream_class->eos = stream_eos;
- camel_stream_class->close = stream_close;
camel_seekable_stream_class->seek = stream_seek;
return ((CamelStreamMem *)stream)->buffer->len <= ((CamelSeekableStream *)stream)->position;
}
-static void
-stream_close (CamelStream *stream)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
-
- if (stream_mem->buffer && stream_mem->owner)
- g_byte_array_free (stream_mem->buffer, TRUE);
- stream_mem->buffer = NULL;
-}
-
static off_t
stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
{
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
+#include <camel/camel-seekable-stream.h>
#include <sys/types.h>
-#include "camel-types.h"
-#include "camel-seekable-stream.h"
#define CAMEL_STREAM_MEM_TYPE (camel_stream_mem_get_type ())
#define CAMEL_STREAM_MEM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
static guint camel_stream_signals[LAST_SIGNAL] = { 0 };
-static GtkObjectClass *parent_class = NULL;
+static CamelObjectClass *parent_class = NULL;
/* Returns the class for a CamelStream */
/* nothing */
}
-static void
-default_camel_close (CamelStream *stream)
-{
- /* nothing */
-}
-
static gboolean
eos (CamelStream *stream)
{
{
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_class);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (camel_object_get_type ());
/* virtual method definition */
camel_stream_class->read = NULL;
camel_stream_class->write = NULL;
camel_stream_class->flush = default_camel_flush;
camel_stream_class->eos = eos;
- camel_stream_class->close = default_camel_close;
- camel_stream_class->close = NULL;
/* virtual method overload */
(GtkClassInitFunc) NULL,
};
- camel_stream_type = gtk_type_unique (gtk_object_get_type (), &camel_stream_info);
+ camel_stream_type = gtk_type_unique (camel_object_get_type (), &camel_stream_info);
}
return camel_stream_type;
/**
- * camel_stram_close:
- * @stream: a CamelStream object.
- *
- * Close the @stream object.
- **/
-void
-camel_stream_close (CamelStream *stream)
-{
- CS_CLASS (stream)->close (stream);
-}
-
-/**
* camel_stream_reset: reset a stream
* @stream: the stream object
*
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
+#include <camel/camel-object.h>
#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
#define CAMEL_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
struct _CamelStream
{
- GtkObject parent_object;
+ CamelObject parent_object;
gboolean eos; /* end of stream indicator, for use by implementing classes */
};
typedef struct {
- GtkObjectClass parent_class;
+ CamelObjectClass parent_class;
/* Virtual methods */
gint (*write) (CamelStream *stream, const gchar *buffer, gint n);
void (*flush) (CamelStream *stream);
gboolean (*eos) (CamelStream *stream);
- void (*close) (CamelStream *stream);
void (*reset) (CamelStream *stream);
} CamelStreamClass;
gint camel_stream_write (CamelStream *stream, const gchar *buffer, gint n);
void camel_stream_flush (CamelStream *stream);
gboolean camel_stream_eos (CamelStream *stream);
-void camel_stream_close (CamelStream *stream);
void camel_stream_reset (CamelStream *stream);
/* utility macros and funcs */
#pragma }
#endif /* __cplusplus }*/
-#include "camel-op-queue.h"
+#include <camel/camel-op-queue.h>
#define CAMEL_THREAD_PROXY(o) (CamelThreadProxy *)(o)
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-service.h"
+#include <camel/camel-service.h>
#define CAMEL_TRANSPORT_TYPE (camel_transport_get_type ())
#define CAMEL_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_TRANSPORT_TYPE, CamelTransport))
#pragma }
#endif /* __cplusplus }*/
+typedef struct _CamelAddress CamelAddress;
typedef struct _CamelDataWrapper CamelDataWrapper;
typedef struct _CamelException CamelException;
typedef struct _CamelFolder CamelFolder;
+typedef struct _CamelFolderSearch CamelFolderSearch;
typedef struct _CamelFolderSummary CamelFolderSummary;
+typedef struct _CamelInternetAddress CamelInternetAddress;
typedef struct _CamelMedium CamelMedium;
+typedef struct _CamelMimeFilter CamelMimeFilter;
+typedef struct _CamelMimeFilterBasic CamelMimeFilterBasic;
+typedef struct _CamelMimeFilterCharset CamelMimeFilterCharset;
+typedef struct _CamelMimeFilterIndex CamelMimeFilterIndex;
+typedef struct _CamelMimeFilterSave CamelMimeFilterSave;
typedef struct _CamelMimeMessage CamelMimeMessage;
+typedef struct _CamelMimeParser CamelMimeParser;
typedef struct _CamelMimePart CamelMimePart;
typedef struct _CamelMultipart CamelMultipart;
+typedef struct _CamelNewsAddress CamelNewsAddress;
+typedef struct _CamelObject CamelObject;
typedef struct _CamelSeekableStream CamelSeekableStream;
typedef struct _CamelSeekableSubstream CamelSeekableSubstream;
typedef struct _CamelService CamelService;
typedef struct _CamelStream CamelStream;
typedef struct _CamelStreamBuffer CamelStreamBuffer;
typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper;
+typedef struct _CamelStreamFilter CamelStreamFilter;
typedef struct _CamelStreamFs CamelStreamFs;
typedef struct _CamelStreamMem CamelStreamMem;
typedef struct _CamelTransport CamelTransport;
#define CAMEL_URL_H 1
#include <glib.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
#include <camel/camel-data-wrapper.h>
#include <camel/camel-exception.h>
#include <camel/camel-folder-pt-proxy.h>
#define MD5_UTILS_H
#include <glib.h>
-#include "camel-stream.h"
+#include <camel/camel-stream.h>
typedef struct {
guint32 buf[4];
camel_stream_write_string (output_stream, "From - \n");
/* FIXME: does this return an error? IT HAS TO FOR THIS TO BE RELIABLE */
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- camel_stream_close (output_stream);
/* TODO: update the summary so it knows a new message is there to summarise/index */
/* This is only a performance improvement, the summary is *only* a cache */
+ camel_stream_flush (output_stream);
gtk_object_unref (GTK_OBJECT (output_stream));
}
message_stream = camel_stream_fs_new_with_name_and_bounds (mbox_folder->folder_file_path, O_RDONLY, 0,
((CamelMboxMessageContentInfo *)info->info.content)->pos,
((CamelMboxMessageContentInfo *)info->info.content)->endpos);
- gtk_object_ref((GtkObject *)message_stream);
- gtk_object_sink((GtkObject *)message_stream);
message = camel_mime_message_new();
if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
gtk_object_unref((GtkObject *)message);
camel_stream_write_string (output_stream, "From - \n");
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
}
- camel_stream_close (output_stream);
+ camel_stream_flush (output_stream);
gtk_object_unref (GTK_OBJECT (output_stream));
/* at this point we have saved the message to a
if (!service_class->disconnect (service, ex))
return FALSE;
- /* Closing the buffered write stream will close the
- * unbuffered read stream wrapped inside it as well.
- */
- camel_stream_close (store->ostream);
gtk_object_unref (GTK_OBJECT (store->ostream));
+ gtk_object_unref (GTK_OBJECT (store->istream));
store->ostream = NULL;
store->istream = NULL;
return TRUE;
msg = camel_mime_message_new ();
camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
msgstream);
+ gtk_object_unref (GTK_OBJECT (msgstream));
return msg;
}
"Could not read greeting from POP "
"server.");
return FALSE;
- camel_stream_close (store->ostream);
- camel_stream_close (store->istream);
+ gtk_object_unref (GTK_OBJECT (store->ostream));
+ gtk_object_unref (GTK_OBJECT (store->istream));
}
apoptime = strchr (buf, '<');
apopend = apoptime ? strchr (apoptime, '>') : NULL;
"server. Error sending username:"
" %s", msg ? msg : "(Unknown)");
g_free (msg);
- camel_stream_close (store->ostream);
- camel_stream_close (store->istream);
+ gtk_object_unref (GTK_OBJECT (store->ostream));
+ gtk_object_unref (GTK_OBJECT (store->istream));
return FALSE;
}
"server. Error sending password:"
" %s", msg ? msg : "(Unknown)");
g_free (msg);
- camel_stream_close (store->ostream);
- camel_stream_close (store->istream);
+ gtk_object_unref (GTK_OBJECT (store->ostream));
+ gtk_object_unref (GTK_OBJECT (store->istream));
return FALSE;
}
if (!service_class->disconnect (service, ex))
return FALSE;
- /* Closing the buffered write stream will close the
- * unbuffered read stream wrapped inside it as well.
- */
- camel_stream_close (store->ostream);
gtk_object_unref (GTK_OBJECT (store->ostream));
+ gtk_object_unref (GTK_OBJECT (store->istream));
store->ostream = NULL;
store->istream = NULL;
return TRUE;
close (fd[0]);
out = camel_stream_fs_new_with_fd (fd[1]);
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), out);
- camel_stream_close (out);
+ camel_stream_flush (out);
+ gtk_object_unref (GTK_OBJECT (out));
/* Wait for sendmail to exit. */
while (waitpid (pid, &wstat, 0) == -1 && errno == EINTR)
if (!service_class->disconnect (service, ex))
return FALSE;
- /* Closing the buffered write stream will close the
- * unbuffered read stream wrapped inside it as well.
- */
- camel_stream_close (transport->ostream);
gtk_object_unref (GTK_OBJECT (transport->ostream));
+ gtk_object_unref (GTK_OBJECT (transport->istream));
transport->ostream = NULL;
transport->istream = NULL;