From d182d3473e17421d7eafb2b4817dace196cec757 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 14 Nov 2003 18:11:11 +0000 Subject: Handle "" as a request for a full dirscan as well (not just NULL). Makes 2003-11-14 Jeffrey Stedfast * providers/local/camel-mbox-store.c (get_folder_info): Handle "" as a request for a full dirscan as well (not just NULL). Makes it consistant with other stores. (scan_dir): Set the fi->flags appropriately. * providers/local/camel-mbox-folder.c (camel_mbox_folder_get_full_path): Removed temporary hack. svn path=/trunk/; revision=23356 --- camel/ChangeLog | 10 ++++++++++ camel/providers/local/camel-mbox-folder.c | 25 ++++++++++--------------- camel/providers/local/camel-mbox-store.c | 18 ++++++++++++++---- 3 files changed, 34 insertions(+), 19 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index c38ad2b927..beddc205cd 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2003-11-14 Jeffrey Stedfast + + * providers/local/camel-mbox-store.c (get_folder_info): Handle "" + as a request for a full dirscan as well (not just NULL). Makes it + consistant with other stores. + (scan_dir): Set the fi->flags appropriately. + + * providers/local/camel-mbox-folder.c + (camel_mbox_folder_get_full_path): Removed temporary hack. + 2003-11-14 Not Zed * camel-mime-parser.c (SCAN_BUF): oops, put the mempool stuff diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index b2a74ef2b8..9c3a7036f2 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -162,23 +162,18 @@ camel_mbox_folder_get_full_path (const char *toplevel_dir, const char *full_name path = g_malloc (strlen (toplevel_dir) + (inptr - full_name) + (4 * subdirs) + 1); p = g_stpcpy (path, toplevel_dir); - if (strcmp (toplevel_dir, "/") == 0) { - /* FIXME: temporary hack until we merge new-ui-branch into trunk */ - p = g_stpcpy (p, full_name); - } else { - inptr = full_name; - while (*inptr != '\0') { - while (*inptr != '/' && *inptr != '\0') - *p++ = *inptr++; + inptr = full_name; + while (*inptr != '\0') { + while (*inptr != '/' && *inptr != '\0') + *p++ = *inptr++; + + if (*inptr == '/') { + p = g_stpcpy (p, ".sbd/"); + inptr++; - if (*inptr == '/') { - p = g_stpcpy (p, ".sbd/"); + /* strip extranaeous '/'s */ + while (*inptr == '/') inptr++; - - /* strip extranaeous '/'s */ - while (*inptr == '/') - inptr++; - } } } diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index b0de165656..d07176cc0d 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -580,8 +580,11 @@ scan_dir (CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const g_free (short_name); g_free (full_name); - if (!S_ISDIR (st.st_mode)) { + if (S_ISDIR (st.st_mode)) { + fi->flags = (fi->flags & ~CAMEL_FOLDER_NOINFERIORS) | CAMEL_FOLDER_CHILDREN; + } else { fi->unread_message_count = unread; + fi->flags &= ~CAMEL_FOLDER_NOSELECT; if ((ext = strchr (fi->url, ';')) && !strncmp (ext, ";noselect=yes", 13)) memmove (ext, ext + 13, strlen (ext + 13) + 1); } @@ -597,6 +600,11 @@ scan_dir (CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const fi->path = g_strdup_printf ("/%s", full_name); fi->unread_message_count = unread; + if (S_ISDIR (st.st_mode)) + fi->flags = CAMEL_FOLDER_NOSELECT; + else + fi->flags = CAMEL_FOLDER_NOINFERIORS; + if (tail == NULL) folders = fi; else @@ -617,7 +625,8 @@ scan_dir (CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const g_hash_table_insert (visited, inew, inew); - fi->child = scan_dir (store, visited, fi, path, fi->full_name, flags, ex); + if ((fi->child = scan_dir (store, visited, fi, path, fi->full_name, flags, ex))) + fi->flags |= CAMEL_FOLDER_CHILDREN; } } @@ -643,9 +652,10 @@ get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelExcepti struct stat st; int unread = -1; - path = mbox_folder_name_to_path (store, top ? top : ""); + top = top ? top : ""; + path = mbox_folder_name_to_path (store, top); - if (top == NULL) { + if (*top == '\0') { /* requesting root dir scan */ if (stat (path, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (path); -- cgit v1.2.3