1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Authors: Jeffrey Stedfast <fejj@ximian.com>
5 * Copyright 2002 Ximian, Inc. (www.ximian.com)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
30 #include "camel-exception.h"
31 #include "camel-digest-store.h"
32 #include "camel-digest-folder.h"
34 #include "camel-private.h"
38 static CamelFolder *digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
39 static void digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex);
40 static void digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex);
41 static void digest_init_trash (CamelStore *store);
42 static CamelFolder *digest_get_trash (CamelStore *store, CamelException *ex);
43 static void digest_init_junk (CamelStore *store);
44 static CamelFolder *digest_get_junk (CamelStore *store, CamelException *ex);
46 static CamelFolderInfo *digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex);
48 static void camel_digest_store_class_init (CamelDigestStoreClass *klass);
49 static void camel_digest_store_init (CamelDigestStore *obj);
50 static void camel_digest_store_finalise (CamelObject *obj);
52 static int digest_setv (CamelObject *object, CamelException *ex, CamelArgV *args);
53 static int digest_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args);
55 static CamelStoreClass *parent_class = NULL;
59 camel_digest_store_get_type (void)
61 static CamelType type = CAMEL_INVALID_TYPE;
63 if (type == CAMEL_INVALID_TYPE) {
64 type = camel_type_register (camel_store_get_type (),
66 sizeof (CamelDigestStore),
67 sizeof (CamelDigestStoreClass),
68 (CamelObjectClassInitFunc) camel_digest_store_class_init,
70 (CamelObjectInitFunc) camel_digest_store_init,
71 (CamelObjectFinalizeFunc) camel_digest_store_finalise);
78 camel_digest_store_class_init (CamelDigestStoreClass *klass)
80 CamelObjectClass *object_class = (CamelObjectClass *) klass;
81 CamelStoreClass *store_class = (CamelStoreClass *) klass;
83 parent_class = CAMEL_STORE_CLASS(camel_type_get_global_classfuncs (camel_store_get_type ()));
85 /* virtual method overload */
86 object_class->setv = digest_setv;
87 object_class->getv = digest_getv;
89 store_class->get_folder = digest_get_folder;
90 store_class->rename_folder = digest_rename_folder;
91 store_class->delete_folder = digest_delete_folder;
92 store_class->get_folder_info = digest_get_folder_info;
93 store_class->free_folder_info = camel_store_free_folder_info_full;
95 store_class->init_trash = digest_init_trash;
96 store_class->get_trash = digest_get_trash;
97 store_class->init_junk = digest_init_junk;
98 store_class->get_junk = digest_get_junk;
102 camel_digest_store_init (CamelDigestStore *obj)
104 CamelStore *store = (CamelStore *) obj;
106 /* we dont want a vtrash and vjunk on this one */
107 store->flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);
111 camel_digest_store_finalise (CamelObject *obj)
117 digest_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
119 /* CamelDigestStore doesn't currently have anything to set */
120 return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
124 digest_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
126 /* CamelDigestStore doesn't currently have anything to get */
127 return CAMEL_OBJECT_CLASS (parent_class)->getv (object, ex, args);
132 * camel_digest_store_new:
135 * Create a new CamelDigestStore object.
137 * Return value: A new CamelDigestStore widget.
140 camel_digest_store_new (const char *url)
145 uri = camel_url_new (url, NULL);
149 store = CAMEL_STORE (camel_object_new (camel_digest_store_get_type ()));
150 CAMEL_SERVICE (store)->url = uri;
156 digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
162 digest_init_trash (CamelStore *store)
169 digest_get_trash (CamelStore *store, CamelException *ex)
175 digest_init_junk (CamelStore *store)
182 digest_get_junk (CamelStore *store, CamelException *ex)
187 static CamelFolderInfo *
188 digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex)
194 digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
200 digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex)