From 5e144756c987f97f4289d554d9bcdf222cd9b326 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 3 Sep 2002 14:55:03 +0000 Subject: Lots of changes, too numerous to list. Changed to use 2002-09-04 Not Zed * providers/imap/camel-imap-store.c, providers/imap/camel-imap-folder.c: Lots of changes, too numerous to list. Changed to use camel-imap-store-summary to cache list requests. Changed to use a canonicalised url path with / instead of per-store directory separator. Indirects folder name so invalid folder names can still be accessed. Summary now stored in a new expandable format in .ev-store-summary. 2002-08-28 Not Zed * providers/imap/camel-imap-store.c (construct): Load store summary if it exists. (can_work_offline): Just see if we have any folders to say whether we can work offline or not. Should probably always just return true. 2002-08-27 Not Zed * providers/imap/camel-imap-store-summary.[ch]: New files to handle offline definition of folders, etc. * camel-url.h: Define CamelURL to be struct _CamelURL rather than anonymous struct. * camel-store-summary.[ch]: a few api tweaks. Also, the summary header is versioned separately at each level, so that version upgrades can be handled separately. Renamed FolderInfo -> StoreInfo to avoid namespace with current FolderInfo code. This should be reversed when the FolderInfo code is rationalised to this new base. 2002-08-23 Not Zed * providers/imap/camel-imap-command.c (camel_imap_command): domt encode folder name. * providers/imap/camel-imap-folder.c (do_copy): dont encode folder name. (do_append): dont encode folder name. * providers/imap/camel-imap-store.c (get_folder_status): don encode folder name in imap request. (get_folder_online): here too for creating folder. (rename_folder): Assume the incoming 'new name' is a utf8 path, whereas the 'old name' is as from get folder info (raw). (create_folder): Dont encode parent_name, assume its the raw thing. 2002-08-22 Not Zed * providers/imap/camel-imap-store.c (get_folder_online): Select based on unconverted name. (imap_build_folder_info): New function to create a folderinfo properly based on raw name. (subscribe_folder): Use above helper. (imap_folder_effectively_unsubscribed): Same here. (imap_forget_folder): Same here. (get_one_folder_offline): " 2002-08-21 Not Zed * providers/imap/camel-imap-store.c (parse_list_response_as_folder_info): Setup path properly, as decoded path with / separator. Setup full_name as non-decoded raw name. Keep url as decoded path but with server separator ... (ick). (create_folder): Dont call build_path anymore, get_folders() does it for us. (subscribe_folder): Build the path ourself. (imap_folder_effectively_unsubscribed): Same here. (get_subscribed_folders): list using %S not %F, we're using the raw server provided name directly. (subscribe_folder): As above, for SUBSCRIBE. (unsubscribe_folder): Same here. (delete_folder): Same. (rename_folder_info): Same here for source name. (rename_folder): And here? (get_folders_online): Amd here. * providers/imap/camel-imap-utils.c: (imap_parse_list_response): Dont decode the mailbox. * camel-utf8.[ch]: some new utf8 & utf7 utilities. * providers/imap/camel-imap-utils.c (imap_mailbox_encode): (imap_mailbox_decode): use camel_utf7/8* functions instead. : Add config.h and alloca.h headers. svn path=/trunk/; revision=17943 --- camel/camel-store-summary.h | 93 ++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 47 deletions(-) (limited to 'camel/camel-store-summary.h') diff --git a/camel/camel-store-summary.h b/camel/camel-store-summary.h index a26d2fa84c..dbcd6119b7 100644 --- a/camel/camel-store-summary.h +++ b/camel/camel-store-summary.h @@ -29,44 +29,42 @@ extern "C" { #endif /* __cplusplus */ #include -#include -#include -#include -#include -#include + +#include #include #include +#include #define CAMEL_STORE_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_store_summary_get_type (), CamelStoreSummary) #define CAMEL_STORE_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_store_summary_get_type (), CamelStoreSummaryClass) -#define CAMEL_IS_FOLDER_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_store_summary_get_type ()) +#define CAMEL_IS_STORE_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_store_summary_get_type ()) typedef struct _CamelStoreSummary CamelStoreSummary; typedef struct _CamelStoreSummaryClass CamelStoreSummaryClass; -typedef struct _CamelFolderInfo CamelFolderInfo; +typedef struct _CamelStoreInfo CamelStoreInfo; -enum _CamelFolderFlags { - CAMEL_STORE_SUMMARY_FOLDER_NOSELECT, - CAMEL_STORE_SUMMARY_FOLDER_READONLY, - CAMEL_STORE_SUMMARY_FOLDER_SUBSCRIBED, - CAMEL_STORE_SUMMARY_FOLDER_FLAGGED, +enum _CamelStoreInfoFlags { + CAMEL_STORE_INFO_FOLDER_NOSELECT, + CAMEL_STORE_INFO_FOLDER_READONLY, + CAMEL_STORE_INFO_FOLDER_SUBSCRIBED, + CAMEL_STORE_INFO_FOLDER_FLAGGED, }; -#define CAMEL_STORE_SUMMARY_UNKNOWN (~0) +#define CAMEL_STORE_INFO_FOLDER_UNKNOWN (~0) enum { - CAMEL_STORE_SUMMARY_FULL = 0, - CAMEL_STORE_SUMMARY_NAME, - CAMEL_STORE_SUMMARY_URI, - CAMEL_STORE_SUMMARY_LAST, + CAMEL_STORE_INFO_PATH = 0, + CAMEL_STORE_INFO_NAME, + CAMEL_STORE_INFO_URI, + CAMEL_STORE_INFO_LAST, }; -struct _CamelFolderInfo { +struct _CamelStoreInfo { guint32 refcount; char *uri; - char *full; + char *path; guint32 flags; guint32 unread; guint32 total; @@ -74,6 +72,7 @@ struct _CamelFolderInfo { enum _CamelStoreSummaryFlags { CAMEL_STORE_SUMMARY_DIRTY = 1<<0, + CAMEL_STORE_SUMMARY_FRAGMENT = 1<<1, /* path name is stored in fragment rather than path */ }; struct _CamelStoreSummary { @@ -82,22 +81,22 @@ struct _CamelStoreSummary { struct _CamelStoreSummaryPrivate *priv; /* header info */ - guint32 version; /* version of file required, should be set by implementors */ + guint32 version; /* version of base part of file */ guint32 flags; /* flags */ guint32 count; /* how many were saved/loaded */ time_t time; /* timestamp for this summary (for implementors to use) */ + struct _CamelURL *uri_base; /* url of base part of summary */ /* sizes of memory objects */ - guint32 folder_info_size; + guint32 store_info_size; /* memory allocators (setup automatically) */ - struct _EMemChunk *folder_info_chunks; + struct _EMemChunk *store_info_chunks; char *summary_path; - char *uri_prefix; - GPtrArray *folders; /* CamelFolderInfo's */ - GHashTable *folders_full; /* CamelFolderInfo's by full name */ + GPtrArray *folders; /* CamelStoreInfo's */ + GHashTable *folders_path; /* CamelStoreInfo's by path name */ }; struct _CamelStoreSummaryClass { @@ -108,21 +107,21 @@ struct _CamelStoreSummaryClass { int (*summary_header_save)(CamelStoreSummary *, FILE *); /* create/save/load an individual message info */ - CamelFolderInfo * (*folder_info_new)(CamelStoreSummary *, const char *full); - CamelFolderInfo * (*folder_info_load)(CamelStoreSummary *, FILE *); - int (*folder_info_save)(CamelStoreSummary *, FILE *, CamelFolderInfo *); - void (*folder_info_free)(CamelStoreSummary *, CamelFolderInfo *); + CamelStoreInfo * (*store_info_new)(CamelStoreSummary *, const char *path); + CamelStoreInfo * (*store_info_load)(CamelStoreSummary *, FILE *); + int (*store_info_save)(CamelStoreSummary *, FILE *, CamelStoreInfo *); + void (*store_info_free)(CamelStoreSummary *, CamelStoreInfo *); /* virtualise access methods */ - const char *(*folder_info_string)(CamelStoreSummary *, const CamelFolderInfo *, int); - void (*folder_info_set_string)(CamelStoreSummary *, CamelFolderInfo *, int, const char *); + const char *(*store_info_string)(CamelStoreSummary *, const CamelStoreInfo *, int); + void (*store_info_set_string)(CamelStoreSummary *, CamelStoreInfo *, int, const char *); }; CamelType camel_store_summary_get_type (void); CamelStoreSummary *camel_store_summary_new (void); void camel_store_summary_set_filename(CamelStoreSummary *, const char *); -void camel_store_summary_set_uri_prefix(CamelStoreSummary *, const char *); +void camel_store_summary_set_uri_base(CamelStoreSummary *s, CamelURL *base); /* load/save the summary in its entirety */ int camel_store_summary_load(CamelStoreSummary *); @@ -135,21 +134,21 @@ int camel_store_summary_header_load(CamelStoreSummary *); void camel_store_summary_touch(CamelStoreSummary *s); /* add a new raw summary item */ -void camel_store_summary_add(CamelStoreSummary *, CamelFolderInfo *info); +void camel_store_summary_add(CamelStoreSummary *, CamelStoreInfo *info); /* build/add raw summary items */ -CamelFolderInfo *camel_store_summary_add_from_full(CamelStoreSummary *, const char *); +CamelStoreInfo *camel_store_summary_add_from_path(CamelStoreSummary *, const char *); /* Just build raw summary items */ -CamelFolderInfo *camel_store_summary_info_new(CamelStoreSummary *s); -CamelFolderInfo *camel_store_summary_info_new_from_full(CamelStoreSummary *s, const char *); +CamelStoreInfo *camel_store_summary_info_new(CamelStoreSummary *s); +CamelStoreInfo *camel_store_summary_info_new_from_path(CamelStoreSummary *s, const char *); -void camel_store_summary_info_ref(CamelStoreSummary *, CamelFolderInfo *); -void camel_store_summary_info_free(CamelStoreSummary *, CamelFolderInfo *); +void camel_store_summary_info_ref(CamelStoreSummary *, CamelStoreInfo *); +void camel_store_summary_info_free(CamelStoreSummary *, CamelStoreInfo *); /* removes a summary item */ -void camel_store_summary_remove(CamelStoreSummary *s, CamelFolderInfo *info); -void camel_store_summary_remove_full(CamelStoreSummary *s, const char *full); +void camel_store_summary_remove(CamelStoreSummary *s, CamelStoreInfo *info); +void camel_store_summary_remove_path(CamelStoreSummary *s, const char *path); void camel_store_summary_remove_index(CamelStoreSummary *s, int); /* remove all items */ @@ -157,18 +156,18 @@ void camel_store_summary_clear(CamelStoreSummary *s); /* lookup functions */ int camel_store_summary_count(CamelStoreSummary *); -CamelFolderInfo *camel_store_summary_index(CamelStoreSummary *, int); -CamelFolderInfo *camel_store_summary_full(CamelStoreSummary *, const char *uid); +CamelStoreInfo *camel_store_summary_index(CamelStoreSummary *, int); +CamelStoreInfo *camel_store_summary_path(CamelStoreSummary *, const char *uid); GPtrArray *camel_store_summary_array(CamelStoreSummary *s); void camel_store_summary_array_free(CamelStoreSummary *s, GPtrArray *array); -const char *camel_folder_info_string(CamelStoreSummary *, const CamelFolderInfo *, int type); -void camel_folder_info_set_string(CamelStoreSummary *, CamelFolderInfo *, int type, const char *value); +const char *camel_store_info_string(CamelStoreSummary *, const CamelStoreInfo *, int type); +void camel_store_info_set_string(CamelStoreSummary *, CamelStoreInfo *, int type, const char *value); /* helper macro's */ -#define camel_folder_info_full(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_FULL)) -#define camel_folder_info_uri(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_URI)) -#define camel_folder_info_name(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_NAME)) +#define camel_store_info_path(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_PATH)) +#define camel_store_info_uri(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_URI)) +#define camel_store_info_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_NAME)) #ifdef __cplusplus } -- cgit v1.2.3