aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-28 07:11:11 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-28 07:11:11 +0800
commit2c5a9bc2278c0922807316a0a63d84cd0333f545 (patch)
treee5a46c5e39fb278a3cb2b49eb00fc0f55e8ad8ce /camel/providers/imap/camel-imap-folder.c
parent1bf9e439824ee6a2aa721aa05859200da89cbc9b (diff)
downloadgsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar.gz
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar.bz2
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar.lz
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar.xz
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.tar.zst
gsoc2013-evolution-2c5a9bc2278c0922807316a0a63d84cd0333f545.zip
Added camel-imap-utils.[c,h]
2000-07-27 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/Makefile.am: Added camel-imap-utils.[c,h] * providers/imap/camel-imap-utils.[c,h]: Utilities for parsing server responses for use in both camel-imap-store.c and camel-imap-folder.c * providers/imap/camel-imap-folder.c (imap_get_summary_internal): Free all the pointers in the headers array. (imap_get_subfolder_names_internal): Updated to use imap_parse_list_response (imap_parse_subfolder_list): Removed in favor of imap_parse_list_response * providers/imap/camel-imap-store.c (camel_imap_command_extended): Free all the pointers in the data array. (imap_connect): Updated to use imap_parse_list_response and fixed a leak (folder_is_selectable): Updated. svn path=/trunk/; revision=4400
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c64
1 files changed, 9 insertions, 55 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 5f15ee58b4..343d7e9f24 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -39,6 +39,7 @@
#include "camel-imap-folder.h"
#include "camel-imap-store.h"
#include "camel-imap-stream.h"
+#include "camel-imap-utils.h"
#include "string-utils.h"
#include "camel-stream.h"
#include "camel-stream-fs.h"
@@ -77,7 +78,6 @@ static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message,
static void imap_copy_message_to (CamelFolder *source, const char *uid, CamelFolder *destination, CamelException *ex);
static void imap_move_message_to (CamelFolder *source, const char *uid, CamelFolder *destination, CamelException *ex);
-static gboolean imap_parse_subfolder_line (gchar *buf, gchar *namespace, gchar **flags, gchar **sep, gchar **folder);
static GPtrArray *imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex);
static GPtrArray *imap_get_subfolder_names (CamelFolder *folder);
@@ -642,55 +642,6 @@ imap_get_uids (CamelFolder *folder)
return array;
}
-static gboolean
-imap_parse_subfolder_line (gchar *buf, gchar *namespace, gchar **flags, gchar **sep, gchar **folder)
-{
- gchar *ptr, *eptr, *f;
-
- *flags = NULL;
- *sep = NULL;
- *folder = NULL;
-
- if (g_strncasecmp (buf, "* LIST", 6))
- return FALSE;
-
- ptr = strstr (buf + 6, "(");
- if (!ptr)
- return FALSE;
-
- ptr++;
- eptr = strstr (ptr, ")");
- if (!eptr)
- return FALSE;
-
- *flags = g_strndup (ptr, (gint)(eptr - ptr));
-
- ptr = strstr (eptr, "\"");
- if (!ptr)
- return FALSE;
-
- ptr++;
- eptr = strstr (ptr, "\"");
- if (!eptr)
- return FALSE;
-
- *sep = g_strndup (ptr, (gint)(eptr - ptr));
-
- ptr = eptr + 1;
- *folder = g_strdup (ptr);
- g_strstrip (*folder);
-
- /* chop out the folder prefix */
- if (*namespace && !strncmp (*folder, namespace, strlen (namespace))) {
- f = *folder + strlen (namespace) + strlen (*sep);
- memmove (*folder, f, strlen (f) + 1);
- }
-
- string_unquote (*folder); /* unquote the mailbox if it's quoted */
-
- return TRUE;
-}
-
static GPtrArray *
imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
{
@@ -741,16 +692,13 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
while (ptr && *ptr == '*') {
gchar *flags, *sep, *folder, *buf, *end;
- gboolean ret;
for (end = ptr; *end && *end != '\n'; end++);
buf = g_strndup (ptr, (gint)(end - ptr));
ptr = end;
- ret = imap_parse_subfolder_line (buf, namespace, &flags, &sep, &folder);
- g_free (buf);
-
- if (!ret /*|| (flags && strstr (flags, "NoSelect"))*/) {
+ if (!imap_parse_list_response (buf, namespace, &flags, &sep, &folder)) {
+ g_free (buf);
g_free (flags);
g_free (sep);
g_free (folder);
@@ -760,6 +708,8 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
continue;
}
+
+ g_free (buf);
g_free (flags);
d(fprintf (stderr, "adding folder: %s\n", folder));
@@ -1181,6 +1131,8 @@ imap_get_summary_internal (CamelFolder *folder, CamelException *ex)
g_hash_table_insert (hash, info->uid, info);
}
+ for (i = 0; i < headers->len; i++)
+ g_free (headers->pdata[i]);
g_ptr_array_free (headers, TRUE);
/* clean up any previous summary data */
@@ -1346,6 +1298,8 @@ imap_get_message_info (CamelFolder *folder, const char *uid)
static GPtrArray *
imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex)
{
+ d(fprintf (stderr, "search expression: %s\n", expression));
+
return g_ptr_array_new ();
#if 0
/* NOTE: This is experimental code... */