diff options
-rw-r--r-- | camel/ChangeLog | 22 | ||||
-rw-r--r-- | camel/camel-folder.c | 23 | ||||
-rw-r--r-- | camel/camel-folder.h | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 7 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 11 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-store.c | 9 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-folder.c | 2 | ||||
-rw-r--r-- | camel/providers/vee/camel-vee-folder.c | 12 | ||||
-rw-r--r-- | camel/providers/vee/camel-vee-store.c | 2 |
10 files changed, 68 insertions, 38 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 86eec205f8..522b9d887b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,25 @@ +2000-06-14 Jeffrey Stedfast <fejj@helixcode.com> + + * camel-folder.c (init): Updated: a separator is now a char* rather than + a single char because IMAP can have a string for a directory separator. + Also, since IMAP does not begin with a directory separator, there is a new + argument (path_begins_with_sep) which decides if a directory should begin + with a directory separator. + + * providers/imap/camel-imap-store.c (imap_create): Since, on connect, + Camel tries to create INBOX (which already exists on every IMAP provider) + we can return TRUE when the folder name is "INBOX". + + * providers/vee/camel-vee-folder.c (vee_init): Updated. + + * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Updated. + + * providers/mbox/camel-mbox-store.c (get_folder): Updated. + + * providers/mbox/camel-mbox-folder.c (mbox_init): Updated. + + * providers/pop3/camel-pop3-folder.c (camel_pop3_folder_new): Updated. + 2000-06-14 Dan Winship <danw@helixcode.com> * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync): diff --git a/camel/camel-folder.c b/camel/camel-folder.c index a3e50f163d..d988ba6b4d 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -47,7 +47,9 @@ static guint signals[LAST_SIGNAL] = { 0 }; static void init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex); + static void finalize (GtkObject *object); @@ -226,7 +228,8 @@ finalize (GtkObject *object) static void init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex) + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex) { gchar *full_name; const gchar *parent_full_name; @@ -246,6 +249,7 @@ init (CamelFolder *folder, CamelStore *parent_store, folder->open_mode = FOLDER_OPEN_UNKNOWN; folder->open_state = FOLDER_CLOSE; folder->separator = separator; + folder->path_begins_with_sep = path_begins_with_sep; /* if the folder already has a name, free it */ g_free (folder->name); @@ -260,10 +264,13 @@ init (CamelFolder *folder, CamelStore *parent_store, parent_full_name = camel_folder_get_full_name (folder->parent_folder); - full_name = g_strdup_printf ("%s%c%s", parent_full_name, + full_name = g_strdup_printf ("%s%s%s", parent_full_name, folder->separator, name); } else { - full_name = g_strdup_printf ("%c%s", folder->separator, name); + if (path_begins_with_sep) + full_name = g_strdup_printf ("%s%s", folder->separator, name); + else + full_name = g_strdup (name); } folder->name = g_strdup (name); @@ -275,8 +282,7 @@ static void folder_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex) { if (folder->open_state == FOLDER_OPEN) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_STATE, + camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE, "folder is already open"); return; } @@ -426,7 +432,7 @@ get_subfolder (CamelFolder *folder, const gchar *folder_name, current_folder_full_name = camel_folder_get_full_name (folder); - full_name = g_strdup_printf ("%s%c%s", current_folder_full_name, + full_name = g_strdup_printf ("%s%s%s", current_folder_full_name, folder->separator, folder_name); new_folder = camel_store_get_folder (folder->parent_store, full_name, create, ex); @@ -943,6 +949,5 @@ GList *camel_folder_search_by_expression (CamelFolder *folder, g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); g_return_val_if_fail (folder->has_search_capability, NULL); - return CF_CLASS (folder)->search_by_expression (folder, expression, - ex); + return CF_CLASS (folder)->search_by_expression (folder, expression, ex); } diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 7297f00cc6..b35edc3aa9 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -61,11 +61,13 @@ struct _CamelFolder CamelFolderState open_state; gchar *name; gchar *full_name; - gchar separator; + gchar *separator; CamelStore *parent_store; CamelFolder *parent_folder; guint32 permanent_flags; + gboolean path_begins_with_sep; + gboolean can_hold_folders:1; gboolean can_hold_messages:1; gboolean has_summary_capability:1; @@ -81,7 +83,8 @@ typedef struct { /* Virtual methods */ void (*init) (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex); void (*open) (CamelFolder *folder, CamelFolderOpenMode mode, @@ -255,7 +258,7 @@ void camel_folder_free_uids (CamelFolder *folder, /* search api */ gboolean camel_folder_has_search_capability (CamelFolder *folder); -GList * camel_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); +GList * camel_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex); /* summary info. FIXME: rename this slightly? */ const CamelMessageInfo *camel_folder_summary_get_by_uid (CamelFolder *summary, diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 2f6af670a2..37e4b06d9c 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -57,7 +57,8 @@ static CamelFolderClass *parent_class = NULL; static void imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + gchar *separator, gboolean path_begns_with_sep, + CamelException *ex); static void imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); static void imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex); @@ -174,7 +175,7 @@ camel_imap_folder_new (CamelStore *parent, CamelException *ex) { CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL)); - CF_CLASS (folder)->init (folder, parent, NULL, "INBOX", '/', ex); + CF_CLASS (folder)->init (folder, parent, NULL, "INBOX", "/", FALSE, ex); return folder; } @@ -187,12 +188,12 @@ imap_finalize (GtkObject *object) static void imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, - const gchar *name, gchar separator, CamelException *ex) + const gchar *name, gchar *separator, gboolean path_begins_with_sep, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); /* call parent method */ - parent_class->init (folder, parent_store, parent_folder, name, separator, ex); + parent_class->init (folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex); if (camel_exception_get_id (ex)) return; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 96a830e210..65290336c4 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -324,16 +324,19 @@ imap_create (CamelFolder *folder, CamelException *ex) gint status; g_return_val_if_fail (folder != NULL, FALSE); - + if (!(folder->full_name || folder->name)) { camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID, "invalid folder path. Use set_name ?"); return FALSE; } + + if (!strcmp(folder->full_name, "INBOX")) + return TRUE; if (camel_folder_get_subfolder(folder->parent_folder, folder->name, FALSE, ex)) return TRUE; - + /* create the directory for the subfolder */ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL, &result, "CREATE %s", folder->full_name); diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 07accc5a35..5f8e4a90c8 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -57,8 +57,9 @@ static CamelFolderClass *parent_class=NULL; static void mbox_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + CamelFolder *parent_folder, const gchar *name, + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex); static void mbox_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); static void mbox_close (CamelFolder *folder, gboolean expunge, CamelException *ex); @@ -156,15 +157,15 @@ camel_mbox_folder_get_type (void) static void mbox_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, gchar separator, - CamelException *ex) + CamelFolder *parent_folder, const gchar *name, gchar *separator, + gboolean path_begins_with_sep, CamelException *ex) { CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder; const gchar *root_dir_path; /* call parent method */ parent_class->init (folder, parent_store, parent_folder, - name, separator, ex); + name, separator, path_begins_with_sep, ex); if (camel_exception_get_id (ex)) return; diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c index 6a2b826f9b..c2d53f0072 100644 --- a/camel/providers/mbox/camel-mbox-store.c +++ b/camel/providers/mbox/camel-mbox-store.c @@ -57,8 +57,6 @@ camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class) camel_store_class->get_folder_name = get_folder_name; } - - static void camel_mbox_store_init (gpointer object, gpointer klass) { @@ -71,9 +69,6 @@ camel_mbox_store_init (gpointer object, gpointer klass) store->folders = g_hash_table_new (g_str_hash, g_str_equal); } - - - GtkType camel_mbox_store_get_type (void) { @@ -98,7 +93,6 @@ camel_mbox_store_get_type (void) return camel_mbox_store_type; } - const gchar * camel_mbox_store_get_toplevel_dir (CamelMboxStore *store) { @@ -108,7 +102,6 @@ camel_mbox_store_get_toplevel_dir (CamelMboxStore *store) return url->path; } - static CamelFolder * get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex) @@ -161,7 +154,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, new_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE); CF_CLASS (new_folder)->init (new_folder, store, NULL, - folder_name, '/', ex); + folder_name, "/", TRUE, ex); return new_folder; } diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index 8bdcc6a3e2..247635da2a 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -117,7 +117,7 @@ CamelFolder *camel_pop3_folder_new (CamelStore *parent, CamelException *ex) CAMEL_FOLDER (gtk_object_new (camel_pop3_folder_get_type (), NULL)); - CF_CLASS (folder)->init (folder, parent, NULL, "inbox", '/', ex); + CF_CLASS (folder)->init (folder, parent, NULL, "inbox", "/", TRUE, ex); return folder; } diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c index af316a0d6f..8bb7ec6ab1 100644 --- a/camel/providers/vee/camel-vee-folder.c +++ b/camel/providers/vee/camel-vee-folder.c @@ -39,8 +39,9 @@ struct _CamelVeeFolderPrivate { #define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv) static void vee_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + CamelFolder *parent_folder, const gchar *name, + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex); static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex); @@ -203,8 +204,9 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub) static void vee_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex) + CamelFolder *parent_folder, const gchar *name, + gchar *separator, gboolean path_begins_with_sep, + CamelException *ex) { CamelVeeFolder *vf = (CamelVeeFolder *)folder; char *namepart, *searchpart; @@ -218,7 +220,7 @@ static void vee_init (CamelFolder *folder, CamelStore *parent_store, *searchpart++ = 0; } - camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, ex); + camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, TRUE, ex); if (camel_exception_get_id (ex)) return; diff --git a/camel/providers/vee/camel-vee-store.c b/camel/providers/vee/camel-vee-store.c index 177fc0a371..ecc37982e4 100644 --- a/camel/providers/vee/camel-vee-store.c +++ b/camel/providers/vee/camel-vee-store.c @@ -119,7 +119,7 @@ vee_get_folder (CamelStore *store, const char *folder_name, gboolean create, Cam printf("my type is: %s\n", gtk_type_name(((GtkObject *)folder)->klass->type)); - ((CamelFolderClass *)((GtkObject *)folder)->klass)->init (folder, store, NULL, folder_name, '/', ex); + ((CamelFolderClass *)((GtkObject *)folder)->klass)->init (folder, store, NULL, folder_name, "/", TRUE, ex); return folder; } |