aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers/mail-importer.h
blob: c01c3ab51f96b2b0a2a3bedd4878d1561023bd65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>  
 *
 *
 * Authors:
 *      Iain Holmes <iain@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#ifndef __MAIL_IMPORTER_H__
#define __MAIL_IMPORTER_H__

typedef struct _MailImporter MailImporter;
struct _MailImporter {
    struct _CamelFolder *folder;
    struct _CamelStreamMem *mstream;

    gboolean frozen; /* Is folder frozen? */
};

struct _MailComponent;

void mail_importer_init (struct _MailComponent *mc);
void mail_importer_uninit (void);

void mail_importer_add_line (MailImporter *importer,
                 const char *str,
                 gboolean finished);
void mail_importer_create_folder (const char *parent_path,
                  const char *name,
                  const char *description);

/* creates a folder at folderpath on the local storage */
char *mail_importer_make_local_folder(const char *folderpath);

struct _BonoboObject;
struct _BonoboGenericFactory;
struct _CamelOperation;
struct _CamelException;

struct _EImportImporter *mbox_importer_peek(void);

struct _EImportImporter *elm_importer_peek(void);
struct _EImportImporter *pine_importer_peek(void);

#define ELM_INTELLIGENT_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Elm_Intelligent_Importer:" BASE_VERSION
#define PINE_INTELLIGENT_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Pine_Intelligent_Importer:" BASE_VERSION
#define NETSCAPE_INTELLIGENT_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Netscape_Intelligent_Importer:" BASE_VERSION

#define MBOX_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Mbox_Importer:" BASE_VERSION
#define OUTLOOK_IMPORTER_IID "OAFIID:GNOME_Evolution_Mail_Outlook_Importer:" BASE_VERSION

struct _BonoboObject *elm_intelligent_importer_new(void);
struct _BonoboObject *pine_intelligent_importer_new(void);
struct _BonoboObject *netscape_intelligent_importer_new(void);

struct _BonoboObject *mbox_importer_new(void);
struct _BonoboObject *outlook_importer_new(void);

struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *factory, const char *iid, void *data);


/* Defines copied from nsMsgMessageFlags.h in Mozilla source. */
/* Evolution only cares about these headers I think */
#define MSG_FLAG_READ 0x0001
#define MSG_FLAG_REPLIED 0x0002
#define MSG_FLAG_MARKED 0x0004
#define MSG_FLAG_EXPUNGED 0x0008

int mail_importer_import_mbox(const char *path, const char *folderuri, struct _CamelOperation *cancel, void (*done)(void *data, struct _CamelException *), void *data);
void mail_importer_import_mbox_sync(const char *path, const char *folderuri, struct _CamelOperation *cancel);

struct _MailImporterSpecial {
    const gchar *orig, *new;
};
typedef struct _MailImporterSpecial MailImporterSpecial;

/* mozilla format subdirs */
#define MAIL_IMPORTER_MOZFMT (1<<0)

/* api in flux */
void mail_importer_import_folders_sync(const char *filepath, MailImporterSpecial special_folders[], int flags, struct _CamelOperation *cancel);

#endif