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:37:03 2008
34 * @brief libgcal google contacts user public API.
36 * Use this functions to handle common tasks when dealing with google contacts.
48 #include "gcal_parser.h"
49 #include "internal_gcal.h"
52 /** Strings associated with phone number types */
53 const char* gcal_phone_type_str
[] = {
54 "assistant", // P_ASSISTANT
55 "callback", // P_CALLBACK
57 "company_main", // P_COMPANY_MAIN
60 "home_fax", // P_HOME_FAX
65 "other_fax", // P_OTHER_FAX
69 "tty_tdd", // P_TTY_TDD
71 "work_fax", // P_WORK_FAX
72 "work_mobile", // P_WORK_MOBILE
73 "work_pager" // P_WORK_PAGER
76 /** Strings associated with email types */
77 const char* gcal_email_type_str
[] = {
83 /** Strings associated with address types */
84 const char* gcal_address_type_str
[] = {
90 gcal_contact_t
gcal_contact_new(char *raw_xml
)
92 gcal_contact_t contact
= NULL
;
96 contact
= (gcal_contact_t
) malloc(sizeof(struct gcal_contact
));
100 gcal_init_contact(contact
);
104 /* Builds a doc, parse and init object */
105 doc
= build_dom_document(raw_xml
);
109 result
= extract_all_contacts(doc
, contact
, 1);
110 clean_dom_document(doc
);
121 void gcal_contact_delete(gcal_contact_t contact
)
126 gcal_destroy_contact(contact
);
131 int gcal_get_contacts(gcal_t gcalobj
, struct gcal_contact_array
*contact_array
)
135 contact_array
->length
= 0;
137 if ((!gcalobj
) || (!contact_array
))
140 result
= gcal_dump(gcalobj
, "GData-Version: 3.0");
142 contact_array
->entries
= NULL
;
143 contact_array
->length
= 0;
147 contact_array
->entries
= gcal_get_all_contacts(gcalobj
,
148 &contact_array
->length
);
149 if (!contact_array
->entries
)
158 void gcal_cleanup_contacts(struct gcal_contact_array
*contacts
)
163 gcal_destroy_contacts(contacts
->entries
, contacts
->length
);
164 contacts
->length
= 0;
165 contacts
->entries
= NULL
;
170 int gcal_add_contact(gcal_t gcalobj
, gcal_contact_t contact
)
173 struct gcal_contact updated
;
174 gcal_init_contact(&updated
);
176 if ((!gcalobj
) || (!contact
))
180 result
= gcal_create_contact(gcalobj
, contact
, &updated
);
184 /* Swap updated fields: id, updated, edit_uri, etag, photo url */
185 if (contact
->common
.id
)
186 free(contact
->common
.id
);
187 contact
->common
.id
= updated
.common
.id
;
188 updated
.common
.id
= NULL
;
190 if (contact
->common
.updated
)
191 free(contact
->common
.updated
);
192 contact
->common
.updated
= updated
.common
.updated
;
193 updated
.common
.updated
= NULL
;
195 if (contact
->common
.edit_uri
)
196 free(contact
->common
.edit_uri
);
197 contact
->common
.edit_uri
= updated
.common
.edit_uri
;
198 updated
.common
.edit_uri
= NULL
;
200 if (contact
->common
.etag
)
201 free(contact
->common
.etag
);
202 contact
->common
.etag
= updated
.common
.etag
;
203 updated
.common
.etag
= NULL
;
206 free(contact
->photo
);
207 contact
->photo
= updated
.photo
;
208 updated
.photo
= NULL
;
210 /* Cleanup updated contact */
211 gcal_destroy_contact(&updated
);
217 int gcal_update_contact(gcal_t gcalobj
, gcal_contact_t contact
)
220 struct gcal_contact updated
;
221 gcal_init_contact(&updated
);
223 if ((!gcalobj
) || (!contact
))
227 result
= gcal_edit_contact(gcalobj
, contact
, &updated
);
231 /* Swap updated fields: updated, edit_uri, etag */
232 if (contact
->common
.updated
)
233 free(contact
->common
.updated
);
234 contact
->common
.updated
= updated
.common
.updated
;
235 updated
.common
.updated
= NULL
;
237 if (contact
->common
.edit_uri
)
238 free(contact
->common
.edit_uri
);
239 contact
->common
.edit_uri
= updated
.common
.edit_uri
;
240 updated
.common
.edit_uri
= NULL
;
242 if (contact
->common
.etag
)
243 free(contact
->common
.etag
);
244 contact
->common
.etag
= updated
.common
.etag
;
245 updated
.common
.etag
= NULL
;
248 free(contact
->photo
);
249 contact
->photo
= updated
.photo
;
250 updated
.photo
= NULL
;
252 /* Cleanup updated contact */
253 gcal_destroy_contact(&updated
);
259 int gcal_erase_contact(gcal_t gcalobj
, gcal_contact_t contact
)
262 if ((!gcalobj
) || (!contact
))
265 result
= gcal_delete_contact(gcalobj
, contact
);
270 int gcal_get_updated_contacts(gcal_t gcal_obj
,
271 struct gcal_contact_array
*contacts
,
276 contacts
->length
= 0;
278 if ((!gcal_obj
) || (!contacts
))
281 result
= gcal_query_updated(gcal_obj
, timestamp
, "GData-Version: 3.0");
283 contacts
->entries
= NULL
;
284 contacts
->length
= 0;
288 contacts
->entries
= gcal_get_all_contacts(gcal_obj
, &contacts
->length
);
289 if (contacts
->entries
)
295 gcal_contact_t
gcal_contact_element(struct gcal_contact_array
*contacts
,
299 struct gcal_contact
*contact
= NULL
;
300 if ((!contacts
) || (_index
> (contacts
->length
- 1)) ||
301 (contacts
->length
== 0))
304 contact
= &contacts
->entries
[_index
];
308 char *gcal_contact_get_xml(gcal_contact_t contact
)
312 return gcal_get_xml(&(contact
->common
));
315 char *gcal_contact_get_id(gcal_contact_t contact
)
319 return gcal_get_id(&(contact
->common
));
322 char *gcal_contact_get_updated(gcal_contact_t contact
)
326 return gcal_get_updated(&(contact
->common
));
329 char *gcal_contact_get_title(gcal_contact_t contact
)
333 return gcal_get_title(&(contact
->common
));
336 char *gcal_contact_get_url(gcal_contact_t contact
)
340 return gcal_get_url(&(contact
->common
));
343 char *gcal_contact_get_etag(gcal_contact_t contact
)
347 return gcal_get_etag(&(contact
->common
));
350 char gcal_contact_is_deleted(gcal_contact_t contact
)
354 return gcal_get_deleted(&(contact
->common
));
358 /* This are the fields unique to contacts */
359 int gcal_contact_get_emails_count(gcal_contact_t contact
)
363 return contact
->emails_nr
;
366 int gcal_contact_get_pref_email(gcal_contact_t contact
)
370 return contact
->pref_email
;
373 char *gcal_contact_get_email_address(gcal_contact_t contact
, int i
)
377 if (!(contact
->emails_field
) || (i
>= contact
->emails_nr
))
379 return contact
->emails_field
[i
];
382 gcal_email_type
gcal_contact_get_email_address_type(gcal_contact_t contact
, int i
)
384 gcal_email_type result
= E_INVALID
;
389 if (!(contact
->emails_type
) || (i
>= contact
->emails_nr
))
391 for (j
= 0; j
< E_ITEMS_COUNT
; j
++)
392 if (!strcmp(contact
->emails_type
[i
], gcal_email_type_str
[j
]))
397 char *gcal_contact_get_content(gcal_contact_t contact
)
401 return contact
->content
;
404 char *gcal_contact_get_nickname(gcal_contact_t contact
)
408 return contact
->nickname
;
411 char *gcal_contact_get_organization(gcal_contact_t contact
)
415 return contact
->org_name
;
418 char *gcal_contact_get_profission(gcal_contact_t contact
)
422 return contact
->org_title
;
425 char *gcal_contact_get_occupation(gcal_contact_t contact
)
429 return contact
->occupation
;
432 char *gcal_contact_get_im(gcal_contact_t contact
)
439 char *gcal_contact_get_homepage(gcal_contact_t contact
)
443 return contact
->homepage
;
446 char *gcal_contact_get_blog(gcal_contact_t contact
)
450 return contact
->blog
;
453 int gcal_contact_get_phone_numbers_count(gcal_contact_t contact
)
457 return contact
->phone_numbers_nr
;
460 char *gcal_contact_get_phone_number(gcal_contact_t contact
, int i
)
464 if (!(contact
->phone_numbers_field
) || (i
>= contact
->phone_numbers_nr
))
466 return contact
->phone_numbers_field
[i
];
469 gcal_phone_type
gcal_contact_get_phone_number_type(gcal_contact_t contact
, int i
)
471 gcal_phone_type result
= P_INVALID
;
476 if (!(contact
->phone_numbers_type
) || (i
>= contact
->phone_numbers_nr
))
478 for (j
= 0; j
< P_ITEMS_COUNT
; j
++)
479 if (!strcmp(contact
->phone_numbers_type
[i
], gcal_phone_type_str
[j
]))
484 gcal_structured_subvalues_t
gcal_contact_get_structured_name(gcal_contact_t contact
)
486 if ((!contact
) || (!contact
->structured_name
))
488 return contact
->structured_name
;
491 char *gcal_contact_get_address(gcal_contact_t contact
)
495 return contact
->post_address
;
498 gcal_structured_subvalues_t
gcal_contact_get_structured_address(gcal_contact_t contact
)
500 if ((!contact
) || (!contact
->structured_address
))
502 return contact
->structured_address
;
505 int gcal_contact_get_structured_address_count(gcal_contact_t contact
)
509 return contact
->structured_address_nr
;
512 int *gcal_contact_get_structured_address_count_obj(gcal_contact_t contact
)
516 return &contact
->structured_address_nr
;
519 char *gcal_contact_get_structured_entry(gcal_structured_subvalues_t structured_entry
,
520 int structured_entry_nr
,
521 int structured_entry_count
,
522 const char *field_key
)
524 struct gcal_structured_subvalues
*temp_structured_entry
;
526 if(field_key
== NULL
)
529 if (!structured_entry
|| (structured_entry_nr
>= structured_entry_count
))
532 for (temp_structured_entry
= structured_entry
;
533 temp_structured_entry
!= NULL
;
534 temp_structured_entry
= temp_structured_entry
->next_field
) {
536 if (temp_structured_entry
->next_field
!= NULL
) {
537 if (!strcmp(temp_structured_entry
->field_key
, field_key
)
538 && (temp_structured_entry
->field_typenr
== structured_entry_nr
)) {
539 return temp_structured_entry
->field_value
;
547 char ***gcal_contact_get_structured_address_type_obj(gcal_contact_t contact
)
551 return &contact
->structured_address_type
;
554 gcal_address_type
gcal_contact_get_structured_address_type(gcal_contact_t contact
,
555 int structured_entry_nr
,
556 int structured_entry_count
)
558 gcal_address_type result
= A_INVALID
;
564 if (!(contact
->structured_address_type
) ||
565 (structured_entry_nr
>= structured_entry_count
))
568 for (j
= 0; j
< A_ITEMS_COUNT
; j
++)
569 if (!strcmp(contact
->structured_address_type
[structured_entry_nr
], gcal_address_type_str
[j
]))
575 int gcal_contact_get_groupMembership_count(gcal_contact_t contact
)
579 return contact
->groupMembership_nr
;
582 char *gcal_contact_get_groupMembership(gcal_contact_t contact
, int i
)
586 if (!(contact
->groupMembership
) || (i
>= contact
->groupMembership_nr
))
588 return contact
->groupMembership
[i
];
591 char *gcal_contact_get_photo(gcal_contact_t contact
)
596 return contact
->photo_data
;
599 unsigned int gcal_contact_get_photolength(gcal_contact_t contact
)
604 return contact
->photo_length
;
607 char *gcal_contact_get_birthday(gcal_contact_t contact
)
611 return contact
->birthday
;
614 /* Here starts the gcal_contact setters */
615 int gcal_contact_set_title(gcal_contact_t contact
, const char *field
)
619 if ((!contact
) || (!field
))
622 if (contact
->common
.title
)
623 free(contact
->common
.title
);
625 contact
->common
.title
= strdup(field
);
626 if (contact
->common
.title
)
632 int gcal_contact_delete_email_addresses(gcal_contact_t contact
)
640 if (contact
->emails_nr
> 0) {
641 for (temp
= 0; temp
< contact
->emails_nr
; temp
++) {
642 if (contact
->emails_field
[temp
])
643 free(contact
->emails_field
[temp
]);
644 if (contact
->emails_type
[temp
])
645 free(contact
->emails_type
[temp
]);
648 free(contact
->emails_field
);
649 free(contact
->emails_type
);
652 contact
->emails_nr
= contact
->pref_email
= 0;
653 contact
->emails_field
= contact
->emails_type
= 0;
660 int gcal_contact_add_email_address(gcal_contact_t contact
, const char *field
,
661 gcal_email_type type
, int pref
)
665 if ((!contact
) || (!field
) || (type
<0) || (type
>=E_ITEMS_COUNT
))
668 contact
->emails_field
= (char**) realloc(contact
->emails_field
,
669 (contact
->emails_nr
+1) *
672 contact
->emails_field
[contact
->emails_nr
] = strdup(field
);
674 contact
->emails_type
= (char**) realloc(contact
->emails_type
,
675 (contact
->emails_nr
+1) *
678 contact
->emails_type
[contact
->emails_nr
] = strdup(gcal_email_type_str
[type
]);
681 contact
->pref_email
= contact
->emails_nr
;
683 contact
->emails_nr
++;
690 int gcal_contact_set_url(gcal_contact_t contact
, const char *field
)
694 if ((!contact
) || (!field
))
697 if (contact
->common
.edit_uri
)
698 free(contact
->common
.edit_uri
);
700 contact
->common
.edit_uri
= strdup(field
);
701 if (contact
->common
.edit_uri
)
708 int gcal_contact_set_id(gcal_contact_t contact
, const char *field
)
712 if ((!contact
) || (!field
))
715 if (contact
->common
.id
)
716 free(contact
->common
.id
);
718 contact
->common
.id
= strdup(field
);
719 if (contact
->common
.id
)
726 int gcal_contact_set_etag(gcal_contact_t contact
, const char *field
)
730 if ((!contact
) || (!field
))
733 if (contact
->common
.etag
)
734 free(contact
->common
.etag
);
736 contact
->common
.etag
= strdup(field
);
737 if (contact
->common
.etag
)
743 int gcal_contact_delete_phone_numbers(gcal_contact_t contact
)
751 if (contact
->phone_numbers_nr
> 0) {
752 for (temp
= 0; temp
< contact
->phone_numbers_nr
; temp
++) {
753 if (contact
->phone_numbers_field
[temp
])
754 free(contact
->phone_numbers_field
[temp
]);
755 if (contact
->phone_numbers_type
[temp
])
756 free(contact
->phone_numbers_type
[temp
]);
759 free(contact
->phone_numbers_field
);
760 free(contact
->phone_numbers_type
);
763 contact
->phone_numbers_nr
= 0;
770 int gcal_contact_add_phone_number(gcal_contact_t contact
, const char *field
,
771 gcal_phone_type type
)
775 if ((!contact
) || (!field
) || (type
<0) || (type
>=P_ITEMS_COUNT
))
778 contact
->phone_numbers_field
= (char**) realloc(contact
->phone_numbers_field
, (contact
->phone_numbers_nr
+1) * sizeof(char*));
779 contact
->phone_numbers_field
[contact
->phone_numbers_nr
] = strdup(field
);
781 contact
->phone_numbers_type
= (char**) realloc(contact
->phone_numbers_type
, (contact
->phone_numbers_nr
+1) * sizeof(char*));
782 contact
->phone_numbers_type
[contact
->phone_numbers_nr
] = strdup(gcal_phone_type_str
[type
]);
784 contact
->phone_numbers_nr
++;
791 int gcal_contact_set_address(gcal_contact_t contact
, const char *field
)
795 if ((!contact
) || (!field
))
798 if (contact
->post_address
)
799 free(contact
->post_address
);
801 contact
->post_address
= strdup(field
);
802 if (contact
->post_address
)
808 int gcal_contact_set_structured_address_nr(gcal_contact_t contact
,
809 gcal_address_type type
)
811 int entry_nr
, result
= -1;
813 if (!contact
|| (type
< 0) || (type
>= A_ITEMS_COUNT
))
816 entry_nr
= contact
->structured_address_nr
;
817 contact
->structured_address_type
= (char**) realloc(contact
->structured_address_type
, (entry_nr
+ 1) * sizeof(char*));
818 contact
->structured_address_type
[entry_nr
] = strdup(gcal_address_type_str
[type
]);
819 contact
->structured_address_nr
++;
826 int gcal_contact_set_structured_entry(gcal_structured_subvalues_t structured_entry
,
827 int structured_entry_nr
,
828 int structured_entry_count
,
829 const char *field_key
,
830 const char *field_value
)
832 struct gcal_structured_subvalues
*temp_structured_entry
;
834 if (!structured_entry
|| (!field_value
) || (!field_key
) ||
835 (structured_entry_nr
< 0) ||
836 (structured_entry_nr
>= structured_entry_count
))
839 if (field_value
== NULL
)
842 if (structured_entry
->field_key
== NULL
) {
843 structured_entry
->field_typenr
= structured_entry_nr
;
844 structured_entry
->field_key
= strdup(field_key
);
845 structured_entry
->field_value
= strdup(field_value
);
846 structured_entry
->next_field
= NULL
;
850 for (temp_structured_entry
= structured_entry
; temp_structured_entry
; temp_structured_entry
= temp_structured_entry
->next_field
) {
851 if (!strcmp(temp_structured_entry
->field_key
,field_key
) &&
852 (temp_structured_entry
->field_typenr
== structured_entry_nr
)) {
853 if (temp_structured_entry
->field_value
!= NULL
) {
854 free(temp_structured_entry
->field_value
);
855 temp_structured_entry
->field_value
= strdup(field_value
);
860 if (temp_structured_entry
->next_field
== NULL
) {
861 temp_structured_entry
->next_field
= (struct gcal_structured_subvalues
*)malloc(sizeof(struct gcal_structured_subvalues
));
862 temp_structured_entry
= temp_structured_entry
->next_field
;
864 temp_structured_entry
->field_typenr
= structured_entry_nr
;
865 temp_structured_entry
->field_key
= strdup(field_key
);
866 temp_structured_entry
->field_value
= strdup(field_value
);
867 temp_structured_entry
->next_field
= NULL
;
875 int gcal_contact_delete_structured_entry(gcal_structured_subvalues_t structured_entry
,
876 int *structured_entry_count
,
877 char ***structured_entry_type
)
880 struct gcal_structured_subvalues
*temp_structured_entry
;
882 if (!structured_entry
)
885 for (temp_structured_entry
= structured_entry
;
886 temp_structured_entry
!= NULL
;
887 temp_structured_entry
= temp_structured_entry
->next_field
) {
889 if (temp_structured_entry
->field_typenr
)
890 temp_structured_entry
->field_typenr
= 0;
891 if (temp_structured_entry
->field_key
)
892 free(temp_structured_entry
->field_key
);
893 if (temp_structured_entry
->field_value
)
894 free(temp_structured_entry
->field_value
);
897 if (structured_entry_count
&& structured_entry_type
) {
898 if ((*structured_entry_count
) > 0) {
899 for (i
= 0; i
< (*structured_entry_count
); i
++)
900 if ((*structured_entry_type
)[i
])
901 free((*structured_entry_type
)[i
]);
902 free((*structured_entry_type
));
905 (*structured_entry_count
) = 0;
912 int gcal_contact_delete_groupMembership(gcal_contact_t contact
)
920 if (contact
->groupMembership_nr
> 0) {
921 for (temp
= 0; temp
< contact
->groupMembership_nr
; temp
++) {
922 if (contact
->groupMembership
[temp
])
923 free(contact
->groupMembership
[temp
]);
926 free(contact
->groupMembership
);
929 contact
->groupMembership_nr
= 0;
934 int gcal_contact_add_groupMembership(gcal_contact_t contact
, char *field
)
938 if ((!contact
) || (!field
))
941 contact
->groupMembership
= (char**) realloc(contact
->groupMembership
, (contact
->groupMembership_nr
+1) * sizeof(char*));
942 contact
->groupMembership
[contact
->groupMembership_nr
] = strdup(field
);
944 contact
->groupMembership_nr
++;
951 int gcal_contact_set_profission(gcal_contact_t contact
, const char *field
)
955 if ((!contact
) || (!field
))
958 if (contact
->org_title
)
959 free(contact
->org_title
);
961 contact
->org_title
= strdup(field
);
962 if (contact
->org_title
)
969 int gcal_contact_set_organization(gcal_contact_t contact
, const char *field
)
973 if ((!contact
) || (!field
))
976 if (contact
->org_name
)
977 free(contact
->org_name
);
979 contact
->org_name
= strdup(field
);
980 if (contact
->org_name
)
986 int gcal_contact_set_occupation(gcal_contact_t contact
, const char *field
)
990 if ((!contact
) || (!field
))
993 if (contact
->occupation
)
994 free(contact
->occupation
);
996 contact
->occupation
= strdup(field
);
997 if (contact
->occupation
)
1003 int gcal_contact_set_content(gcal_contact_t contact
, const char *field
)
1007 if ((!contact
) || (!field
))
1010 if (contact
->content
)
1011 free(contact
->content
);
1013 contact
->content
= strdup(field
);
1014 if (contact
->content
)
1020 int gcal_contact_set_nickname(gcal_contact_t contact
, const char *field
)
1024 if ((!contact
) || (!field
))
1027 if (contact
->nickname
)
1028 free(contact
->nickname
);
1030 contact
->nickname
= strdup(field
);
1031 if (contact
->nickname
)
1037 int gcal_contact_set_photo(gcal_contact_t contact
, const char *field
,
1042 if ((!contact
) || (!field
))
1045 if (contact
->photo_data
)
1046 if (contact
->photo_length
> 1)
1047 free(contact
->photo_data
);
1049 if (!(contact
->photo_data
= malloc(length
* sizeof(unsigned char))))
1052 memcpy(contact
->photo_data
, field
, length
);
1053 contact
->photo_length
= length
;
1059 int gcal_contact_set_birthday(gcal_contact_t contact
, const char *field
)
1063 if ((!contact
) || (!field
))
1066 if (contact
->birthday
)
1067 free(contact
->birthday
);
1069 contact
->birthday
= strdup(field
);
1070 if (contact
->birthday
)
1076 int gcal_contact_set_homepage(gcal_contact_t contact
, const char *field
)
1080 if ((!contact
) || (!field
))
1083 if (contact
->homepage
)
1084 free(contact
->homepage
);
1086 contact
->homepage
= strdup(field
);
1087 if (contact
->homepage
)
1093 int gcal_contact_set_blog(gcal_contact_t contact
, const char *field
)
1097 if ((!contact
) || (!field
))
1101 free(contact
->blog
);
1103 contact
->blog
= strdup(field
);