From e1ddccf0ca9d099b542b55bf2a46fac18e1b7935 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sat, 12 Aug 2000 00:18:47 +0000 Subject: add code for handling email addresses from pilot (which stores it as a 2000-08-11 Chris Toshok * 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.) (check_for_slow_setting): #if 0 out, since we don't use it (yet). (update_record): un #if 0 the code to handle the case where the pilot info has changed for a local record. (merge_ecard_with_remote_record): implement function, but for now just return the existing (desktop) record - we still don't allow merge from the pilot. svn path=/trunk/; revision=4758 --- addressbook/conduit/address-conduit.c | 78 ++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 34 deletions(-) (limited to 'addressbook/conduit/address-conduit.c') diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index fdac250a10..f36b214f42 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -309,42 +309,46 @@ ecard_from_remote_record(AddressbookConduitContext *ctxt, ADD_PROP (orgprop, entryCompany, VCOrgNameProp); } -#if 1 for (i = entryPhone1; i <= entryPhone5; i ++) { if (address.entry [i]) { - const char* phone_type; char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]]; - VObject *phoneprop = addPropValue (vobj, - VCTelephoneProp, - address.entry[i]); - - printf ("added '%s' phone entry %s\n", - phonelabel, - address.entry[i]); - - if (!strcmp (phonelabel, "Home")) - phone_type = VCHomeProp; - else if (!strcmp (phonelabel, "Work")) - phone_type = VCWorkProp; - else if (!strcmp (phonelabel, "Fax")) - phone_type = VCFaxProp; - else if (!strcmp (phonelabel, "Other")) - phone_type = VCHomeProp; /* XXX */ - else if (!strcmp (phonelabel, "E-mail")) - phone_type = VCHomeProp; /* XXX */ - else if (!strcmp (phonelabel, "Main")) { /* XXX */ - addProp (phoneprop, VCHomeProp); - phone_type = VCPreferredProp; + if (!strcmp (phonelabel, "E-mail")) { + VObject *emailprop = addPropValue (vobj, + VCEmailAddressProp, + address.entry[i]); + addProp (emailprop, VCInternetProp); + } + else { + const char* phone_type = VCHomeProp; + VObject *phoneprop = addPropValue (vobj, + VCTelephoneProp, + address.entry[i]); + + printf ("added '%s' phone entry %s\n", + phonelabel, + address.entry[i]); + + if (!strcmp (phonelabel, "Home")) + phone_type = VCHomeProp; + else if (!strcmp (phonelabel, "Work")) + phone_type = VCWorkProp; + else if (!strcmp (phonelabel, "Fax")) + phone_type = VCFaxProp; + else if (!strcmp (phonelabel, "Other")) + phone_type = VCHomeProp; /* XXX */ + else if (!strcmp (phonelabel, "Main")) { /* XXX */ + addProp (phoneprop, VCHomeProp); + phone_type = VCPreferredProp; + } + else if (!strcmp (phonelabel, "Pager")) + phone_type = VCPagerProp; + else if (!strcmp (phonelabel, "Mobile")) + phone_type = VCCellularProp; + addProp (phoneprop, phone_type); } - else if (!strcmp (phonelabel, "Pager")) - phone_type = VCPagerProp; - else if (!strcmp (phonelabel, "Mobile")) - phone_type = VCCellularProp; - - addProp (phoneprop, phone_type); } } -#endif +#undef ADD_PROP temp = writeMemVObject (NULL, NULL, vobj); ecard = e_card_new (temp); @@ -358,6 +362,14 @@ ecard_from_remote_record(AddressbookConduitContext *ctxt, return ecard; } +static ECard* +merge_ecard_with_remote_record (AddressbookConduitContext *ctxt, + ECard *ecard, + PilotRecord *remote) +{ + return ecard; +} + typedef struct { EBookStatus status; char *id; @@ -413,7 +425,6 @@ update_record (GnomePilotConduitStandardAbs *conduit, else WARN ("update_record: failed to add card to ebook\n"); } else { -#if 0 EBookStatus commit_status; ecard = merge_ecard_with_remote_record (ctxt, ecard, remote); @@ -424,7 +435,6 @@ update_record (GnomePilotConduitStandardAbs *conduit, if (commit_status != E_BOOK_STATUS_SUCCESS) WARN ("update_record: failed to update card in ebook\n"); -#endif } free_Address(&address); @@ -432,10 +442,10 @@ update_record (GnomePilotConduitStandardAbs *conduit, return 0; } +#if 0 static void check_for_slow_setting (GnomePilotConduit *c, AddressbookConduitContext *ctxt) { -#if 0 GList *uids; unsigned long int entry_number; @@ -450,8 +460,8 @@ check_for_slow_setting (GnomePilotConduit *c, AddressbookConduitContext *ctxt) conduit = GNOME_PILOT_CONDUIT_STANDARD (c); gnome_pilot_conduit_standard_set_slow (conduit); } -#endif /* 0 */ } +#endif /* 0 */ static gint pre_sync (GnomePilotConduit *c, -- cgit