aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2007-11-15 06:04:21 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2007-11-15 06:04:21 +0800
commit9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch)
tree2e1e96f33404781354c422a7e9beaf458ebeb655 /addressbook/importers
parent7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff)
downloadgsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz
gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst
gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com> ** Remove trailing whitespace from source code. svn path=/trunk/; revision=34537
Diffstat (limited to 'addressbook/importers')
-rw-r--r--addressbook/importers/evolution-csv-importer.c86
-rw-r--r--addressbook/importers/evolution-ldif-importer.c18
-rw-r--r--addressbook/importers/evolution-vcard-importer.c22
3 files changed, 63 insertions, 63 deletions
diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c
index ade0e670db..e77d9067a8 100644
--- a/addressbook/importers/evolution-csv-importer.c
+++ b/addressbook/importers/evolution-csv-importer.c
@@ -50,8 +50,8 @@ typedef struct {
EImportTarget *target;
guint idle_id;
-
- int state;
+
+ int state;
FILE *file;
gulong size;
gint count;
@@ -73,14 +73,14 @@ typedef struct {
#define FLAG_OTHER_ADDRESS 0x04
#define FLAG_STREET 0x08
#define FLAG_CITY 0x10
-#define FLAG_STATE 0x20
+#define FLAG_STATE 0x20
#define FLAG_POSTAL_CODE 0x40
#define FLAG_COUNTRY 0x80
-#define FLAG_POBOX 0x70
+#define FLAG_POBOX 0x70
#define FLAG_DATE_BDAY 0x03
-#define FLAG_BIRTH_DAY 0x05
+#define FLAG_BIRTH_DAY 0x05
#define FLAG_BIRTH_YEAR 0x07
-#define FLAG_BIRTH_MONTH 0x50
+#define FLAG_BIRTH_MONTH 0x50
#define FLAG_DATE_ANNIVERSARY 0x30
#define FLAG_INVALID 0xff
int flags;
@@ -158,7 +158,7 @@ static import_fields csv_fields_outlook[] = {
{"Hobby", NOMAP},
{"Home Address PO Box", NOMAP, FLAG_HOME_ADDRESS|FLAG_POBOX},
{"Initials", NOMAP},
- {"Internet FREE/BUSY", E_CONTACT_FREEBUSY_URL},
+ {"Internet FREE/BUSY", E_CONTACT_FREEBUSY_URL},
{"Keywords", NOMAP},
{"Language", NOMAP},
{"Location", NOMAP},
@@ -218,8 +218,8 @@ static import_fields csv_fields_mozilla[] = {
{"Custom 3", NOMAP},
{"Custom 4", NOMAP},
{"Notes", NOMAP},
-
-
+
+
};
static import_fields csv_fields_evolution[] = {
@@ -265,15 +265,15 @@ add_to_notes(EContact *contact, gint i, char *val) {
const gchar *old_text;
const gchar *field_text = NULL;
GString *new_text;
-
+
old_text = e_contact_get_const(contact, E_CONTACT_NOTE);
if(importer == OUTLOOK_IMPORTER)
field_text = csv_fields_outlook[i].csv_attribute;
else if(importer == MOZILLA_IMPORTER)
field_text = csv_fields_mozilla[i].csv_attribute;
else
- field_text = csv_fields_evolution[i].csv_attribute;
-
+ field_text = csv_fields_evolution[i].csv_attribute;
+
new_text = g_string_new(old_text);
if(strlen(new_text->str) != 0)
new_text = g_string_append_c(new_text, '\n');
@@ -302,7 +302,7 @@ date_from_string (const char *str)
length = t - str;
else
length = strlen(str);
-
+
if (g_ascii_isdigit (str[i]) && g_ascii_isdigit (str[i+1])) {
date->month = str[i] * 10 + str[i+1] - '0' * 11;
i = i+3;
@@ -321,13 +321,13 @@ date_from_string (const char *str)
i = i+2;
}
date->year = str[i] * 1000 + str[i+1] * 100 + str[i+2] * 10 + str[i+3] - '0' * 1111;
-
+
return date;
}
-static gboolean
+static gboolean
parseLine (CSVImporter *gci, EContact *contact, char **buf) {
-
+
char *ptr = *buf;
GString *value;
gint i = 0;
@@ -343,7 +343,7 @@ parseLine (CSVImporter *gci, EContact *contact, char **buf) {
work_address = g_new0(EContactAddress, 1);
other_address = g_new0(EContactAddress, 1);
bday = g_new0(EContactDate, 1);
-
+
while(*ptr != '\n') {
value = g_string_new("");
while(*ptr != delimiter) {
@@ -455,7 +455,7 @@ parseLine (CSVImporter *gci, EContact *contact, char **buf) {
case FLAG_DATE_BDAY:
e_contact_set(contact, E_CONTACT_BIRTH_DATE, date_from_string(value->str));
break;
-
+
case FLAG_DATE_ANNIVERSARY:
e_contact_set(contact, E_CONTACT_ANNIVERSARY, date_from_string(value->str));
break;
@@ -472,9 +472,9 @@ parseLine (CSVImporter *gci, EContact *contact, char **buf) {
case FLAG_INVALID:
break;
-
+
default:
- add_to_notes(contact, i, value->str);
+ add_to_notes(contact, i, value->str);
}
}
@@ -495,13 +495,13 @@ parseLine (CSVImporter *gci, EContact *contact, char **buf) {
g_string_free(other_street, TRUE);
if(home_address->locality || home_address->country ||
- home_address->code || home_address->region || home_address->street)
+ home_address->code || home_address->region || home_address->street)
e_contact_set (contact, E_CONTACT_ADDRESS_HOME, home_address);
if(work_address->locality || work_address->country ||
- work_address->code || work_address->region || work_address->street)
+ work_address->code || work_address->region || work_address->street)
e_contact_set (contact, E_CONTACT_ADDRESS_WORK, work_address);
if(other_address->locality || other_address->country ||
- other_address->code || other_address->region || other_address->street)
+ other_address->code || other_address->region || other_address->street)
e_contact_set (contact, E_CONTACT_ADDRESS_OTHER, other_address);
if(importer != OUTLOOK_IMPORTER) {
@@ -520,12 +520,12 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
char *buf;
char c;
- /*
- if(!fgets(line, sizeof(line),f))
+ /*
+ if(!fgets(line, sizeof(line),f))
return NULL;
if(gci->count == 0 && importer != MOZILLA_IMPORTER) {
- if(!fgets(line, sizeof(line),f))
+ if(!fgets(line, sizeof(line),f))
return NULL;
gci->count ++;
}
@@ -552,7 +552,7 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
else
g_string_append_unichar(line, c);
}
-
+
if(gci->count == 0 && importer != MOZILLA_IMPORTER) {
g_string_free (line, TRUE);
line = g_string_new("");
@@ -575,7 +575,7 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
}
else
g_string_append_unichar(line, c);
- }
+ }
gci->count ++;
}
@@ -583,12 +583,12 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
str = g_string_append (str, line->str);
g_string_free (line, TRUE);
-
+
if(strlen(str->str) == 0) {
g_string_free(str, TRUE);
return NULL;
}
-
+
contact = e_contact_new();
buf = str->str;
@@ -639,14 +639,14 @@ csv_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
{
GtkWidget *vbox, *selector;
ESource *primary;
- ESourceList *source_list;
+ ESourceList *source_list;
/* FIXME Better error handling */
if (!e_book_get_addressbooks (&source_list, NULL))
return NULL;
vbox = gtk_vbox_new (FALSE, FALSE);
-
+
selector = e_source_selector_new (source_list);
e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), selector, FALSE, TRUE, 6);
@@ -677,7 +677,7 @@ csv_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
char *ext;
int i;
EImportTargetURI *s;
-
+
if (target->type != E_IMPORT_TARGET_URI)
return FALSE;
@@ -759,26 +759,26 @@ csv_import (EImport *ei, EImportTarget *target, EImportImporter *im)
fseek(file, 0, SEEK_SET);
e_book_open(gci->book, FALSE, NULL);
-
+
gci->idle_id = g_idle_add (csv_import_contacts, gci);
}
static void
-outlook_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
+outlook_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
importer = OUTLOOK_IMPORTER;
csv_import(ei, target, im);
}
static void
-mozilla_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
+mozilla_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
importer = MOZILLA_IMPORTER;
csv_import(ei, target, im);
}
static void
-evolution_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
+evolution_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
importer = EVOLUTION_IMPORTER;
csv_import(ei, target, im);
@@ -791,7 +791,7 @@ csv_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) {
if(gci)
gci->state = 1;
}
-
+
static EImportImporter csv_outlook_importer = {
E_IMPORT_TARGET_URI,
@@ -825,7 +825,7 @@ evolution_csv_outlook_importer_peek(void)
{
csv_outlook_importer.name = _("Outlook CSV or Tab (.csv, .tab)");
csv_outlook_importer.description = _("Outlook CSV and Tab Importer");
-
+
return &csv_outlook_importer;
}
@@ -833,8 +833,8 @@ EImportImporter *
evolution_csv_mozilla_importer_peek(void)
{
csv_mozilla_importer.name = _("Mozilla CSV or Tab (.csv, .tab)");
- csv_mozilla_importer.description = _("Mozilla CSV and Tab Importer");
-
+ csv_mozilla_importer.description = _("Mozilla CSV and Tab Importer");
+
return &csv_mozilla_importer;
}
@@ -842,7 +842,7 @@ EImportImporter *
evolution_csv_evolution_importer_peek(void)
{
csv_evolution_importer.name = _("Evolution CSV or Tab (.csv, .tab)");
- csv_evolution_importer.description = _("Evolution CSV and Tab Importer");
-
+ csv_evolution_importer.description = _("Evolution CSV and Tab Importer");
+
return &csv_evolution_importer;
}
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 1e055db4da..2361c41310 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* LDIF importer. LDIF is the file format of an exported Netscape
* addressbook.
*
@@ -155,7 +155,7 @@ getValue( char **src )
static void
populate_contact_address (EContactAddress *address, char *attr, char *value)
{
- if (!g_ascii_strcasecmp (attr, "locality") ||
+ if (!g_ascii_strcasecmp (attr, "locality") ||
!g_ascii_strcasecmp (attr, "l") ||
!g_ascii_strcasecmp (attr, "mozillaHomeLocalityName"))
address->locality = g_strdup (value);
@@ -179,7 +179,7 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
address->ext = g_strconcat (temp, ",\n", value, NULL);
g_free (temp);
}
- else {
+ else {
address->ext = g_strdup (value);
}
}
@@ -209,8 +209,8 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
}
static gboolean
-parseLine (LDIFImporter *gci, EContact *contact,
- EContactAddress *work_address, EContactAddress *home_address,
+parseLine (LDIFImporter *gci, EContact *contact,
+ EContactAddress *work_address, EContactAddress *home_address,
char **buf)
{
char *ptr;
@@ -371,7 +371,7 @@ getNextLDIFEntry(LDIFImporter *gci, FILE *f )
work_address->code || work_address->region || work_address->street) {
e_contact_set (contact, E_CONTACT_ADDRESS_WORK, work_address);
}
- if (home_address->locality || home_address->country || home_address->ext ||
+ if (home_address->locality || home_address->country || home_address->ext ||
home_address->code || home_address->region || home_address->street) {
e_contact_set (contact, E_CONTACT_ADDRESS_HOME, home_address);
}
@@ -419,7 +419,7 @@ resolve_list_card (LDIFImporter *gci, EContact *contact)
email_attrs = g_list_append (email_attrs, attr);
}
- }
+ }
e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs);
g_list_foreach (email, (GFunc) g_free, NULL);
@@ -514,14 +514,14 @@ ldif_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
{
GtkWidget *vbox, *selector;
ESource *primary;
- ESourceList *source_list;
+ ESourceList *source_list;
/* FIXME Better error handling */
if (!e_book_get_addressbooks (&source_list, NULL))
return NULL;
vbox = gtk_vbox_new (FALSE, FALSE);
-
+
selector = e_source_selector_new (source_list);
e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), selector, FALSE, TRUE, 6);
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 5a7615f924..9afb1b0a47 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -54,7 +54,7 @@ typedef struct {
int count;
ESource *primary;
-
+
GList *contactlist;
GList *iterator;
EBook *book;
@@ -258,7 +258,7 @@ vcard_import_contacts(void *data)
static gboolean
has_bom (const gunichar2 *utf16)
{
-
+
if ((utf16 == NULL) || (*utf16 == '\0')) {
return FALSE;
}
@@ -273,7 +273,7 @@ fix_utf16_endianness (gunichar2 *utf16)
if ((utf16 == NULL) || (*utf16 == '\0')) {
- return;
+ return;
}
if (*utf16 != ANTIBOM) {
@@ -285,14 +285,14 @@ fix_utf16_endianness (gunichar2 *utf16)
}
}
-/* Converts an UTF-16 string to an UTF-8 string removing the BOM character
+/* Converts an UTF-16 string to an UTF-8 string removing the BOM character
* WARNING: this may modify the utf16 argument if the function detects the
* string isn't using the local endianness
*/
static gchar *
utf16_to_utf8 (gunichar2 *utf16)
{
-
+
if (utf16 == NULL) {
return NULL;
}
@@ -329,7 +329,7 @@ guess_vcard_encoding (const char *filename)
g_print ("\n");
return VCARD_ENCODING_NONE;
}
-
+
fgets (line, 4096, handle);
if (line == NULL) {
fclose (handle);
@@ -337,7 +337,7 @@ guess_vcard_encoding (const char *filename)
return VCARD_ENCODING_NONE;
}
fclose (handle);
-
+
if (has_bom ((gunichar2*)line)) {
gunichar2 *utf16 = (gunichar2*)line;
/* Check for a BOM to try to detect UTF-16 encoded vcards
@@ -380,7 +380,7 @@ vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
{
GtkWidget *vbox, *selector;
ESource *primary;
- ESourceList *source_list;
+ ESourceList *source_list;
/* FIXME Better error handling */
if (!e_book_get_addressbooks (&source_list, NULL))
@@ -391,7 +391,7 @@ vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
selector = e_source_selector_new (source_list);
e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), selector, FALSE, TRUE, 6);
-
+
primary = g_datalist_get_data(&target->data, "vcard-source");
if (primary == NULL) {
primary = e_source_list_peek_source_any (source_list);
@@ -480,7 +480,7 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im)
e_import_complete(ei, target);
return;
}
-
+
if (!g_file_get_contents (filename, &contents, NULL, NULL)) {
g_message (G_STRLOC ":Couldn't read file.");
g_free (filename);
@@ -522,7 +522,7 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im)
else
vcard_import_done(gci);
}
-
+
static void
vcard_cancel(EImport *ei, EImportTarget *target, EImportImporter *im)
{