diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-07-17 11:46:26 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-17 11:46:26 +0800 |
commit | 237f2dc92b27da3e11c2ea4fcea7b45f7196f583 (patch) | |
tree | 950dd4cd042a6fa26179923de3705560d6e9fadb /mail | |
parent | 93a122c7e3a2e4507527b745d9864275c305736d (diff) | |
download | gsoc2013-evolution-237f2dc92b27da3e11c2ea4fcea7b45f7196f583.tar.gz gsoc2013-evolution-237f2dc92b27da3e11c2ea4fcea7b45f7196f583.tar.zst gsoc2013-evolution-237f2dc92b27da3e11c2ea4fcea7b45f7196f583.zip |
Initial code to support IMAP folders that don't use "/" as a directory
2000-07-16 Jeffrey Stedfast <fejj@helixcode.com>
* folder-browser.c, component-factory.c: Initial code to support
IMAP folders that don't use "/" as a directory separator.
svn path=/trunk/; revision=4185
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/component-factory.c | 51 | ||||
-rw-r--r-- | mail/folder-browser.c | 11 |
3 files changed, 46 insertions, 21 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 859efa5836..674ac9c5b1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-07-16 Jeffrey Stedfast <fejj@helixcode.com> + + * folder-browser.c, component-factory.c: Initial code to support + IMAP folders that don't use "/" as a directory separator. + 2000-07-15 Ettore Perazzoli <ettore@helixcode.com> * mail-ops.c (set_x_mailer_header): New helper function to set the diff --git a/mail/component-factory.c b/mail/component-factory.c index 486955da2e..17d3db0a49 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -1,6 +1,8 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* component-factory.c * + * Authors: Ettore Perazzoli <ettore@helixcode.com> + * * Copyright (C) 2000 Helix Code, Inc. * * This program is free software; you can redistribute it and/or @@ -17,8 +19,6 @@ * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli */ #ifdef HAVE_CONFIG_H @@ -317,25 +317,25 @@ create_imap_storage (EvolutionShellComponent *shell_component) return; } - ii = g_new( struct create_info_s, 1 ); + ii = g_new (struct create_info_s, 1); ii->storage = storage; - ii->source = g_strdup( source ); + ii->source = g_strdup (source); #ifdef USE_BROKEN_THREADS - mail_operation_try( "Create IMAP Storage", real_create_imap_storage, g_free, ii ); + mail_operation_try ("Create IMAP Storage", real_create_imap_storage, g_free, ii); #else - real_create_imap_storage( ii ); - g_free( ii ); + real_create_imap_storage (ii); + g_free (ii); #endif /* Note the g_free as our cleanup function deleting the ii struct when we're done */ } static void -real_create_imap_storage( gpointer user_data ) +real_create_imap_storage (gpointer user_data) { CamelException *ex; EvolutionStorage *storage; - char *p, *source; + char *p, *source, *dir_sep; CamelStore *store; CamelFolder *folder; GPtrArray *lsub; @@ -347,8 +347,8 @@ real_create_imap_storage( gpointer user_data ) source = ii->source; #ifdef USE_BROKEN_THREADS - mail_op_hide_progressbar(); - mail_op_set_message( "Connecting to IMAP service..." ); + mail_op_hide_progressbar (); + mail_op_set_message ("Connecting to IMAP service..."); #endif ex = camel_exception_new (); @@ -363,7 +363,7 @@ real_create_imap_storage( gpointer user_data ) } #ifdef USE_BROKEN_THREADS - mail_op_set_message( "Connected. Examining folders..." ); + mail_op_set_message ("Connected. Examining folders..."); #endif folder = camel_store_get_root_folder (store, ex); @@ -377,25 +377,38 @@ real_create_imap_storage( gpointer user_data ) p = g_strdup_printf ("%s/INBOX", source); evolution_storage_new_folder (storage, "/INBOX", "mail", p, "description"); + /*dir_sep = CAMEL_IMAP_STORE (store)->dir_sep;*/ + max = lsub->len; for (i = 0; i < max; i++) { - char *path, *buf; + char *path, *buf, *dirname; - path = g_strdup_printf ("/%s", (char *)lsub->pdata[i]); - buf = g_strdup_printf ("%s/%s", source, path); +#if 0 + if (strcmp (dir_sep, "/")) { + dirname = e_strreplace ((char *)lsub->pdata[i], dir_sep, "/"); + } else { + dirname = g_strdup ((char *)lsub->pdata[i]); + } +#endif + dirname = g_strdup ((char *)lsub->pdata[i]); + + path = g_strdup_printf ("/%s", dirname); + g_free (dirname); + buf = g_strdup_printf ("%s/%s", source, path + 1); + printf ("buf = %s\n", buf); #ifdef USE_BROKEN_THREADS - mail_op_set_message( "Adding %s", path ); + mail_op_set_message ("Adding %s", path); #endif evolution_storage_new_folder (storage, path, "mail", buf, "description"); } cleanup: - g_free( ii->source ); + g_free (ii->source); #ifdef USE_BROKEN_THREADS - if( camel_exception_is_set( ex ) ) - mail_op_error( "%s", camel_exception_get_description( ex ) ); + if (camel_exception_is_set (ex)) + mail_op_error ("%s", camel_exception_get_description (ex)); #endif camel_exception_free (ex); } diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 925feb4303..9268c65df8 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -61,7 +61,7 @@ CamelFolder * mail_uri_to_folder (const char *name) { char *store_name, *msg; - CamelStore *store; + CamelStore *store = NULL; CamelFolder *folder = NULL; CamelException *ex; @@ -91,6 +91,7 @@ mail_uri_to_folder (const char *name) source_name = g_strdup_printf ("file://%s/local/Inbox", evolution_dir); source_folder = mail_uri_to_folder (source_name); g_free (source_name); +#warning "Not Good (tm). It might be better to have some sort of high level Camel interface for this" if (source_folder) camel_vee_folder_add_folder (folder, source_folder); } @@ -105,11 +106,15 @@ mail_uri_to_folder (const char *name) for (ptr = service + 7; *ptr && *ptr != '/'; ptr++); ptr++; *ptr = '\0'; + store = camel_session_get_store (session, service, ex); g_free (service); + if (store) { CamelURL *url = CAMEL_SERVICE (store)->url; - char *folder_name; + char *tree_name, *folder_name, *dir_sep; + + /*dir_sep = CAMEL_IMAP_STORE (store)->dir_sep;*/ for (ptr = (char *)(name + 7); *ptr && *ptr != '/'; ptr++); if (*ptr == '/') { @@ -124,6 +129,8 @@ mail_uri_to_folder (const char *name) /*for ( ; *ptr && *ptr == '/'; ptr++);*/ folder_name = g_strdup (ptr); + /*tree_name = g_strdup (ptr);*/ + /*folder_name = e_strreplace (tree_name, "/", dir_sep);*/ folder = camel_store_get_folder (store, folder_name, TRUE, ex); g_free (folder_name); |