aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 22:29:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-27 22:29:19 +0800
commit948235c3d1076dbe6ed2e57a24c16a083bbd9f01 (patch)
tree4133b1adfd94d8f889ca7ad4ad851346518f4171 /mail/importers
parentcc3a98fc1ad5bb87aa7335f3de404ee7feee1541 (diff)
downloadgsoc2013-evolution-948235c3d1076dbe6ed2e57a24c16a083bbd9f01.tar.gz
gsoc2013-evolution-948235c3d1076dbe6ed2e57a24c16a083bbd9f01.tar.zst
gsoc2013-evolution-948235c3d1076dbe6ed2e57a24c16a083bbd9f01.zip
Prefer GLib basic types over C types.
Diffstat (limited to 'mail/importers')
-rw-r--r--mail/importers/elm-importer.c38
-rw-r--r--mail/importers/evolution-mbox-importer.c26
-rw-r--r--mail/importers/mail-importer.c56
-rw-r--r--mail/importers/mail-importer.h18
-rw-r--r--mail/importers/pine-importer.c28
5 files changed, 83 insertions, 83 deletions
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index 39bfd7bc3f..6e65418441 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -55,16 +55,16 @@ struct _elm_import_msg {
EImportTargetHome *target;
GMutex *status_lock;
- char *status_what;
- int status_pc;
- int status_timeout_id;
+ gchar *status_what;
+ gint status_pc;
+ gint status_timeout_id;
CamelOperation *status;
};
static GHashTable *
-parse_elm_rc(const char *elmrc)
+parse_elm_rc(const gchar *elmrc)
{
- char line[4096];
+ gchar line[4096];
FILE *handle;
GHashTable *prefs;
@@ -81,8 +81,8 @@ parse_elm_rc(const char *elmrc)
return prefs;
while (fgets (line, 4096, handle) != NULL) {
- char *linestart, *end;
- char *key, *value;
+ gchar *linestart, *end;
+ gchar *key, *value;
if (*line == '#' &&
(line[1] != '#' && line[2] != '#')) {
continue;
@@ -122,11 +122,11 @@ parse_elm_rc(const char *elmrc)
return prefs;
}
-static char *
-elm_get_rc(EImport *ei, const char *name)
+static gchar *
+elm_get_rc(EImport *ei, const gchar *name)
{
GHashTable *prefs;
- char *elmrc;
+ gchar *elmrc;
prefs = g_object_get_data((GObject *)ei, "elm-rc");
if (prefs == NULL) {
@@ -146,8 +146,8 @@ static gboolean
elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
{
EImportTargetHome *s;
- const char *maildir;
- char *elmdir;
+ const gchar *maildir;
+ gchar *elmdir;
gboolean mailexists, exists;
if (target->type != E_IMPORT_TARGET_HOME)
@@ -190,8 +190,8 @@ static MailImporterSpecial elm_special_folders[] = {
static void
elm_import_exec (struct _elm_import_msg *m)
{
- const char *maildir;
- char *elmdir;
+ const gchar *maildir;
+ gchar *elmdir;
maildir = elm_get_rc(m->import, "maildir");
if (maildir == NULL)
@@ -237,7 +237,7 @@ elm_import_free(struct _elm_import_msg *m)
}
static void
-elm_status(CamelOperation *op, const char *what, int pc, void *data)
+elm_status(CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
struct _elm_import_msg *importer = data;
@@ -254,11 +254,11 @@ elm_status(CamelOperation *op, const char *what, int pc, void *data)
}
static gboolean
-elm_status_timeout(void *data)
+elm_status_timeout(gpointer data)
{
struct _elm_import_msg *importer = data;
- int pc;
- char *what;
+ gint pc;
+ gchar *what;
if (importer->status_what) {
g_mutex_lock(importer->status_lock);
@@ -285,7 +285,7 @@ static int
mail_importer_elm_import(EImport *ei, EImportTarget *target)
{
struct _elm_import_msg *m;
- int id;
+ gint id;
m = mail_msg_new(&elm_import_info);
g_datalist_set_data(&target->data, "elm-msg", m);
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index ff6c7dd13b..882ce64b25 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -53,12 +53,12 @@ typedef struct {
EImportTarget *target;
GMutex *status_lock;
- char *status_what;
- int status_pc;
- int status_timeout_id;
+ gchar *status_what;
+ gint status_pc;
+ gint status_timeout_id;
CamelOperation *cancel; /* cancel/status port */
- char *uri;
+ gchar *uri;
} MboxImporter;
static void
@@ -100,11 +100,11 @@ mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
static gboolean
mbox_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
{
- char signature[6];
+ gchar signature[6];
gboolean ret = FALSE;
- int fd, n;
+ gint fd, n;
EImportTargetURI *s;
- char *filename;
+ gchar *filename;
if (target->type != E_IMPORT_TARGET_URI)
return FALSE;
@@ -129,7 +129,7 @@ mbox_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
}
static void
-mbox_status(CamelOperation *op, const char *what, int pc, void *data)
+mbox_status(CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
MboxImporter *importer = data;
@@ -146,11 +146,11 @@ mbox_status(CamelOperation *op, const char *what, int pc, void *data)
}
static gboolean
-mbox_status_timeout(void *data)
+mbox_status_timeout(gpointer data)
{
MboxImporter *importer = data;
- int pc;
- char *what;
+ gint pc;
+ gchar *what;
if (importer->status_what) {
g_mutex_lock(importer->status_lock);
@@ -166,7 +166,7 @@ mbox_status_timeout(void *data)
}
static void
-mbox_import_done(void *data, CamelException *ex)
+mbox_import_done(gpointer data, CamelException *ex)
{
MboxImporter *importer = data;
@@ -183,7 +183,7 @@ static void
mbox_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
MboxImporter *importer;
- char *filename;
+ gchar *filename;
/* TODO: do we validate target? */
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index e56ca01dcd..5540a08abf 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -61,8 +61,8 @@
* Return value: The physical uri of the folder, or NULL if the folder did
* not exist and could not be created.
**/
-char *
-mail_importer_make_local_folder(const char *folderpath)
+gchar *
+mail_importer_make_local_folder(const gchar *folderpath)
{
return g_strdup_printf("mbox:/home/notzed/.evolution/mail/local/%s", folderpath);
}
@@ -78,7 +78,7 @@ mail_importer_make_local_folder(const char *folderpath)
*/
void
mail_importer_add_line (MailImporter *importer,
- const char *str,
+ const gchar *str,
gboolean finished)
{
CamelMimeMessage *msg;
@@ -112,7 +112,7 @@ mail_importer_add_line (MailImporter *importer,
camel_message_info_free(info);
}
-struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *factory, const char *iid, void *data)
+struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *factory, const gchar *iid, gpointer data)
{
#if 0
if (strcmp(iid, ELM_INTELLIGENT_IMPORTER_IID) == 0)
@@ -132,12 +132,12 @@ struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *fac
struct _import_mbox_msg {
MailMsg base;
- char *path;
- char *uri;
+ gchar *path;
+ gchar *uri;
CamelOperation *cancel;
- void (*done)(void *data, CamelException *ex);
- void *done_data;
+ void (*done)(gpointer data, CamelException *ex);
+ gpointer done_data;
};
static gchar *
@@ -147,7 +147,7 @@ import_mbox_desc (struct _import_mbox_msg *m)
}
static struct {
- char tag;
+ gchar tag;
guint32 mozflag;
guint32 flag;
} status_flags[] = {
@@ -158,11 +158,11 @@ static struct {
};
static guint32
-decode_status(const char *status)
+decode_status(const gchar *status)
{
- const char *p;
+ const gchar *p;
guint32 flags = 0;
- int i;
+ gint i;
p = status;
while ((*p++)) {
@@ -175,11 +175,11 @@ decode_status(const char *status)
}
static guint32
-decode_mozilla_status(const char *tmp)
+decode_mozilla_status(const gchar *tmp)
{
unsigned long status = strtoul(tmp, NULL, 16);
guint32 flags = 0;
- int i;
+ gint i;
for (i=0;i<sizeof(status_flags)/sizeof(status_flags[0]);i++)
if (status_flags[i].mozflag & status)
@@ -193,7 +193,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
CamelFolder *folder;
CamelMimeParser *mp = NULL;
struct stat st;
- int fd;
+ gint fd;
CamelMessageInfo *info;
if (g_stat(m->path, &st) == -1) {
@@ -232,8 +232,8 @@ import_mbox_exec (struct _import_mbox_msg *m)
camel_folder_freeze(folder);
while (camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) {
CamelMimeMessage *msg;
- const char *tmp;
- int pc = 0;
+ const gchar *tmp;
+ gint pc = 0;
guint32 flags = 0;
if (st.st_size > 0)
@@ -307,11 +307,11 @@ static MailMsgInfo import_mbox_info = {
(MailMsgFreeFunc) import_mbox_free
};
-int
-mail_importer_import_mbox(const char *path, const char *folderuri, CamelOperation *cancel, void (*done)(void *data, CamelException *), void *data)
+gint
+mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, CamelException *), gpointer data)
{
struct _import_mbox_msg *m;
- int id;
+ gint id;
m = mail_msg_new(&import_mbox_info);
m->path = g_strdup(path);
@@ -330,7 +330,7 @@ mail_importer_import_mbox(const char *path, const char *folderuri, CamelOperatio
}
void
-mail_importer_import_mbox_sync(const char *path, const char *folderuri, CamelOperation *cancel)
+mail_importer_import_mbox_sync(const gchar *path, const gchar *folderuri, CamelOperation *cancel)
{
struct _import_mbox_msg *m;
@@ -355,15 +355,15 @@ struct _import_folders_data {
};
static void
-import_folders_rec(struct _import_folders_data *m, const char *filepath, const char *folderparent)
+import_folders_rec(struct _import_folders_data *m, const gchar *filepath, const gchar *folderparent)
{
EShellBackend *shell_backend;
GDir *dir;
- const char *d;
+ const gchar *d;
struct stat st;
const gchar *data_dir;
- char *filefull, *foldersub, *uri, *utf8_filename;
- const char *folder;
+ gchar *filefull, *foldersub, *uri, *utf8_filename;
+ const gchar *folder;
dir = g_dir_open(filepath, 0, NULL);
if (dir == NULL)
@@ -392,7 +392,7 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
folder = d;
if (folderparent == NULL) {
- int i;
+ gint i;
for (i=0;m->special_folders[i].orig;i++)
if (strcmp(m->special_folders[i].orig, folder) == 0) {
@@ -411,7 +411,7 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
/* This little gem re-uses the stat buffer and filefull to automagically scan mozilla-format folders */
if (!m->elmfmt) {
- char *tmp = g_strdup_printf("%s.sbd", filefull);
+ gchar *tmp = g_strdup_printf("%s.sbd", filefull);
g_free(filefull);
filefull = tmp;
@@ -450,7 +450,7 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
* standard unix directories.
**/
void
-mail_importer_import_folders_sync(const char *filepath, MailImporterSpecial special_folders[], int flags, CamelOperation *cancel)
+mail_importer_import_folders_sync(const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel)
{
struct _import_folders_data m;
CamelOperation *oldcancel = NULL;
diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h
index f108967ebc..92f555cf75 100644
--- a/mail/importers/mail-importer.h
+++ b/mail/importers/mail-importer.h
@@ -38,14 +38,14 @@ void mail_importer_init (struct _MailComponent *mc);
void mail_importer_uninit (void);
void mail_importer_add_line (MailImporter *importer,
- const char *str,
+ const gchar *str,
gboolean finished);
-void mail_importer_create_folder (const char *parent_path,
- const char *name,
- const char *description);
+void mail_importer_create_folder (const gchar *parent_path,
+ const gchar *name,
+ const gchar *description);
/* creates a folder at folderpath on the local storage */
-char *mail_importer_make_local_folder(const char *folderpath);
+gchar *mail_importer_make_local_folder(const gchar *folderpath);
struct _BonoboObject;
struct _BonoboGenericFactory;
@@ -71,7 +71,7 @@ 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);
+struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *factory, const gchar *iid, gpointer data);
/* Defines copied from nsMsgMessageFlags.h in Mozilla source. */
@@ -81,8 +81,8 @@ struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *fac
#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);
+gint mail_importer_import_mbox(const gchar *path, const gchar *folderuri, struct _CamelOperation *cancel, void (*done)(gpointer data, struct _CamelException *), gpointer data);
+void mail_importer_import_mbox_sync(const gchar *path, const gchar *folderuri, struct _CamelOperation *cancel);
struct _MailImporterSpecial {
const gchar *orig, *new;
@@ -93,6 +93,6 @@ typedef struct _MailImporterSpecial MailImporterSpecial;
#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);
+void mail_importer_import_folders_sync(const gchar *filepath, MailImporterSpecial special_folders[], gint flags, struct _CamelOperation *cancel);
#endif
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index 3a4e6d9cc1..e460d66d2e 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -58,9 +58,9 @@ struct _pine_import_msg {
EImportTarget *target;
GMutex *status_lock;
- char *status_what;
- int status_pc;
- int status_timeout_id;
+ gchar *status_what;
+ gint status_pc;
+ gint status_timeout_id;
CamelOperation *status;
};
@@ -68,7 +68,7 @@ static gboolean
pine_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
{
EImportTargetHome *s;
- char *maildir, *addrfile;
+ gchar *maildir, *addrfile;
gboolean md_exists, addr_exists;
if (target->type != E_IMPORT_TARGET_HOME)
@@ -102,10 +102,10 @@ FIXME: we dont handle aliases in lists.
*/
static void
-import_contact(EBook *book, char *line)
+import_contact(EBook *book, gchar *line)
{
- char **strings, *addr, **addrs;
- int i;
+ gchar **strings, *addr, **addrs;
+ gint i;
GList *list;
/*EContactName *name;*/
EContact *card;
@@ -165,7 +165,7 @@ import_contacts(void)
ESource *primary;
ESourceList *source_list;
EBook *book;
- char *name;
+ gchar *name;
GString *line;
FILE *fp;
size_t offset;
@@ -238,7 +238,7 @@ pine_import_exec(struct _pine_import_msg *m)
import_contacts();
if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-mail"))) {
- char *path;
+ gchar *path;
path = g_build_filename(g_get_home_dir(), "mail", NULL);
mail_importer_import_folders_sync(path, pine_special_folders, 0, m->status);
@@ -280,7 +280,7 @@ pine_import_free(struct _pine_import_msg *m)
}
static void
-pine_status(CamelOperation *op, const char *what, int pc, void *data)
+pine_status(CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
struct _pine_import_msg *importer = data;
@@ -297,11 +297,11 @@ pine_status(CamelOperation *op, const char *what, int pc, void *data)
}
static gboolean
-pine_status_timeout(void *data)
+pine_status_timeout(gpointer data)
{
struct _pine_import_msg *importer = data;
- int pc;
- char *what;
+ gint pc;
+ gchar *what;
if (importer->status_what) {
g_mutex_lock(importer->status_lock);
@@ -328,7 +328,7 @@ static int
mail_importer_pine_import(EImport *ei, EImportTarget *target)
{
struct _pine_import_msg *m;
- int id;
+ gint id;
m = mail_msg_new(&pine_import_info);
g_datalist_set_data(&target->data, "pine-msg", m);