aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-06-08 05:57:27 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-06-08 05:57:27 +0800
commitc19352fd53ba876a150ff4324aebb0dc06e9e190 (patch)
treedb5b2045221f7f6ca3bd0c862333a92697876b04 /camel
parent9da3c9d23193030efac42e063ed207322bc710a9 (diff)
downloadgsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar.gz
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar.bz2
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar.lz
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar.xz
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.tar.zst
gsoc2013-evolution-c19352fd53ba876a150ff4324aebb0dc06e9e190.zip
Added rules to build camel-imap-stream
2000-06-07 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/Makefile.am: Added rules to build camel-imap-stream * providers/imap/camel-imap-store.c (get_folder): Update. Moved imap_create here. * providers/imap/camel-imap-folder.c (delete_messages): Remove. (imap_create): Removed. (imap_delete): Removed. (imap_exists): Removed. * providers/imap/camel-imap-stream.h: Added typedef's for the stream * providers/imap/camel-imap-stream.c: Modified to build cleanly svn path=/trunk/; revision=3468
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog17
-rw-r--r--camel/providers/imap/Makefile.am4
-rw-r--r--camel/providers/imap/camel-imap-folder.c89
-rw-r--r--camel/providers/imap/camel-imap-store.c78
-rw-r--r--camel/providers/imap/camel-imap-stream.c25
-rw-r--r--camel/providers/imap/camel-imap-stream.h10
6 files changed, 103 insertions, 120 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 814b09b5f4..a7dc884bdd 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,20 @@
+2000-06-07 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * providers/imap/Makefile.am: Added rules to build
+ camel-imap-stream
+
+ * providers/imap/camel-imap-store.c (get_folder): Update.
+ Moved imap_create here.
+
+ * providers/imap/camel-imap-folder.c (delete_messages): Remove.
+ (imap_create): Removed.
+ (imap_delete): Removed.
+ (imap_exists): Removed.
+
+ * providers/imap/camel-imap-stream.h: Added typedef's for the stream
+
+ * providers/imap/camel-imap-stream.c: Modified to build cleanly
+
2000-06-07 Not Zed <NotZed@HelixCode.com>
* camel-mime-utils.c (header_msgid_decode_internal): Properly
diff --git a/camel/providers/imap/Makefile.am b/camel/providers/imap/Makefile.am
index 2243841bd9..8ff4b31350 100644
--- a/camel/providers/imap/Makefile.am
+++ b/camel/providers/imap/Makefile.am
@@ -2,7 +2,7 @@
SUBDIRS =
-libcamelmboxincludedir = $(includedir)/camel
+libcamelimapincludedir = $(includedir)/camel
providerdir = $(pkglibdir)/camel-providers/$(VERSION)
@@ -25,11 +25,13 @@ libcamelimap_la_SOURCES = \
camel-imap-folder.c \
camel-imap-provider.c \
camel-imap-store.c \
+ camel-imap-stream.c \
camel-imap-summary.c
libcamelimapinclude_HEADERS = \
camel-imap-folder.h \
camel-imap-store.h \
+ camel-imap-stream.h \
camel-imap-summary.h
libcamelimap_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 443e1b8fbf..a45d9bd35b 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -57,10 +57,11 @@ static void imap_init (CamelFolder *folder, CamelStore *parent_store,
static void imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
static void imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
+#if 0
static gboolean imap_exists (CamelFolder *folder, CamelException *ex);
-static gboolean imap_create(CamelFolder *folder, CamelException *ex);
static gboolean imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
static gboolean imap_delete_messages (CamelFolder *folder, CamelException *ex);
+#endif
static gint imap_get_message_count (CamelFolder *folder, CamelException *ex);
static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
static GPtrArray *imap_get_uids (CamelFolder *folder, CamelException *ex);
@@ -102,12 +103,12 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
camel_folder_class->open = imap_open;
camel_folder_class->close = imap_close;
-
+#if 0
camel_folder_class->exists = imap_exists;
camel_folder_class->create = imap_create;
camel_folder_class->delete = imap_delete;
-
camel_folder_class->delete_messages = imap_delete_messages;
+#endif
camel_folder_class->get_message_count = imap_get_message_count;
camel_folder_class->append_message = imap_append_message;
camel_folder_class->get_uids = imap_get_uids;
@@ -302,6 +303,7 @@ imap_expunge (CamelFolder *folder, CamelException *ex)
g_free(result);
}
+#if 0
static gboolean
imap_exists (CamelFolder *folder, CamelException *ex)
{
@@ -345,62 +347,8 @@ imap_exists (CamelFolder *folder, CamelException *ex)
return exists;
}
-
-static gboolean
-imap_create (CamelFolder *folder, CamelException *ex)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
- const gchar *folder_file_path, *folder_dir_path;
- gboolean folder_already_exists;
- gchar *result;
- gint status;
-
- g_return_val_if_fail (folder != NULL, FALSE);
-
- /* call default implementation */
- parent_class->create (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- /* get the paths of what we need to create */
- folder_file_path = imap_folder->folder_file_path;
- folder_dir_path = imap_folder->folder_dir_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
- /* if the folder already exists, simply return */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (folder_already_exists)
- return TRUE;
-
- /* create the directory for the subfolder */
- status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result,
- "CREATE %s", imap_folder->folder_file_path);
-
- if (status != CAMEL_IMAP_OK) {
- CamelService *service = CAMEL_SERVICE (folder->parent_store);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not CREATE %s on IMAP server %s: %s.",
- imap_folder->folder_file_path,
- service->url->host,
- status == CAMEL_IMAP_ERR ? result :
- "Unknown error");
- g_free (result);
- return FALSE;
- }
-
- g_free(result);
-
- return TRUE;
-}
-
+#endif
+#if 0
static gboolean
imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
{
@@ -447,23 +395,8 @@ imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
return TRUE;
}
-
-/* TODO: remove this - don't bother coding, it'll be moved/removed */
-gboolean
-imap_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- /* TODO: delete the messages (mark as deleted/whatever) */
-#if 0
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
- gchar *result;
- gint status;
#endif
- g_return_val_if_fail (folder != NULL, FALSE);
-
- return TRUE;
-}
-
static gint
imap_get_message_count (CamelFolder *folder, CamelException *ex)
{
@@ -521,7 +454,7 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
g_return_if_fail (message != NULL);
/* write the message to a CamelStreamMem so we can get it's size */
- mem = camel_stream_mem_new();
+ mem = (CamelStreamMem *)camel_stream_mem_new();
if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (mem)) == -1) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -736,17 +669,17 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *
status == CAMEL_IMAP_ERR ? result :
"Unknown error");
g_free (result);
- return;
+ goto fail;
}
/* where we read from */
- message_stream = camel_stream_mem_new_with_buffer (result, strlen(result));
+ message_stream = (CamelStreamMem *)camel_stream_mem_new_with_buffer (result, strlen(result));
if (message_stream == NULL)
goto fail;
/* we use a parser to verify the message is correct, and in the correct position */
parser = camel_mime_parser_new();
- camel_mime_parser_init_with_stream(parser, message_stream);
+ camel_mime_parser_init_with_stream(parser, CAMEL_STREAM (message_stream));
gtk_object_unref(GTK_OBJECT (message_stream));
camel_mime_parser_scan_from(parser, TRUE);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 54ce3c570c..5c57a8911d 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -52,16 +52,15 @@
static CamelServiceClass *service_class = NULL;
static void finalize (GtkObject *object);
-
+static gboolean imap_create (CamelFolder *folder, CamelException *ex);
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, CamelException *ex);
static GList *query_auth_types (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
+static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create,
CamelException *ex);
-static char *get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
+static char *get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex);
static void
camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
@@ -320,28 +319,75 @@ camel_imap_store_get_toplevel_dir (CamelImapStore *store)
return url->path;
}
+static gboolean
+imap_create (CamelFolder *folder, CamelException *ex)
+{
+ CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
+ const gchar *folder_file_path, *folder_dir_path;
+ gboolean folder_already_exists;
+ gchar *result;
+ gint status;
+
+ g_return_val_if_fail (folder != NULL, FALSE);
+
+ /* get the paths of what we need to create */
+ folder_file_path = imap_folder->folder_file_path;
+ folder_dir_path = imap_folder->folder_dir_path;
+
+ if (!(folder_file_path || folder_dir_path)) {
+ camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+ "invalid folder path. Use set_name ?");
+ return FALSE;
+ }
+
+ /* if the folder already exists, simply return */
+ folder_already_exists = camel_folder_exists (folder, ex);
+ if (camel_exception_get_id (ex))
+ return FALSE;
+
+ if (folder_already_exists)
+ return TRUE;
-static CamelFolder
-*get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
+ /* create the directory for the subfolder */
+ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result,
+ "CREATE %s", imap_folder->folder_file_path);
+
+ if (status != CAMEL_IMAP_OK) {
+ CamelService *service = CAMEL_SERVICE (folder->parent_store);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ "Could not CREATE %s on IMAP server %s: %s.",
+ imap_folder->folder_file_path,
+ service->url->host,
+ status == CAMEL_IMAP_ERR ? result :
+ "Unknown error");
+ g_free (result);
+ return FALSE;
+ }
+
+ g_free(result);
+
+ return TRUE;
+}
+
+static CamelFolder *
+get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex)
{
CamelImapFolder *new_imap_folder;
CamelFolder *new_folder;
- new_imap_folder = gtk_type_new (CAMEL_IMAP_FOLDER_TYPE);
+ new_imap_folder = gtk_type_new (CAMEL_IMAP_FOLDER_TYPE);
new_folder = CAMEL_FOLDER (new_imap_folder);
-
- /* XXX We shouldn't be passing NULL here, but it's equivalent to
- * what was there before, and there's no
- * CamelImapFolder::get_subfolder yet anyway...
- */
CAMEL_FOLDER_CLASS (new_folder)->init (new_folder, store, NULL,
folder_name, '/', ex);
-
- return new_folder;
+
+ if (imap_create (new_folder, ex))
+ return new_folder;
+
+ return NULL;
}
-static gchar
-*get_folder_name (CamelStore *store, const char *folder_name,
+static gchar *
+get_folder_name (CamelStore *store, const char *folder_name,
CamelException *ex)
{
return g_strdup (folder_name);
diff --git a/camel/providers/imap/camel-imap-stream.c b/camel/providers/imap/camel-imap-stream.c
index 24198bfd49..f2400f4ce8 100644
--- a/camel/providers/imap/camel-imap-stream.c
+++ b/camel/providers/imap/camel-imap-stream.c
@@ -49,7 +49,6 @@ camel_imap_stream_class_init (CamelImapStreamClass *camel_imap_stream_class)
/* virtual method overload */
camel_stream_class->read = stream_read;
- /*camel_stream_class->write = stream_write;*/
camel_stream_class->reset = stream_reset;
camel_stream_class->eos = stream_eos;
@@ -113,7 +112,7 @@ finalize (GtkObject *object)
g_free(imap_stream->command);
if (imap_stream->folder)
- gtk_object_unref(imap_stream->folder);
+ gtk_object_unref(GTK_OBJECT (imap_stream->folder));
GTK_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -128,10 +127,11 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
if (!imap_stream->cache) {
/* We need to send the IMAP command since this is our first fetch */
- CamelImapStore *store = CAMEL_IMAP_STORE (imap_stream->folder->parent_store);
+ CamelFolder *folder = CAMEL_FOLDER (imap_stream->folder);
gint status;
- status = camel_imap_command_extended(store->ostream, imap_stream->cache, "%s",
+ status = camel_imap_command_extended(CAMEL_IMAP_STORE (folder->parent_store),
+ &imap_stream->cache, "%s",
imap_stream->command);
if (status != CAMEL_IMAP_OK) {
@@ -162,23 +162,6 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
}
static int
-stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- /* I don't think we need/want this functionality */
- CamelImapStream *imap_stream = CAMEL_IMAP_STREAM (stream);
-
- if (!imap_stream->cache) {
- imap_stream->cache = g_malloc0(n + 1);
- memcpy(imap_stream->cache, buffer, n);
- } else {
- imap_stream->cache = g_realloc(strlen(imap_stream->cache) + n + 1);
- memcpy(imap_stream->cache[strlen(imap_stream->cache)], buffer, n);
- }
-
- return n;
-}
-
-static int
stream_reset (CamelStream *stream)
{
CamelImapStream *imap_stream = CAMEL_IMAP_STREAM (stream);
diff --git a/camel/providers/imap/camel-imap-stream.h b/camel/providers/imap/camel-imap-stream.h
index 01e7e59e18..6cb96e8cc5 100644
--- a/camel/providers/imap/camel-imap-stream.h
+++ b/camel/providers/imap/camel-imap-stream.h
@@ -41,8 +41,10 @@ extern "C" {
#define CAMEL_IMAP_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STREAM_TYPE, CamelImapStreamClass))
#define CAMEL_IS_IMAP_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_IMAP_STREAM_TYPE))
-struct _CamelImapStream
-{
+typedef struct _CamelImapStream CamelImapStream;
+typedef struct _CamelImapStreamClass CamelImapStreamClass;
+
+struct _CamelImapStream {
CamelStream parent_object;
CamelImapFolder *folder;
@@ -51,11 +53,11 @@ struct _CamelImapStream
char *cache_ptr;
};
-typedef struct {
+struct _CamelImapStreamClass {
CamelStreamClass parent_class;
/* Virtual methods */
-} CamelImapStreamClass;
+};
/* Standard Gtk function */
GtkType camel_imap_stream_get_type (void);