From acc63c446a29a4096f14119c2b066aa687b6836c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 22 Jul 2000 01:38:41 +0000 Subject: Updated to not strip out subfolders that are marked as \NoSelect because 2000-07-21 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_get_subfolder_names): Updated to not strip out subfolders that are marked as \NoSelect because this will be correctly handled in store->get_folder from now on. * providers/imap/camel-imap-store.c (folder_is_selectable): New convenience function for use in get_folder(). (parse_list_response): Now takes a char **flags argument which is needed by folder_is_selectable(). (imap_connect): Updated to reflect changes to parse_list_response(). svn path=/trunk/; revision=4274 --- camel/ChangeLog | 12 +++++++ camel/providers/imap/camel-imap-folder.c | 2 +- camel/providers/imap/camel-imap-store.c | 54 ++++++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 6deb5a1d91..8c3388e8e9 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,17 @@ 2000-07-21 Jeffrey Stedfast + * providers/imap/camel-imap-folder.c (imap_get_subfolder_names): Updated to + not strip out subfolders that are marked as \NoSelect because this will be + correctly handled in store->get_folder from now on. + + * providers/imap/camel-imap-store.c (folder_is_selectable): New convenience + function for use in get_folder(). + (parse_list_response): Now takes a char **flags argument which is needed by + folder_is_selectable(). + (imap_connect): Updated to reflect changes to parse_list_response(). + +2000-07-21 Jeffrey Stedfast + * providers/imap/camel-imap-stream.c (stream_read): Updated with some of the same fixes I've made to camel-imap-folder.c like recalculating message part lengths. diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 11e52124b1..42af577eb5 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -739,7 +739,7 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex) ret = imap_parse_subfolder_line (buf, namespace, &flags, &sep, &folder); g_free (buf); - if (!ret || (flags && strstr (flags, "NoSelect"))) { + if (!ret /*|| (flags && strstr (flags, "NoSelect"))*/) { g_free (flags); g_free (sep); g_free (folder); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 0844900887..64db875b6d 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -226,10 +226,11 @@ get_name (CamelService *service, gboolean brief) } static gboolean -parse_list_response (gchar *buf, gchar **sep) +parse_list_response (gchar *buf, gchar **flags, gchar **sep) { gchar *ptr, *eptr; + *flags = NULL; *sep = NULL; if (strncasecmp (buf, "* LIST", 6)) @@ -243,6 +244,7 @@ parse_list_response (gchar *buf, gchar **sep) eptr = strstr (ptr, ")"); if (!eptr) return FALSE; + *flags = g_strndup (ptr, (gint)(eptr - ptr)); ptr = strstr (eptr, "\""); if (!ptr) @@ -398,9 +400,9 @@ imap_connect (CamelService *service, CamelException *ex) "Unknown error"); } else { if (!strncasecmp (result, "* LIST", 6)) { - char *sep; + char *flags, *sep; - if (parse_list_response (result, &sep)) { + if (parse_list_response (result, &flags, &sep)) { if (*sep) { g_free (store->dir_sep); store->dir_sep = g_strdup (sep); @@ -533,6 +535,37 @@ imap_create (CamelFolder *folder, CamelException *ex) return TRUE; } +static gboolean +folder_is_selectable (CamelStore *store, const char *folder_path) +{ + char *result, *flags, *sep; + int status; + + if (!strcmp (folder_path, "INBOX")) + return TRUE; + + status = camel_imap_command_extended (CAMEL_IMAP_STORE (store), NULL, + &result, "LIST \"\" %s", folder_path); + if (status != CAMEL_IMAP_OK) { + g_free (result); + return FALSE; + } + + if (parse_list_response (result, &flags, &sep)) { + gboolean retval; + + retval = !e_strstrcase (flags, "NoSelect"); + g_free (flags); + g_free (sep); + + return retval; + } + g_free (flags); + g_free (sep); + + return FALSE; +} + static CamelFolder * get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex) { @@ -548,8 +581,12 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx folder_path = g_strdup ("INBOX"); else folder_path = g_strdup (folder_name); - + new_folder = camel_imap_folder_new (store, folder_path, ex); + + if (!folder_is_selectable (store, folder_path)) { + return new_folder; + } if (create && !imap_create (new_folder, ex)) { return NULL; @@ -800,10 +837,15 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** g_ptr_array_add (data, respbuf); len += strlen (respbuf) + 1; + /* If recent was somehow set and this response doesn't begin with a '*' + then recent must have been misdetected */ + if (recent && *respbuf != '*') + recent = 0; + if (*respbuf == '*' && (ptr = strstr (respbuf, "RECENT"))) { char *rcnt, *ercnt; - - d(fprintf (stderr, "*** We found a 'RECENT' flag: %s", respbuf)); + + d(fprintf (stderr, "*** We may have found a 'RECENT' flag: %s", respbuf)); /* Make sure it's in the form: "* %d RECENT" */ rcnt = respbuf + 2; if (*rcnt > '0' || *rcnt < '9') { -- cgit name='qt'>
Commit message (Expand)AuthorAgeFilesLines
* Remove expired ports:Rene Ladan2021-04-087-1063/+0
* Remove # $FreeBSD$ from Makefiles.Mathieu Arnold2021-04-061-1/+0
* Extend expiration of ports broken with -fno-commonNiclas Zeising2020-08-301-3/+3
* cat/varkon: fix build on current and deprecateTobias C. Berner2020-08-292-1/+18
* Add USES=xorg USES=gl, ports categories cNiclas Zeising2019-11-051-1/+1
* Revision bump of all ports with USE_GL after consolidation of mesa-libsMatthew Rezny2017-05-231-1/+1
* Remove libtiff.so.4 compatibility links that were added in r374303 toTijl Coosemans2016-12-091-1/+1
* - Fix trailing whitespace in pkg-descrs, categories [a-f]*Dmitry Marakasov2016-05-191-7/+7
* Remove ${PORTSDIR}/ from dependencies, Mk and categories a, b, and c.Mathieu Arnold2016-04-011-2/+2
* - Switch to options helpersDmitry Marakasov2015-12-251-0/+2
* Cleanup plistBaptiste Daroussin2014-10-201-21/+0
* Update the default version of GCC in the Ports Collection from GCC 4.7.4Gerald Pfeifer2014-09-111-0/+1
* cad/varkon:Max Brazhnikov2014-02-083-17/+16
* Convert cad to MDOCS and MEXAMPLESAdam Weinberger2014-01-031-1/+4
* In preparation for making libtool generate libraries with a sane name, fix allBaptiste Daroussin2013-12-111-1/+1
* cad/varkon: Hardcode PLATFORM to "FreeBSD"John Marino2013-10-071-2/+2
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...Baptiste Daroussin2013-09-201-0/+1
* Style: tab -> space.Eitan Adler2013-03-291-1/+1
* - Update to 1.19E.Marcelo Araujo2013-01-216-396/+399
* Make @dirrms conditional for %%DOCSDIR%% on NOPORTDOCSChris Rees2011-11-141-3/+3
* - Get Rid MD5 supportMartin Wilke2011-03-201-1/+0
* - update to jpeg-8Dirk Meyer2010-02-051-1/+1
* - Mark MAKE_JOBS_UNSAFEPav Lucistnik2009-11-231-0/+1
* - Switch SourceForge ports to the new File Release System: categories startin...Dmitry Marakasov2009-08-221-2/+1
* - bump all port that indirectly depends on libjpeg and have not yet been bump...Dirk Meyer2009-07-311-0/+1