From 84e075645b9013f6c0f8200ebddee10b1904936a Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 26 Apr 2001 19:44:50 +0000 Subject: New file, with the int, string, time_t, and off_t encode/decode routines * camel-file-utils.c: New file, with the int, string, time_t, and off_t encode/decode routines from camel-folder-summary.c moved here and renamed, for the enjoyment of non-CamelFolderSummary subclasses. * Makefile.am (libcamel_la_SOURCES): Add camel-file-utils.c (libcamelinclude_HEADERS): and camel-file-utils.h * camel-folder-summary.c: Remove functions that were moved to camel-file-utils.c, update uses of them for the new names. (camel_folder_summary_{en,de}code_token are still here.) * providers/local/camel-mbox-summary.c: Use camel_file_util_* names * providers/imap/camel-imap-summary.c: Use camel_file_util_* names * providers/imap/camel-imap-store.c (imap_store_setup_online, imap_store_setup_offline): Use camel_file_util_* names, which makes much more sense since this isn't folder summary stuff. svn path=/trunk/; revision=9590 --- camel/providers/imap/camel-imap-store.c | 21 +++++++++++---------- camel/providers/imap/camel-imap-summary.c | 11 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'camel/providers/imap') diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 37eb99623c..38f585d6e7 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -38,6 +38,7 @@ #include "camel-imap-folder.h" #include "camel-imap-utils.h" #include "camel-imap-command.h" +#include "camel-file-utils.h" #include "camel-folder.h" #include "camel-exception.h" #include "camel-session.h" @@ -568,8 +569,8 @@ imap_store_setup_online (CamelImapStore *store, CamelException *ex) g_free (path); /* Write header and capabilities */ - camel_folder_summary_encode_uint32 (storeinfo, IMAP_STOREINFO_VERSION); - camel_folder_summary_encode_uint32 (storeinfo, store->capabilities); + camel_file_util_encode_uint32 (storeinfo, IMAP_STOREINFO_VERSION); + camel_file_util_encode_uint32 (storeinfo, store->capabilities); /* Get namespace and hierarchy separator */ if ((store->capabilities & IMAP_CAPABILITY_NAMESPACE) && @@ -636,8 +637,8 @@ imap_store_setup_online (CamelImapStore *store, CamelException *ex) } /* Write namespace/separator out */ - camel_folder_summary_encode_string (storeinfo, store->namespace); - camel_folder_summary_encode_uint32 (storeinfo, store->dir_sep); + camel_file_util_encode_string (storeinfo, store->namespace); + camel_file_util_encode_uint32 (storeinfo, store->dir_sep); if (CAMEL_STORE (store)->flags & CAMEL_STORE_SUBSCRIPTIONS) { /* Get subscribed folders */ @@ -659,7 +660,7 @@ imap_store_setup_online (CamelImapStore *store, CamelException *ex) } g_hash_table_insert (store->subscribed_folders, name, GINT_TO_POINTER (1)); - camel_folder_summary_encode_string (storeinfo, result); + camel_file_util_encode_string (storeinfo, result); } camel_imap_response_free (response); } @@ -680,20 +681,20 @@ imap_store_setup_offline (CamelImapStore *store, CamelException *ex) g_free (path); tmp = 0; if (storeinfo) - camel_folder_summary_decode_uint32 (storeinfo, &tmp); + camel_file_util_decode_uint32 (storeinfo, &tmp); if (tmp != IMAP_STOREINFO_VERSION) { /* This must set ex and return FALSE if we're here... */ return camel_imap_store_check_online (store, ex); } - camel_folder_summary_decode_uint32 (storeinfo, &store->capabilities); - camel_folder_summary_decode_string (storeinfo, &store->namespace); - camel_folder_summary_decode_uint32 (storeinfo, &tmp); + camel_file_util_decode_uint32 (storeinfo, &store->capabilities); + camel_file_util_decode_string (storeinfo, &store->namespace); + camel_file_util_decode_uint32 (storeinfo, &tmp); store->dir_sep = tmp; /* Get subscribed folders */ store->subscribed_folders = g_hash_table_new (g_str_hash, g_str_equal); - while (camel_folder_summary_decode_string (storeinfo, &buf) == 0) { + while (camel_file_util_decode_string (storeinfo, &buf) == 0) { if (!imap_parse_list_response (buf, NULL, NULL, &name)) { g_free (buf); continue; diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c index ca7a2ab737..cd7444559e 100644 --- a/camel/providers/imap/camel-imap-summary.c +++ b/camel/providers/imap/camel-imap-summary.c @@ -30,7 +30,7 @@ #include #include "camel-imap-summary.h" -#include +#include "camel-file-utils.h" #define CAMEL_IMAP_SUMMARY_VERSION (0x300) @@ -110,7 +110,6 @@ camel_imap_summary_new (const char *filename) { CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY ( camel_object_new (camel_imap_summary_get_type ())); - CamelImapSummary *imap_summary = (CamelImapSummary *)summary; camel_folder_summary_set_build_content (summary, TRUE); camel_folder_summary_set_filename (summary, filename); @@ -132,7 +131,7 @@ summary_header_load (CamelFolderSummary *s, FILE *in) if (camel_imap_summary_parent->summary_header_load (s, in) == -1) return -1; - return camel_folder_summary_decode_uint32 (in, &ims->validity); + return camel_file_util_decode_uint32 (in, &ims->validity); } static int @@ -143,7 +142,7 @@ summary_header_save (CamelFolderSummary *s, FILE *out) if (camel_imap_summary_parent->summary_header_save (s, out) == -1) return -1; - return camel_folder_summary_encode_uint32 (out, ims->validity); + return camel_file_util_encode_uint32 (out, ims->validity); } @@ -157,7 +156,7 @@ message_info_load (CamelFolderSummary *s, FILE *in) if (info) { iinfo = (CamelImapMessageInfo *)info; - if (camel_folder_summary_decode_uint32 (in, &iinfo->server_flags) == -1) + if (camel_file_util_decode_uint32 (in, &iinfo->server_flags) == -1) goto error; } @@ -175,7 +174,7 @@ message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info) if (camel_imap_summary_parent->message_info_save (s, out, info) == -1) return -1; - return camel_folder_summary_encode_uint32 (out, iinfo->server_flags); + return camel_file_util_encode_uint32 (out, iinfo->server_flags); } -- cgit