2 Copyright (c) 2008 Instituto Nokia de Tecnologia
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of the INdT nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
31 * @author Adenilson Cavalcanti da Silva <adenilson.silva@indt.org.br>
32 * @date Thu Jun 26 07:25:35 2008
34 * @brief libgcal contacts user public API.
36 * Use this functions to handle common tasks when dealing with google contacts.
39 #ifndef __GCONTACT_LIB__
40 #define __GCONTACT_LIB__
45 /** Since user cannot create an static instance of it, it entitles itself
46 * to be a completely abstract data type. See \ref gcal_contact.
48 typedef struct gcal_contact
* gcal_contact_t
;
50 typedef struct gcal_structured_subvalues
*gcal_structured_subvalues_t
;
52 /** Contact entries array. Its used to hold retrieved contacts
53 * retrieved from google server.
55 struct gcal_contact_array
{
56 /** See \ref gcal_contact. */
57 gcal_contact_t entries
;
58 /** The number of entries */
62 /** Phone number types allowed by Google API */
85 P_ITEMS_COUNT
// must be the last one!
88 /** Email types allowed by Google API */
94 E_ITEMS_COUNT
// must be the last one!
97 /** Address types allowed by Google API */
103 A_ITEMS_COUNT
// must be the last one!
106 /** IM types allowed by Google API */
113 I_ITEMS_COUNT
// must be the last one!
116 /** Creates a new google contact object.
118 * If you are going to add new contact, see also \ref gcal_add_contact.
120 * @param raw_xml A string with google data XML of this entry.
122 * @return A gcal_contact object on success or NULL otherwise.
124 gcal_contact_t
gcal_contact_new(char *raw_xml
);
126 /** Free a gcal contact object.
129 * @param contact An gcal contact object, see also \ref gcal_contact_new.
131 void gcal_contact_delete(gcal_contact_t contact
);
134 /** Helper function, does all contact dump and parsing, returning
135 * the data as an array of \ref gcal_contact.
137 * @param gcalobj A libgcal object, must be previously authenticated with
138 * \ref gcal_get_authentication. See also \ref gcal_new.
140 * @param contact_array Pointer to a contact array structure. See
141 * \ref gcal_contact_array.
143 * @return 0 on success, -1 otherwise.
145 int gcal_get_contacts(gcal_t gcalobj
, struct gcal_contact_array
*contact_array
);
147 /** Use this function to cleanup an array of contacts.
149 * See also \ref gcal_get_contacts.
151 * @param contacts A pointer to an contacts array structure. See
152 * \ref gcal_contact_array.
154 void gcal_cleanup_contacts(struct gcal_contact_array
*contacts
);
157 /** Returns a contact element from a contact array.
159 * Since to final user contacts are abstract types, even if is possible to
160 * access internal \ref gcal_contact_array vector of contacts, its not
161 * possible to do pointer arithmetic. Use this function as an
163 * A context where this function is useful is when downloading all contacts
164 * from user account using \ref gcal_get_contacts.
166 * @param contacts An array of contacts, see \ref gcal_contact_array.
168 * @param _index Index of element (is zero based).
170 * @return Either a pointer to the event object or NULL.
172 gcal_contact_t
gcal_contact_element(struct gcal_contact_array
*contacts
,
175 /** Add a new contat in user's account.
177 * You should have authenticate before using \ref gcal_get_authentication.
179 * @param gcalobj A gcal object, see \ref gcal_new.
181 * @param contact A contact object, see \ref gcal_contact.
183 * @return 0 on sucess, -1 otherwise.
185 int gcal_add_contact(gcal_t gcalobj
, gcal_contact_t contact
);
188 /** Updates an already existant contact.
190 * Use it to update a contact, but pay attention that you neeed to have
191 * a valid contact object (i.e. that has at least the edit_url to this entry).
192 * See also \ref gcal_get_edit_url and \ref gcal_contact_get_xml).
194 * A common use case is when you added a new contact using \ref gcal_add_contact
195 * and later whant to edit it.
197 * @param gcalobj A gcal object, see \ref gcal_new.
199 * @param contact A contact object, see \ref gcal_contact.
201 * @return 0 on sucess, -1 otherwise.
203 int gcal_update_contact(gcal_t gcalobj
, gcal_contact_t contact
);
206 /** Deletes a contact (once you do this, is not possible to recover the
207 * information from this contact, only the ID).
209 * The behavior is different from calendar events, where is possible to
210 * retrieve all the data from a deleted event.
212 * @param gcalobj A gcal object, see \ref gcal_new.
214 * @param contact A contact object, see \ref gcal_contact.
216 * @return 0 on sucess, -1 otherwise.
218 int gcal_erase_contact(gcal_t gcalobj
, gcal_contact_t contact
);
220 /** Query for updated contacts (added/edited/deleted).
222 * Pay attention that by default, google server will hide deleted contacts.
223 * If you need to access them, remember to set it using \ref gcal_deleted
224 * *before* requesting the data.
226 * Use this function to get only the changed data. Somewhat related, see too
227 * \ref gcal_get_updated_events.
229 * @param gcal_obj A libgcal object, must be previously authenticated with
230 * \ref gcal_get_authentication. See also \ref gcal_new.
232 * @param contacts Pointer to a contact array structure. See
233 * \ref gcal_contact_array.
235 * @param timestamp A timestamp in format RFC 3339 format
236 * (e.g. 2008-09-10T21:00:00Z) (see \ref TIMESTAMP_MAX_SIZE and
237 * \ref get_mili_timestamp). It can include timezones too.
238 * If you just want to get the updated events starting from today at 06:00Z,
239 * use NULL as parameter.
241 * @return 0 on success, -1 otherwise.
243 int gcal_get_updated_contacts(gcal_t gcal_obj
,
244 struct gcal_contact_array
*contacts
,
248 /* Here starts gcal_contact accessors */
250 /** Access contact ID.
252 * Each entry has a unique ID assigned by google server.
254 * @param contact A contact object, see \ref gcal_contact.
256 * @return Pointer to internal object field (dont free it!) or NULL (in error
257 * case or if the field is not set). If the entry hasn't this field in the
258 * atom stream, it will be set to an empty string (i.e. "").
260 char *gcal_contact_get_id(gcal_contact_t contact
);
262 /** Access last updated timestamp.
264 * Not only each operation will change the updated timestamp of a contact,
265 * but I *guess* that (in the case of a google account contact) your
266 * contact can change this too.
268 * @param contact A contact object, see \ref gcal_contact.
270 * @return Pointer to internal object field (dont free it!) or NULL (in error
271 * case or if the field is not set). If the entry hasn't this field in the
272 * atom stream, it will be set to an empty string (i.e. "").
274 char *gcal_contact_get_updated(gcal_contact_t contact
);
276 /** Access contact name.
278 * All entries have a title, with semantic depending on the entry type:
279 * events (event title) or contact (contact name).
281 * @param contact A contact object, see \ref gcal_contact.
283 * @return Pointer to internal object field (dont free it!) or NULL (in error
284 * case or if the field is not set). If the entry hasn't this field in the
285 * atom stream, it will be set to an empty string (i.e. "").
287 char *gcal_contact_get_title(gcal_contact_t contact
);
289 /** Access the edit_url field.
291 * All entries have an edit_url field (which is the combo of ID+cookie) that
292 * must be used to do operations (edit/delete).
293 * See also \ref gcal_get_edit_url.
295 * @param contact A contact object, see \ref gcal_contact.
297 * @return Pointer to internal object field (dont free it!) or NULL (in error
298 * case or if the field is not set). If the entry hasn't this field in the
299 * atom stream, it will be set to an empty string (i.e. "").
301 char *gcal_contact_get_url(gcal_contact_t contact
);
306 * All entries have an etag field (Google Data API 2.0) that must be used
307 * to do operations (edit/delete). See also \ref gcal_get_edit_etag.
309 * @param contact A contact object, see \ref gcal_contact.
311 * @return Pointer to internal object field (dont free it!) or NULL (in error
312 * case or if the field is not set). If the entry hasn't this field in the
313 * atom stream, it will be set to an empty string (i.e. "").
315 char *gcal_contact_get_etag(gcal_contact_t contact
);
317 /** Access the raw XML representation of the entry.
319 * Besides having the more important information already parsed, its still
320 * possible to access the raw xml of the entry if and *only* if you set
321 * this mode in \ref gcal_t object using \ref gcal_set_store_xml function
322 * *before* getting the data (using \ref gcal_get_contacts).
324 * @param contact A contact object, see \ref gcal_contact.
326 * @return Pointer to internal object field (dont free it!) or NULL (in error
327 * case or if the field is not set). If the entry hasn't this field in the
328 * atom stream, it will be set to an empty string (i.e. "").
330 char *gcal_contact_get_xml(gcal_contact_t contact
);
332 /** Checks if the current event was deleted or not.
334 * When parsing the entry, the respective element used to represent deleted
335 * is stored internally of contact object.
337 * @param contact A contact object, see \ref gcal_contact.
339 * @return 1 for deleted, 0 for not deleted, -1 for error case (f the event
340 * object is invalid).
342 char gcal_contact_is_deleted(gcal_contact_t contact
);
345 /* This are the fields unique to contacts */
347 /** Access contact e-mail.
349 * Email has an important rule for google contacts, since its the only
350 * really required field to being able to add a new entry in user's
352 * It needs to be unique, no 2 contacts can have the same e-mail.
354 * @param contact A contact object, see \ref gcal_contact.
356 * @return Pointer to internal object field (dont free it!) or NULL (in error
357 * case or if the field is not set). If the entry hasn't this field in the
358 * atom stream, it will be set to an empty string (i.e. "").
361 /* TODO: document new functions */
362 int gcal_contact_get_emails_count(gcal_contact_t contact
);
363 int gcal_contact_get_pref_email(gcal_contact_t contact
);
364 char *gcal_contact_get_email_address(gcal_contact_t contact
, int i
);
365 gcal_email_type
gcal_contact_get_email_address_type(gcal_contact_t contact
, int i
);
367 char *gcal_contact_get_email(gcal_contact_t contact
);
369 /** Access contact description.
371 * This the place where contacts notes can be retrieved.
373 * @param contact A contact object, see \ref gcal_contact.
375 * @return Pointer to internal object field (dont free it!) or NULL (in error
376 * case or if the field is not set). If the entry hasn't this field in the
377 * atom stream, it will be set to an empty string (i.e. "").
379 char *gcal_contact_get_content(gcal_contact_t contact
);
381 /** Access contact nickname.
383 * @param contact A contact object, see \ref gcal_contact.
385 * @return Pointer to internal object field
387 char *gcal_contact_get_nickname(gcal_contact_t contact
);
389 /** Access contact organization name.
392 * @param contact A contact object, see \ref gcal_contact.
394 * @return Pointer to internal object field (dont free it!) or NULL (in error
395 * case or if the field is not set). If the entry hasn't this field in the
396 * atom stream, it will be set to an empty string (i.e. "").
399 char *gcal_contact_get_organization(gcal_contact_t contact
);
401 /** Access contact organization title/profission.
404 * @param contact A contact object, see \ref gcal_contact.
406 * @return Pointer to internal object field (dont free it!) or NULL (in error
407 * case or if the field is not set). If the entry hasn't this field in the
408 * atom stream, it will be set to an empty string (i.e. "").
411 char *gcal_contact_get_profission(gcal_contact_t contact
);
413 /** Access contact occupation/profession.
415 * @param contact A contact object, see \ref gcal_contact.
417 * @return Pointer to internal object field (dont free it!) or NULL (in error
418 * case or if the field is not set). If the entry hasn't this field in the
419 * atom stream, it will be set to an empty string (i.e. "").
422 char *gcal_contact_get_occupation(gcal_contact_t contact
);
424 /** Access contact website.
426 * @param contact A contact object, see \ref gcal_contact.
428 * @return Pointer to internal object field
430 char *gcal_contact_get_homepage(gcal_contact_t contact
);
432 /** Access contact blog.
434 * @param contact A contact object, see \ref gcal_contact.
436 * @return Pointer to internal object field
438 char *gcal_contact_get_blog(gcal_contact_t contact
);
440 /** Access contact telephone.
442 * @param contact A contact object, see \ref gcal_contact.
444 * @return Pointer to internal object field (dont free it!) or NULL (in error
445 * case or if the field is not set). If the entry hasn't this field in the
446 * atom stream, it will be set to an empty string (i.e. "").
449 /* TODO: document new functions */
450 int gcal_contact_get_phone_numbers_count(gcal_contact_t contact
);
451 char *gcal_contact_get_phone_number(gcal_contact_t contact
, int i
);
452 gcal_phone_type
gcal_contact_get_phone_number_type(gcal_contact_t contact
, int i
);
453 char *gcal_contact_get_phone(gcal_contact_t contact
);
455 /** Access contact IM count.
457 * @param contact A contact object, see \ref gcal_contact.
459 * @return Number of IM entries.
462 int gcal_contact_get_im_count(gcal_contact_t contact
);
464 /** Access contact preferred IM account.
466 * @param contact A contact object, see \ref gcal_contact.
468 * @return Number of preferred IM account.
471 int gcal_contact_get_pref_im(gcal_contact_t contact
);
473 /** Access contact IM protocol.
475 * @param contact A contact object, see \ref gcal_contact.
477 * @param i Number of the IM entry
479 * @return Pointer to internal object field.
481 char *gcal_contact_get_im_protocol(gcal_contact_t contact
, int i
);
483 /** Access contact IM address.
485 * @param contact A contact object, see \ref gcal_contact.
487 * @param i Number of the IM entry
489 * @return Pointer to internal object field.
491 char *gcal_contact_get_im_address(gcal_contact_t contact
, int i
);
493 /** Access contact IM type.
495 * @param contact A contact object, see \ref gcal_contact.
497 * @param i Number of the IM entry
499 * @return Type of the IM account.
501 gcal_phone_type
gcal_contact_get_im_type(gcal_contact_t contact
, int i
);
503 /** Access contact address (structuredPostalAddress.formattedAddress).
505 * @param contact A contact object, see \ref gcal_contact.
507 * @return Pointer to internal object field (dont free it!) or NULL (in error
508 * case or if the field is not set). If the entry hasn't this field in the
509 * atom stream, it will be set to an empty string (i.e. "").
512 char *gcal_contact_get_address(gcal_contact_t contact
);
514 /** Access structured address objects.
516 * @param contact A contact object, see \ref gcal_contact.
518 * @return Pointer to internal object field
520 gcal_structured_subvalues_t
gcal_contact_get_structured_address(gcal_contact_t contact
);
522 /** Access structured name object.
524 * @param contact A contact object, see \ref gcal_contact.
526 * @return Pointer to internal object field
528 gcal_structured_subvalues_t
gcal_contact_get_structured_name(gcal_contact_t contact
);
530 /** Get one structured entry.
532 * @param structured_entry A structured entry object, see \ref gcal_structured_subvalues.
534 * @param structured_entry_nr Index of the entry.
536 * @param structured_entry_count Number of all entries.
538 * @param field_key Key of the structured entry.
540 * @return Pointer to internal object field
542 char *gcal_contact_get_structured_entry(gcal_structured_subvalues_t structured_entry
, int structured_entry_nr
, int structured_entry_count
, const char *field_key
);
544 /** Access structured entry count.
546 * @param contact A contact object, see \ref gcal_contact.
548 * @return Number of structured entries
550 int gcal_contact_get_structured_address_count(gcal_contact_t contact
);
552 /** Access structured address count object.
554 * @param contact A contact object, see \ref gcal_contact.
556 * @return Pointer to internal object field
558 int *gcal_contact_get_structured_address_count_obj(gcal_contact_t contact
);
560 /** Access structured entry type.
562 * @param contact A contact object, see \ref gcal_contact.
564 * @param structured_entry_nr The number of the specific entry.
566 * @param structured_entry_count Number of all entries.
568 * @return Type of entry
570 gcal_address_type
gcal_contact_get_structured_address_type(gcal_contact_t contact
, int structured_entry_nr
, int structured_entry_count
);
572 /** Access structured address type object.
574 * @param contact A contact object, see \ref gcal_contact.
576 * @return Pointer to internal object field
578 char ***gcal_contact_get_structured_address_type_obj(gcal_contact_t contact
);
580 /** Access preferred structured address number.
582 * @param contact A contact object, see \ref gcal_contact.
584 * @return Number of preferred structured address.
587 int gcal_contact_get_pref_structured_address(gcal_contact_t contact
);
589 /** Access Google group membership info.
591 * @param contact A contact object, see \ref gcal_contact.
593 * @return Pointer to internal object field (dont free it!) or NULL (in error
594 * case or if the field is not set). If the entry hasn't this field in the
595 * atom stream, it will be set to an empty string (i.e. "").
598 int gcal_contact_get_groupMembership_count(gcal_contact_t contact
);
599 /* TODO: document new functions */
600 char *gcal_contact_get_groupMembership(gcal_contact_t contact
, int i
);
602 /** Access contact birthday.
604 * @param contact A contact object, see \ref gcal_contact.
606 * @return Pointer to internal object field (dont free it!) or NULL (in error
607 * case or if the field is not set). If the entry hasn't this field in the
608 * atom stream, it will be set to an empty string (i.e. "").
610 char *gcal_contact_get_birthday(gcal_contact_t contact
);
612 /** Access contact photo data.
614 * When no year is set in Google, Year is set to 1900 in KABC
616 * @param contact A contact object, see \ref gcal_contact.
618 * @return Pointer to internal object field (dont free it!) or NULL (in error
619 * case or if the field is not set). If the entry hasn't this field in the
620 * atom stream, it will be set to an empty string (i.e. "").
622 char *gcal_contact_get_photo(gcal_contact_t contact
);
624 /** Access contact photo data length.
626 * It can required to known where the data ends (since is a binary blob
627 * you cannot use strlen).
629 * @param contact A contact object, see \ref gcal_contact.
631 * @return 0 for no photo, 1 for photo link existence and > 1 when having the
632 * photo data. -1 for error case.
634 unsigned int gcal_contact_get_photolength(gcal_contact_t contact
);
636 /* Here starts the gcal_contact setters */
638 /** Sets contact name.
640 * Use this to assign a contact's name (or to change it if you wish to update an
641 * already existant contact).
643 * @param contact A contact object, see \ref gcal_contact.
645 * @param field String with contact name (e.g. "Joe Doe").
647 * @return 0 for sucess, -1 otherwise.
649 int gcal_contact_set_title(gcal_contact_t contact
, const char *field
);
651 /** Sets contact email.
653 * This field is a hard requirement to create a new contact. Google server
654 * supports more e-mails with special tags too.
656 * If you need to add a contact entry with all optional fields, an
657 * alternative is to use \ref gcal_add_xmlentry.
659 * @param contact A contact object, see \ref gcal_contact.
661 * @param field Email address.
663 * @param type Email address type.
665 * @param pref Preferred email address (0=no, 1=yes).
667 * @return 0 for success, -1 otherwise
670 int gcal_contact_add_email_address(gcal_contact_t contact
, const char *field
,
671 gcal_email_type type
, int pref
);
673 /** Sets the prefered email.
675 * This is a convenience function, it is implemented internally using
676 * \ref gcal_contact_add_email_address.
678 * The email type defauls to HOME.
680 * @param contact A contact object, see \ref gcal_contact.
682 * @param pref_email Email address.
684 * @return 0 for success, -1 otherwise
686 int gcal_contact_set_email(gcal_contact_t contact
, const char *pref_email
);
689 /* TODO: document new functions */
690 int gcal_contact_delete_email_addresses(gcal_contact_t contact
);
693 /** Sets contact edit url.
695 * This field is a hard requirement to edit/delete a contact. Starting with
696 * google data API 2.0, the ETag is also required.
698 * @param contact A contact object, see \ref gcal_contact.
700 * @param field String with the edit url email
701 * (e.g. "http://www.google.com/m8/feeds/contacts/user%40gmail.com/base/2").
703 * @return 0 for sucess, -1 otherwise.
705 int gcal_contact_set_url(gcal_contact_t contact
, const char *field
);
710 * Each contact has an ID (but this can extracted from the edit_url).
712 * @param contact A contact object, see \ref gcal_contact.
714 * @param field String with contact ID (e.g. "joe.doe@nobody.com").
716 * @return 0 for sucess, -1 otherwise.
718 int gcal_contact_set_id(gcal_contact_t contact
, const char *field
);
721 /** Sets contact ETag.
723 * Starting with google data API 2.0, the ETag is used for versioning the
724 * entries. Is required for edit/delete.
726 * @param contact A contact object, see \ref gcal_contact.
728 * @param field String with contact ETag (e.g. "Q3c5eDVSLyp7ImA9WxRbFE0KRAY.").
730 * @return 0 for sucess, -1 otherwise.
732 int gcal_contact_set_etag(gcal_contact_t contact
, const char *field
);
736 /** Sets the contact telephone.
738 * @param contact A contact object, see \ref gcal_contact.
740 * @param field Phone number.
742 * @param type Phone number type.
744 * @return 0 for success, -1 otherwise
746 int gcal_contact_add_phone_number(gcal_contact_t contact
, const char *field
,
747 gcal_phone_type type
);
750 /** Sets contact prefered phone.
752 * This is a convenience function, it is implemented internally using
753 * \ref gcal_contact_add_phone_number. Pay attention that when this
754 * function is called, it will destroy all the contact's phone list
755 * to ensure that the prefered email will be the first to be added.
757 * The phone type default to P_MOBILE.
759 * @param contact A contact object, see \ref gcal_contact.
761 * @param phone A phone number (e.g. "+551132314412")
763 * @return 0 for success, -1 otherwise
765 int gcal_contact_set_phone(gcal_contact_t contact
, const char *phone
);
768 /* TODO: document new functions */
769 int gcal_contact_delete_phone_numbers(gcal_contact_t contact
);
773 * @param contact A contact object, see \ref gcal_contact.
775 * @param protcol IM protocol.
777 * @param address IM address.
779 * @param type IM type.
781 * @return 0 for success, -1 otherwise
783 int gcal_contact_add_im(gcal_contact_t contact
, const char *protcol
,
784 const char *address
, gcal_im_type type
, int pref
);
786 /** Deletes contact IM.
788 * @param contact A contact object, see \ref gcal_contact.
790 * @return 0 for success, -1 otherwise
792 int gcal_contact_delete_im(gcal_contact_t contact
);
794 /** Sets the contact address (Google API v2.0 gd:postalAddress).
796 * @param contact A contact object, see \ref gcal_contact.
798 * @param field Address string.
800 * @return 0 for success, -1 otherwise
802 int gcal_contact_set_address(gcal_contact_t contact
, const char *field
);
804 /** Sets the contact full address number (structuredPostalAddress).
806 * @param contact A contact object, see \ref gcal_contact.
808 * @param type Address type.
810 * @return 0 for success, -1 otherwise
812 int gcal_contact_set_structured_address_nr(gcal_contact_t contact
,
813 gcal_address_type type
);
815 /** Sets the contact preferred address number (structuredPostalAddress).
817 * @param contact A contact object, see \ref gcal_contact.
819 * @param pref_address Number of preferred address.
821 * @return 0 for success, -1 otherwise
823 int gcal_contact_set_pref_structured_address(gcal_contact_t contact
, int pref_address
);
825 /** Sets a structured entry.
827 * @param structured_entry A structured entry object, see \ref gcal_structured_subvalues.
829 * @param structured_entry_nr Index of the entry.
831 * @param structured_entry_count Number of all entries.
833 * @param field_key Key of the structured entry.
835 * @param field_value Corresponding value.
837 * @param structured_entry_type Structured entry type.
839 * @return 0 for success, -1 otherwise
841 int gcal_contact_set_structured_entry(gcal_structured_subvalues_t structured_entry
,
842 int structured_entry_nr
,
843 int structured_entry_count
,
844 const char *field_key
,
845 const char *field_value
);
847 /** Deletes a structured entry.
849 * @param structured_entry A structured entry object, see \ref gcal_structured_subvalues.
851 * @param *structured_entry_count Pointer to the structured entry count object.
853 * @param ***structured_entry_type Pointer to the structured entry type object.
855 * @return 0 for success, -1 otherwise
857 int gcal_contact_delete_structured_entry(gcal_structured_subvalues_t structured_entry
,
858 int *structured_entry_count
,
859 char ***structured_entry_type
);
861 /** Sets the contact group membership info.
863 * @param contact A contact object, see \ref gcal_contact.
865 * @param field Group name.
867 * @return 0 for success, -1 otherwise
869 int gcal_contact_add_groupMembership(gcal_contact_t contact
, char *field
);
871 /* TODO: document new functions */
872 int gcal_contact_delete_groupMembership(gcal_contact_t contact
);
875 /** Sets the contact birthday
877 * When no year is set in Google, Year is set to 1900 in KABC
879 * @param contact A contact object, see \ref gcal_contact.
881 * @param field birthday string.
883 * @return 0 for success, -1 otherwise
885 int gcal_contact_set_birthday(gcal_contact_t contact
, const char *field
);
887 /** Sets the organization title.
890 * @param contact A contact object, see \ref gcal_contact.
892 * @param field Organization title string (i.e. "C++ programmer").
894 * @return 0 for success, -1 otherwise
896 int gcal_contact_set_profission(gcal_contact_t contact
, const char *field
);
898 /** Sets the organization name.
901 * @param contact A contact object, see \ref gcal_contact.
903 * @param field Organization name string (i.e. "Foo Software Inc.").
905 * @return 0 for success, -1 otherwise
907 int gcal_contact_set_organization(gcal_contact_t contact
, const char *field
);
909 /** Sets the occupation/profession.
912 * @param contact A contact object, see \ref gcal_contact.
914 * @param field occupation/profession name string (i.e. "Carpenter").
916 * @return 0 for success, -1 otherwise
918 int gcal_contact_set_occupation(gcal_contact_t contact
, const char *field
);
920 /** Sets contact description.
922 * @param contact A contact object, see \ref gcal_contact.
924 * @param field A note, description (i.e. "Really funny guy")
926 * @return 0 for success, -1 otherwise
928 int gcal_contact_set_content(gcal_contact_t contact
, const char *field
);
930 /** Sets contact nickname.
932 * @param contact A contact object, see \ref gcal_contact.
934 * @param field The nickname
936 * @return 0 for success, -1 otherwise
938 int gcal_contact_set_nickname(gcal_contact_t contact
, const char *field
);
940 /** Sets contact website.
942 * @param contact A contact object, see \ref gcal_contact.
946 * @return 0 for success, -1 otherwise
948 int gcal_contact_set_homepage(gcal_contact_t contact
, const char *field
);
950 /** Sets contact blog.
952 * @param contact A contact object, see \ref gcal_contact.
956 * @return 0 for success, -1 otherwise
958 int gcal_contact_set_blog(gcal_contact_t contact
, const char *field
);
960 /* TODO: document new functions */
961 int gcal_contact_set_photo(gcal_contact_t contact
, const char *field
,