diff options
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 45 |
2 files changed, 42 insertions, 11 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d7e7398971..e4ec97346f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,12 @@ 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. + +2000-08-11 Chris Toshok <toshok@helixcode.com> + * conduit/address-conduit.c (ecard_from_remote_record): add code for handling email addresses from pilot (which stores it as a phone number entry. go figure.) @@ -10,6 +17,7 @@ just return the existing (desktop) record - we still don't allow merge from the pilot. + 2000-08-10 Christopher James Lahey <clahey@helixcode.com> * gui/search/addresstypes.xml: Changed a couple of input field 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 */ |