
2003-09-12 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-mbox-folder.c (camel_mbox_folder_get_full_path): Implements CamelLocalFolder::get_full_path() (publicly namespaced so that CamelMboxStore can re-use them). (camel_mbox_folder_get_meta_path): Same. * providers/local/camel-mbox-store.c (get_folder): Changed the way the path is constructed, since we now handle subdirectories and stuff. (delete_folder): Try deleting the Folder.sbd directory. We also need to manage our own meta files since CamelLocalStore's impl constructs paths differently than what we need. (create_folder): Implemented. (rename_folder): Implemented. (scan_dir): Scan an mbox tree (get_folder_info): Implemented using scan_dir(). * providers/local/camel-local-store.c (delete_folder): Set fi->url to the correct value, meaning we need to prefix it with the protocol and the folder_name is not actually part of the path, it is a separate component to the url. * providers/local/camel-local-folder.c (camel_local_folder_construct): Use the new class virtual method to construct the full folder path and all the meta files. (local_get_full_path): Implemented default get_full_path method. (local_get_meta_path): Implemented default get_meta_path method. svn path=/trunk/; revision=22557
110 lines
3.6 KiB
C
110 lines
3.6 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
*
|
|
* Author: Michael Zucchi <notzed@ximian.com>
|
|
*
|
|
* Copyright (C) 1999 Ximian (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_LOCAL_FOLDER_H
|
|
#define CAMEL_LOCAL_FOLDER_H 1
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#pragma }
|
|
#endif /* __cplusplus }*/
|
|
|
|
#include <camel/camel-folder.h>
|
|
#include <camel/camel-folder-search.h>
|
|
#include <camel/camel-index.h>
|
|
#include "camel-local-summary.h"
|
|
#include "camel-lock.h"
|
|
|
|
/* #include "camel-store.h" */
|
|
|
|
#define CAMEL_LOCAL_FOLDER_TYPE (camel_local_folder_get_type ())
|
|
#define CAMEL_LOCAL_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolder))
|
|
#define CAMEL_LOCAL_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolderClass))
|
|
#define CAMEL_IS_LOCAL_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_LOCAL_FOLDER_TYPE))
|
|
|
|
enum {
|
|
CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY = CAMEL_FOLDER_ARG_LAST,
|
|
|
|
CAMEL_LOCAL_FOLDER_ARG_LAST = CAMEL_FOLDER_ARG_LAST + 0x100
|
|
};
|
|
|
|
enum {
|
|
CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_INT,
|
|
};
|
|
|
|
typedef struct {
|
|
CamelFolder parent_object;
|
|
struct _CamelLocalFolderPrivate *priv;
|
|
|
|
guint32 flags; /* open mode flags */
|
|
|
|
int locked; /* lock counter */
|
|
CamelLockType locktype; /* what type of lock we have */
|
|
|
|
char *base_path; /* base path of the local folder */
|
|
char *folder_path; /* the path to the folder itself */
|
|
char *summary_path; /* where the summary lives */
|
|
char *index_path; /* where the index file lives */
|
|
|
|
CamelIndex *index; /* index for this folder */
|
|
CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
|
|
CamelFolderChangeInfo *changes; /* used to store changes to the folder during processing */
|
|
} CamelLocalFolder;
|
|
|
|
typedef struct {
|
|
CamelFolderClass parent_class;
|
|
|
|
/* Virtual methods */
|
|
|
|
/* path construction, only used at init */
|
|
char * (* get_full_path) (const char *toplevel_dir, const char *full_name);
|
|
char * (* get_meta_path) (const char *toplevel_dir, const char *full_name, const char *ext);
|
|
|
|
/* summary factory, only used at init */
|
|
CamelLocalSummary *(*create_summary)(const char *path, const char *folder, CamelIndex *index);
|
|
|
|
/* Lock the folder for my operations */
|
|
int (*lock)(CamelLocalFolder *, CamelLockType type, CamelException *ex);
|
|
|
|
/* Unlock the folder for my operations */
|
|
void (*unlock)(CamelLocalFolder *);
|
|
} CamelLocalFolderClass;
|
|
|
|
|
|
/* public methods */
|
|
/* flags are taken from CAMEL_STORE_FOLDER_* flags */
|
|
CamelLocalFolder *camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store,
|
|
const char *full_name, guint32 flags, CamelException *ex);
|
|
|
|
/* Standard Camel function */
|
|
CamelType camel_local_folder_get_type(void);
|
|
|
|
/* Lock the folder for internal use. May be called repeatedly */
|
|
/* UNIMPLEMENTED */
|
|
int camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
|
|
int camel_local_folder_unlock(CamelLocalFolder *lf);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* CAMEL_LOCAL_FOLDER_H */
|