From d46cb0fd8d142c6dfa186db76202bb9912fbb7fa Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 30 Nov 2001 03:09:38 +0000 Subject: Completely new implementation of NNTP. 2001-11-30 Not Zed * providers/nntp/camel-nntp-*.c: Completely new implementation of NNTP. Doesn't support subscriptions yet (lists all folders), but should be more reliable (faster?), and has an integrated cache. * camel-exception.c (camel_exception_new): Use e_memchunks for exception blocks. (camel_exception_free): Same. * camel-data-cache.[ch]: New object for managing on-disk caches of anything that can be stored in a camel-stream. * camel-file-utils.c (camel_file_util_mkdir): New function, just a nicer place to put this (than camel-store), should be removed from camel-store. (camel_file_util_safe_filename): New function to url-encode a filename. * camel-mime-parser.c (drop_states): New func to drop the parser state to initial state. (folder_scan_init_with_fd): (folder_scan_init_with_stream): Call above func to reset state if the stream is changed on us so we can change streams to reuse a parser object. svn path=/trunk/; revision=14822 --- camel/camel-data-cache.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 camel/camel-data-cache.h (limited to 'camel/camel-data-cache.h') diff --git a/camel/camel-data-cache.h b/camel/camel-data-cache.h new file mode 100644 index 0000000000..ab6c29a622 --- /dev/null +++ b/camel/camel-data-cache.h @@ -0,0 +1,98 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* camel-data-cache.h: Class for a Camel filesystem cache + * + * Authors: Michael Zucchi + * + * Copyright (C) 2001 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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_DATA_CACHE_H +#define CAMEL_DATA_CACHE_H 1 + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + +#include + +#include +#include + +#define CAMEL_DATA_CACHE_TYPE (camel_data_cache_get_type ()) +#define CAMEL_DATA_CACHE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_DATA_CACHE_TYPE, CamelFolder)) +#define CAMEL_DATA_CACHE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_DATA_CACHE_TYPE, CamelFolderClass)) +#define CAMEL_IS_DATA_CACHE(o) (CAMEL_CHECK_TYPE((o), CAMEL_DATA_CACHE_TYPE)) + +typedef struct _CamelDataCache CamelDataCache; +typedef struct _CamelDataCacheClass CamelDataCacheClass; + +struct _CamelDataCache { + CamelObject parent_object; + + struct _CamelDataCachePrivate *priv; + + char *path; + guint32 flags; + + time_t expire_age; + time_t expire_access; +}; + +struct _CamelDataCacheClass { + CamelObjectClass parent_class; + + /* None are virtual yet */ +#if 0 + /* Virtual methods */ + CamelStream *(*add)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex); + CamelStream *(*get)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex); + int (*close)(CamelDataCache *cmc, CamelStream *stream, CamelException *ex); + int (*remove)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex); + + int (*clear)(CamelDataCache *cmc, const char *path, CamelException *ex); +#endif +}; + +/* public methods */ +CamelDataCache *camel_data_cache_new(const char *path, guint32 flags, CamelException *ex); + +void camel_data_cache_set_expire_age(CamelDataCache *cache, time_t when); +void camel_data_cache_set_expire_access(CamelDataCache *cdc, time_t when); + +int camel_data_cache_rename(CamelDataCache *cache, + const char *old, const char *new, CamelException *ex); + +CamelStream *camel_data_cache_add(CamelDataCache *cache, + const char *path, const char *key, CamelException *ex); +CamelStream *camel_data_cache_get(CamelDataCache *cache, + const char *path, const char *key, CamelException *ex); +int camel_data_cache_remove(CamelDataCache *cache, + const char *path, const char *key, CamelException *ex); + +int camel_data_cache_clear(CamelDataCache *cache, + const char *path, CamelException *ex); + +/* Standard Camel function */ +CamelType camel_data_cache_get_type (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CAMEL_DATA_CACHE_H */ -- cgit v1.2.3