diff options
author | Chris Toshok <toshok@helixcode.com> | 2000-08-12 09:25:45 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2000-08-12 09:25:45 +0800 |
commit | 966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9 (patch) | |
tree | 56a7f8e42083ccf4a7be70c1711664e48faeb693 /addressbook/conduit | |
parent | c28cd1ebd751de621c37d9ca3a5e4db8638111a9 (diff) | |
download | gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar.gz gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar.bz2 gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar.lz gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar.xz gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.tar.zst gsoc2013-evolution-966a555f470d58fc41b3f0ad3ee8cbf0e024e5b9.zip |
implement code to encode the first email address and send to the pilot.
2000-08-11 Chris Toshok <toshok@helixcode.com>
* conduit/address-conduit.c (transmit): implement code to encode
the first email address and send to the pilot.
(get_phone_label_by_flag): rename find_phone_label_for_flags to
this, and implement by calling get_phone_label_by_name.
svn path=/trunk/; revision=4761
Diffstat (limited to 'addressbook/conduit')
-rw-r--r-- | addressbook/conduit/address-conduit.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index f36b214f42..5de6e5447c 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -881,12 +881,26 @@ set_pilot_id (GnomePilotConduitStandardAbs *conduit, } static int -find_phone_label_for_flags (struct AddressAppInfo *ai, - int flags) +get_phone_label_by_name (struct AddressAppInfo *ai, + const char *name) { - char *label_to_find; int i; + for (i = 0; i < 8 /* the number of pilot address labels */; i ++) { + if (!strcmp(name, ai->phoneLabels[i])) + return i; + } + + WARN ("couldn't find pilot label '%s'.\n", name); + return 0; +} + +static int +get_phone_label_by_flag (struct AddressAppInfo *ai, + int flags) +{ + char *label_to_find; + if (flags & E_CARD_PHONE_PREF) label_to_find = "Main"; else if (flags & E_CARD_PHONE_WORK) label_to_find = "Work"; else if (flags & E_CARD_PHONE_HOME) label_to_find = "Home"; @@ -895,13 +909,7 @@ find_phone_label_for_flags (struct AddressAppInfo *ai, else if (flags & E_CARD_PHONE_CELL) label_to_find = "Mobile"; else label_to_find = "Other"; - for (i = 0; i < 8 /* the number of pilot address labels */; i ++) { - if (!strcmp(label_to_find, ai->phoneLabels[i])) - return i; - } - - WARN ("couldn't find pilot label for phone type.\n"); - return 0; + return get_phone_label_by_name (ai, label_to_find); } /* @@ -921,7 +929,9 @@ transmit (GnomePilotConduitStandardAbs *conduit, PilotRecord *p; ECardName *ecard_name; EList *ecard_phones; + EList *ecard_emails; char *ecard_org, *ecard_note, *ecard_title; + int phone_entry = entryPhone1; LOG ("entering transmit"); @@ -944,6 +954,7 @@ transmit (GnomePilotConduitStandardAbs *conduit, "note", &ecard_note, "title", &ecard_title, "phone", &ecard_phones, + "email", &ecard_emails, NULL); /* use strdup instead of g_strdup since free_transmit uses free, not g_free. */ @@ -961,6 +972,18 @@ transmit (GnomePilotConduitStandardAbs *conduit, if (ecard_title) { local->address->entry [ entryTitle ] = strdup (ecard_title); } + if (ecard_emails) { + EIterator *iterator = e_list_get_iterator (ecard_emails); + char *email; + + if ((email = (char *)e_iterator_get(iterator))) { + local->address->phoneLabel[phone_entry - entryPhone1] = + get_phone_label_by_name (&ctxt->ai, "E-mail"); + local->address->entry [ phone_entry ] = strdup (email); + + phone_entry++; + } + } if (ecard_phones) { int phone_entry = entryPhone1; EIterator *iterator = e_list_get_iterator (ecard_phones); @@ -969,7 +992,7 @@ transmit (GnomePilotConduitStandardAbs *conduit, while ((phone = (ECardPhone*)e_iterator_get(iterator))) { local->address->phoneLabel[phone_entry - entryPhone1] = - find_phone_label_for_flags (&ctxt->ai, phone->flags); + get_phone_label_by_flag (&ctxt->ai, phone->flags); local->address->entry [ phone_entry ] = strdup (phone->number); /* only store 5 numbers */ |