aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/mbox/camel-mbox-parser.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>2000-01-05 03:15:42 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-01-05 03:15:42 +0800
commita3b357a50150609a52ffc327c9355fceecab0b8a (patch)
tree62823a1bc540c4b5043ba6501e089a0623967401 /camel/providers/mbox/camel-mbox-parser.c
parent316a4c47ff4abfca30682164793c2cec70da753d (diff)
downloadgsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar.gz
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar.bz2
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar.lz
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar.xz
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.tar.zst
gsoc2013-evolution-a3b357a50150609a52ffc327c9355fceecab0b8a.zip
sync before Boston
svn path=/trunk/; revision=1534
Diffstat (limited to 'camel/providers/mbox/camel-mbox-parser.c')
-rw-r--r--camel/providers/mbox/camel-mbox-parser.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c
new file mode 100644
index 0000000000..a13032a391
--- /dev/null
+++ b/camel/providers/mbox/camel-mbox-parser.c
@@ -0,0 +1,96 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-mbox-parser.c : mbox folder parser */
+
+/*
+ *
+ * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+
+#include <config.h>
+#include "camel-mbox-parser.h"
+#include "camel-log.h"
+#include "camel-exception.h"
+
+#include <sys/types.h>
+#include <unistd.h>
+
+
+
+
+GList *
+camel_mbox_find_message_positions (int fd, gint first_position, CamelException *ex)
+{
+#define MBOX_PARSER_BUF_SIZE 1000
+
+ off_t seek_res;
+ GList *message_positions = NULL;
+ char buffer[MBOX_PARSER_BUF_SIZE];
+ ssize_t buf_nb_read;
+
+
+ /* set the initial position */
+ seek_res = lseek (fd, first_position, SEEK_SET);
+ if (seek_res == (off_t)-1) goto io_error;
+
+ /* populate the buffer and initialize the search proc */
+ buf_nb_read = read (fd, buffer, MBOX_PARSER_BUF_SIZE);
+
+ while (buf_nb_read>0) {
+ current_pos = 0;
+
+
+
+
+ /* read the next chunk of data in the folder file */
+ buf_nb_read = read (fd, buffer, MBOX_PARSER_BUF_SIZE);
+ }
+
+
+
+
+
+
+ /* io exception handling */
+ io_error :
+
+ switch errno {
+ case EACCES :
+
+ camel_exception_setv (ex,
+ CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
+ "Unable to list the directory. Full Error text is : %s ",
+ strerror (errno));
+ break;
+
+ case ENOENT :
+ case ENOTDIR :
+ camel_exception_setv (ex,
+ CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
+ "Invalid mbox folder path. Full Error text is : %s ",
+ strerror (errno));
+ break;
+
+ default :
+ camel_exception_set (ex,
+ CAMEL_EXCEPTION_SYSTEM,
+ "Unable to delete the mbox folder.");
+
+ }
+
+}