diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-10-27 05:22:17 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-10-27 05:22:17 +0800 |
commit | aad2d708c31bc7b238fc4f7027e5c48fcee5f062 (patch) | |
tree | 5b68028a7a5dc5a7f6c5106ea51f7287b9980644 /camel/providers/imap4/camel-imap4-utils.c | |
parent | 99cbfb261554f038d9b709d2b3dab26a7f0e7bef (diff) | |
download | gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar.gz gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar.bz2 gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar.lz gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar.xz gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.tar.zst gsoc2013-evolution-aad2d708c31bc7b238fc4f7027e5c48fcee5f062.zip |
New files implementing a folder-info cache for offline mode (and faster
2004-10-26 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-store-summary.[c,h]: New files
implementing a folder-info cache for offline mode (and faster
startup I guess).
* providers/imap4/camel-imap4-store.c (imap4_build_folder_info):
Cache the folder-info for later use in offline mode.
* providers/imap4/camel-imap4-utils.c
(camel_imap4_get_path_delim): Instead of assigning top = "INBOX",
do strcpy (top, "INBOX") so that we can later modify the
string. Fixes bug #68814.
2004-10-25 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-engine.c (engine_parse_namespace):
Updated to use the public function in camel-imap4-utils.c
(camel_imap4_engine_finalize): Same.
* providers/imap4/camel-imap4-store.c (imap4_construct): Setup and
load the store summary.
(camel_imap4_store_finalize): Unref the store summary.
(imap4_get_folder): Implemented offline support.
(imap4_folder_utf7_name): Pass the summary to get_delim rather
than the engine.
(imap4_create_folder): Same.
(imap4_reconnect): Update the namespaces on the store summary.
(connect_to_server): Update the store summary capabilities.
* providers/imap4/camel-imap4-utils.c
(camel_imap4_get_path_delim): Now takes a store-summary rather
than an engine so that it will work in offline mode.
(camel_imap4_namespace_clear): Moved here from
camel-imap4-engine.c
(camel_imap4_namespace_list_copy): New convenience function.
(camel_imap4_namespace_list_free): New.
* providers/imap4/camel-imap4-folder.c (camel_imap4_folder_new):
Check the return value of summary loading in offline mode (if it
fails, we can't get the folder).
svn path=/trunk/; revision=27730
Diffstat (limited to 'camel/providers/imap4/camel-imap4-utils.c')
-rw-r--r-- | camel/providers/imap4/camel-imap4-utils.c | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/camel/providers/imap4/camel-imap4-utils.c b/camel/providers/imap4/camel-imap4-utils.c index 1c8dc0c1ef..e8f0627ea2 100644 --- a/camel/providers/imap4/camel-imap4-utils.c +++ b/camel/providers/imap4/camel-imap4-utils.c @@ -33,6 +33,7 @@ #include "camel-imap4-engine.h" #include "camel-imap4-stream.h" #include "camel-imap4-command.h" +#include "camel-imap4-store-summary.h" #include "camel-imap4-utils.h" @@ -75,8 +76,68 @@ camel_imap4_merge_flags (guint32 original, guint32 local, guint32 server) } +void +camel_imap4_namespace_clear (CamelIMAP4Namespace **ns) +{ + CamelIMAP4Namespace *node, *next; + + node = *ns; + while (node != NULL) { + next = node->next; + g_free (node->path); + g_free (node); + node = next; + } + + *ns = NULL; +} + +static CamelIMAP4Namespace * +imap4_namespace_copy (const CamelIMAP4Namespace *ns) +{ + CamelIMAP4Namespace *list, *node, *tail; + + list = NULL; + tail = (CamelIMAP4Namespace *) &list; + + while (ns != NULL) { + tail->next = node = g_malloc (sizeof (CamelIMAP4Namespace)); + node->path = g_strdup (ns->path); + node->sep = ns->sep; + ns = ns->next; + tail = node; + } + + tail->next = NULL; + + return list; +} + +CamelIMAP4NamespaceList * +camel_imap4_namespace_list_copy (const CamelIMAP4NamespaceList *nsl) +{ + CamelIMAP4NamespaceList *new; + + new = g_malloc (sizeof (CamelIMAP4NamespaceList)); + new->personal = imap4_namespace_copy (nsl->personal); + new->other = imap4_namespace_copy (nsl->other); + new->shared = imap4_namespace_copy (nsl->shared); + + return new; +} + +void +camel_imap4_namespace_list_free (CamelIMAP4NamespaceList *nsl) +{ + camel_imap4_namespace_clear (&nsl->personal); + camel_imap4_namespace_clear (&nsl->shared); + camel_imap4_namespace_clear (&nsl->other); + g_free (nsl); +} + + char -camel_imap4_get_path_delim (CamelIMAP4Engine *engine, const char *full_name) +camel_imap4_get_path_delim (CamelIMAP4StoreSummary *s, const char *full_name) { CamelIMAP4Namespace *namespace; const char *slash; @@ -93,24 +154,24 @@ camel_imap4_get_path_delim (CamelIMAP4Engine *engine, const char *full_name) top[len] = '\0'; if (!g_ascii_strcasecmp (top, "INBOX")) - top = "INBOX"; + strcpy (top, "INBOX"); retry: - namespace = engine->namespaces.personal; + namespace = s->namespaces->personal; while (namespace != NULL) { if (!strcmp (namespace->path, top)) return namespace->sep; namespace = namespace->next; } - namespace = engine->namespaces.other; + namespace = s->namespaces->other; while (namespace != NULL) { if (!strcmp (namespace->path, top)) return namespace->sep; namespace = namespace->next; } - namespace = engine->namespaces.shared; + namespace = s->namespaces->shared; while (namespace != NULL) { if (!strcmp (namespace->path, top)) return namespace->sep; |