void couchdb_document_contact_set_urls (CouchdbDocumentContact *document, GSList *list) { GSList *l; JsonObject *urls_json; g_return_if_fail (COUCHDB_IS_DOCUMENT_CONTACT (document)); urls_json = json_object_new (); for (l = list; l != NULL; l = l->next) { const gchar *address_str; CouchdbStructField *sf = (CouchdbStructField *) l->data; address_str = couchdb_document_contact_url_get_address (sf); if (address_str) { JsonObject *this_url; this_url = json_object_new (); json_object_set_string_member (this_url, "address", address_str); json_object_set_string_member (this_url, "description", couchdb_document_contact_url_get_description (sf)); json_object_set_object_member (urls_json, couchdb_struct_field_get_uuid (sf), this_url); } } json_object_set_object_member (couchdb_document_get_json_object (COUCHDB_DOCUMENT (document)), "urls", urls_json); }
void couchdb_document_contact_set_phone_numbers (CouchdbDocumentContact *document, GSList *list) { GSList *l; JsonObject *phone_numbers; g_return_if_fail (COUCHDB_IS_DOCUMENT_CONTACT (document)); phone_numbers = json_object_new (); for (l = list; l != NULL; l = l->next) { const gchar *number_str; CouchdbStructField *sf = (CouchdbStructField *) l->data; number_str = couchdb_document_contact_phone_get_number (sf); if (number_str) { JsonObject *this_phone; this_phone = json_object_new (); json_object_set_string_member (this_phone, "number", number_str); json_object_set_string_member (this_phone, "description", couchdb_document_contact_phone_get_description (sf)); json_object_set_int_member (this_phone, "priority", couchdb_document_contact_phone_get_priority (sf)); json_object_set_object_member (phone_numbers, couchdb_struct_field_get_uuid (sf), this_phone); } } json_object_set_object_member (couchdb_document_get_json_object (COUCHDB_DOCUMENT (document)), "phone_numbers", phone_numbers); }
void desktopcouch_document_contact_set_im_addresses (CouchdbDocument *document, GSList *list) { GSList *l; JsonObject *im_addresses_json; g_return_if_fail (COUCHDB_IS_DOCUMENT (document)); im_addresses_json = json_object_new (); for (l = list; l != NULL; l = l->next) { const gchar *address_str; CouchdbStructField *sf = (CouchdbStructField *) l->data; address_str = desktopcouch_document_contact_im_get_address (sf); if (address_str != NULL) { JsonObject *this_address; this_address = json_object_new (); json_object_set_string_member (this_address, "address", address_str); json_object_set_string_member (this_address, "description", desktopcouch_document_contact_im_get_description (sf)); json_object_set_string_member (this_address, "protocol", desktopcouch_document_contact_im_get_protocol (sf)); json_object_set_object_member (im_addresses_json, couchdb_struct_field_get_uuid (sf), this_address); } } json_object_set_object_member (couchdb_document_get_json_object (document), "im_addresses", im_addresses_json); }
void couchdb_document_contact_set_addresses (CouchdbDocumentContact *document, GSList *list) { GSList *l; JsonObject *addresses; g_return_if_fail (COUCHDB_IS_DOCUMENT_CONTACT (document)); addresses = json_object_new (); for (l = list; l != NULL; l = l->next) { const gchar *street_str; CouchdbStructField *sf = (CouchdbStructField *) l->data; street_str = couchdb_document_contact_address_get_street (sf); if (street_str) { JsonObject *this_address; this_address = json_object_new (); json_object_set_string_member (this_address, "address1", street_str); json_object_set_string_member (this_address, "address2", couchdb_document_contact_address_get_ext_street (sf)); json_object_set_string_member (this_address, "city", couchdb_document_contact_address_get_city (sf)); json_object_set_string_member (this_address, "state", couchdb_document_contact_address_get_state (sf)); json_object_set_string_member (this_address, "country", couchdb_document_contact_address_get_country (sf)); json_object_set_string_member (this_address, "postalcode", couchdb_document_contact_address_get_postalcode (sf)); json_object_set_string_member (this_address, "pobox", couchdb_document_contact_address_get_pobox (sf)); json_object_set_string_member (this_address, "description", couchdb_document_contact_address_get_description (sf)); json_object_set_object_member (addresses, couchdb_struct_field_get_uuid (sf), this_address); } } json_object_set_object_member (couchdb_document_get_json_object (COUCHDB_DOCUMENT (document)), "addresses", addresses); }