aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-05-31 04:02:42 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-31 04:02:42 +0800
commitb3cdb41a122e797572b834fac6d5e11ddd579d5e (patch)
tree812923c019457ce8a7ea32e0e8504b51cb14cf05
parentd32ba2a70aebd94d176f73a64bc83ed59038e835 (diff)
downloadgsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar.gz
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar.bz2
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar.lz
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar.xz
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.tar.zst
gsoc2013-evolution-b3cdb41a122e797572b834fac6d5e11ddd579d5e.zip
new class. Represents an abstract stream object.
1999-05-30 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-stream.h: new class. Represents an abstract stream object. svn path=/trunk/; revision=960
-rw-r--r--ChangeLog5
-rw-r--r--camel/Makefile.am2
-rw-r--r--camel/camel-stream.c177
-rw-r--r--camel/camel-stream.h76
-rw-r--r--configure.in4
-rw-r--r--tests/test2.c7
6 files changed, 264 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a2f338eda1..934b0142aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
1999-05-30 bertrand <Bertrand.Guiheneuf@inria.fr>
- * camel/camel-mime-message.c (_set_recipient_list_from_string):
+ * camel/camel-stream.h: new class. Represents an
+ abstract stream object.
+
+ * camel/camel-mime-message.c (_set_recipient_list_from_string):
remove leading and trailing spaces in recipient addresses.
* camel/gmime-utils.c (_store_header_pair_from_gstring):
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 5dec70bfca..0713f735a2 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -21,6 +21,7 @@ libcamel_la_SOURCES = \
camel-service.c \
camel-session.c \
camel-store.c \
+ camel-stream.c \
gmime-content-field.c \
gmime-utils.c \
gstring-util.c \
@@ -36,6 +37,7 @@ libcamelinclude_HEADERS = \
camel-service.h \
camel-session.h \
camel-store.h \
+ camel-stream.h \
gmime-content-field.h \
gmime-utils.h \
gstring-util.h \
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
new file mode 100644
index 0000000000..9af57c5485
--- /dev/null
+++ b/camel/camel-stream.c
@@ -0,0 +1,177 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-stream.c : abstract class for a stream */
+
+
+/*
+ *
+ * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
+ *
+ * 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 "camel-stream.h"
+
+static CamelStreamClass *parent_class=NULL;
+
+
+/* Returns the class for a CamelMimeMessage */
+#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
+
+static gint _read (CamelStream *stream, gchar **buffer, gint n);
+static gint _write (CamelStream *stream, gchar *buffer, gint n);
+static void _flush (CamelStream *stream);
+static gint _available (CamelStream *stream);
+static gboolean _eos (CamelStream *stream);
+static void _close (CamelStream *stream);
+
+
+static void
+camel_stream_class_init (CamelStreamClass *camel_stream_class)
+{
+
+ parent_class = gtk_type_class (gtk_object_get_type ());
+
+ /* virtual method definition */
+ camel_stream_class->read = _read;
+ camel_stream_class->write = _write;
+ camel_stream_class->flush = _flush;
+ camel_stream_class->available = _available;
+ camel_stream_class->eos = _eos;
+ camel_stream_class->close = _close;
+
+ /* virtual method overload */
+
+}
+
+
+
+GtkType
+camel_stream_get_type (void)
+{
+ static GtkType camel_stream_type = 0;
+
+ if (!camel_stream_type) {
+ GtkTypeInfo camel_stream_info =
+ {
+ "CamelMimeMessage",
+ sizeof (CamelStream),
+ sizeof (CamelStreamClass),
+ (GtkClassInitFunc) camel_stream_class_init,
+ (GtkObjectInitFunc) NULL,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ camel_stream_type = gtk_type_unique (gtk_object_get_type (), &camel_stream_info);
+ }
+
+ return camel_stream_type;
+}
+
+
+
+/**
+ * _read: read bytes from a stream
+ * @stream: stream
+ * @buffer: buffer where bytes are stored
+ * @n: max number of bytes to read
+ *
+ *
+ *
+ * Return value: number of bytes actually read.
+ **/
+static gint
+_read (CamelStream *stream, gchar **buffer, gint n)
+{
+
+}
+
+
+/**
+ * _write: read bytes to a stream
+ * @stream: the stream
+ * @buffer: byte buffer
+ * @n: number of bytes to write
+ *
+ *
+ *
+ * Return value: the number of bytes actually written
+ * in the stream.
+ **/
+static gint
+_write (CamelStream *stream, gchar *buffer, gint n)
+{
+
+}
+
+
+
+/**
+ * _flush: flush pending changes
+ * @stream: the stream
+ *
+ *
+ **/
+static void
+_flush (CamelStream *stream)
+{
+
+}
+
+
+
+/**
+ * _available: return the number of bytes available for reading
+ * @stream: the stream
+ *
+ * Return the number of bytes available without blocking.
+ *
+ * Return value: the number of bytes available
+ **/
+static gint
+_available (CamelStream *stream)
+{
+
+}
+
+
+/**
+ * _eos: test if there are bytes left to read
+ * @stream: the stream
+ *
+ *
+ *
+ * Return value: true if all stream has been read
+ **/
+static gboolean
+_eos (CamelStream *stream)
+{
+
+}
+
+
+/**
+ * _close: close a stream
+ * @stream: the stream
+ *
+ *
+ **/
+static void
+_close (CamelStream *stream)
+{
+
+}
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
new file mode 100644
index 0000000000..e58cfd92ff
--- /dev/null
+++ b/camel/camel-stream.h
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-stream.h : class for an abstract stream */
+
+/*
+ *
+ * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
+ *
+ * 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_STREAM_H
+#define CAMEL_STREAM_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus }*/
+
+#include <gtk/gtk.h>
+
+#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
+#define CAMEL_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelMimeMessage))
+#define CAMEL_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_TYPE, CamelMimeMessageClass))
+#define IS_CAMEL_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_TYPE))
+
+
+
+typedef struct
+{
+ GtkObject parent_object;
+
+} CamelStream;
+
+
+
+typedef struct {
+ GtkObjectClass parent_class;
+
+ /* Virtual methods */
+gint (*read) (CamelStream *stream, gchar **buffer, gint n);
+gint (*write) (CamelStream *stream, gchar *buffer, gint n);
+void (*flush) (CamelStream *stream);
+gint (*available) (CamelStream *stream);
+gboolean (*eos) (CamelStream *stream);
+void (*close) (CamelStream *stream);
+
+} CamelStreamClass;
+
+
+
+/* Standard Gtk function */
+GtkType camel_stream_get_type (void);
+
+
+/* public methods */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_STREAM_H */
diff --git a/configure.in b/configure.in
index b05a0df023..91711cd682 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(camel)
+AM_CONFIG_HEADER(config.h)
cflags_set=${CFLAGS+set}
@@ -12,7 +13,6 @@ PACKAGE=gnome-mailer
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_SUBST(VERSION)
-AM_CONFIG_HEADER(config.h)
dnl Initialize libtool
AM_PROG_LIBTOOL
@@ -51,7 +51,7 @@ dnl ******************************
dnl Check for Bonobo
dnl ******************************
AM_PATH_BONOBO(0.1.0, [
- AC_DEFINE(ENABLE_BONOBO)
+ AC_DEFINE(HAVE_BONOBO)
have_bonobo=true
],[
have_bonobo=false
diff --git a/tests/test2.c b/tests/test2.c
index 538ae14345..91e2fa0f2d 100644
--- a/tests/test2.c
+++ b/tests/test2.c
@@ -5,6 +5,7 @@
#include "camel-log.h"
#include "camel-mime-message.h"
#include "camel-mime-part.h"
+#include "camel-stream.h"
void print_header_pair (gpointer key, gpointer value, gpointer user_data)
{
@@ -32,16 +33,14 @@ main (int argc, char**argv)
FILE *output_file;
GHashTable *header_table;
CamelMimeMessage *message;
- GnomeStream *stream;
-
-
+ CamelStream *stream;
gtk_init (&argc, &argv);
camel_debug_level = FULL_DEBUG;
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
input_file = fopen ("mail.test", "r");
- stream = gnome_stream_fs_open (NULL, "/tmp/a.png", GNOME_Storage_READ);
+ /*stream = gnome_stream_fs_open (NULL, "mail.test", GNOME_Storage_READ);*/
if (!input_file) {
perror("could not open input file");
exit(2);