4 * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include "ctsvc_internal.h"
22 #include "ctsvc_list.h"
23 #include "ctsvc_record.h"
24 #include "ctsvc_view.h"
26 static int __ctsvc_my_profile_create(contacts_record_h *out_record);
27 static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_child);
28 static int __ctsvc_my_profile_clone(contacts_record_h record, contacts_record_h *out_record);
29 static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int property_id, int *out);
30 static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
31 static int __ctsvc_my_profile_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
32 static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
33 static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
34 static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
35 static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
36 static int __ctsvc_my_profile_get_child_record_count(contacts_record_h record, unsigned int property_id, int *count);
37 static int __ctsvc_my_profile_add_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
38 static int __ctsvc_my_profile_remove_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
40 ctsvc_record_plugin_cb_s my_profile_plugin_cbs = {
41 .create = __ctsvc_my_profile_create,
42 .destroy = __ctsvc_my_profile_destroy,
43 .clone = __ctsvc_my_profile_clone,
44 .get_str = __ctsvc_my_profile_get_str,
45 .get_str_p = __ctsvc_my_profile_get_str_p,
46 .get_int = __ctsvc_my_profile_get_int,
50 .set_str = __ctsvc_my_profile_set_str,
51 .set_int = __ctsvc_my_profile_set_int,
55 .add_child_record = __ctsvc_my_profile_add_child_record,
56 .remove_child_record = __ctsvc_my_profile_remove_child_record,
57 .get_child_record_count = __ctsvc_my_profile_get_child_record_count,
58 .get_child_record_at_p = __ctsvc_my_profile_get_child_record_at_p,
59 .clone_child_record_list = __ctsvc_my_profile_clone_child_record_list,
62 static int __ctsvc_my_profile_create(contacts_record_h *out_record)
64 ctsvc_my_profile_s *my_profile;
66 my_profile = calloc(1, sizeof(ctsvc_my_profile_s));
67 RETVM_IF(NULL == my_profile, CONTACTS_ERROR_OUT_OF_MEMORY,
71 my_profile->name = calloc(1, sizeof(ctsvc_list_s));
72 if (NULL == my_profile->name)
74 my_profile->name->l_type = CTSVC_RECORD_NAME;
76 my_profile->company = calloc(1, sizeof(ctsvc_list_s));
77 if (NULL == my_profile->company)
79 my_profile->company->l_type = CTSVC_RECORD_COMPANY;
81 my_profile->note = calloc(1, sizeof(ctsvc_list_s));
82 if (NULL == my_profile->note)
84 my_profile->note->l_type = CTSVC_RECORD_NOTE;
86 my_profile->numbers = calloc(1, sizeof(ctsvc_list_s));
87 if (NULL == my_profile->numbers)
89 my_profile->numbers->l_type = CTSVC_RECORD_NUMBER;
91 my_profile->emails = calloc(1, sizeof(ctsvc_list_s));
92 if (NULL == my_profile->emails)
94 my_profile->emails->l_type = CTSVC_RECORD_EMAIL;
96 my_profile->events = calloc(1, sizeof(ctsvc_list_s));
97 if (NULL == my_profile->events)
99 my_profile->events->l_type = CTSVC_RECORD_EVENT;
101 my_profile->messengers = calloc(1, sizeof(ctsvc_list_s));
102 if (NULL == my_profile->messengers)
104 my_profile->messengers->l_type = CTSVC_RECORD_MESSENGER;
106 my_profile->postal_addrs = calloc(1, sizeof(ctsvc_list_s));
107 if (NULL == my_profile->postal_addrs)
109 my_profile->postal_addrs->l_type = CTSVC_RECORD_ADDRESS;
111 my_profile->urls = calloc(1, sizeof(ctsvc_list_s));
112 if (NULL == my_profile->urls)
114 my_profile->urls->l_type = CTSVC_RECORD_URL;
116 my_profile->nicknames = calloc(1, sizeof(ctsvc_list_s));
117 if (NULL == my_profile->nicknames)
119 my_profile->nicknames->l_type = CTSVC_RECORD_NICKNAME;
121 my_profile->profiles = calloc(1, sizeof(ctsvc_list_s));
122 if (NULL == my_profile->profiles)
124 my_profile->profiles->l_type = CTSVC_RECORD_PROFILE;
126 my_profile->relationships = calloc(1, sizeof(ctsvc_list_s));
127 if (NULL == my_profile->relationships)
129 my_profile->relationships->l_type = CTSVC_RECORD_RELATIONSHIP;
131 my_profile->images = calloc(1, sizeof(ctsvc_list_s));
132 if (NULL == my_profile->images)
134 my_profile->images->l_type = CTSVC_RECORD_IMAGE;
136 my_profile->extensions = calloc(1, sizeof(ctsvc_list_s));
137 if (NULL == my_profile->extensions)
139 my_profile->extensions->l_type = CTSVC_RECORD_EXTENSION;
141 my_profile->sips = calloc(1, sizeof(ctsvc_list_s));
142 if (NULL == my_profile->sips)
144 my_profile->sips->l_type = CTSVC_RECORD_SIP;
146 *out_record = (contacts_record_h)my_profile;
147 return CONTACTS_ERROR_NONE;
150 ERR("calloc() Fail");
151 free(my_profile->extensions);
152 free(my_profile->images);
153 free(my_profile->relationships);
154 free(my_profile->profiles);
155 free(my_profile->nicknames);
156 free(my_profile->urls);
157 free(my_profile->postal_addrs);
158 free(my_profile->messengers);
159 free(my_profile->events);
160 free(my_profile->emails);
161 free(my_profile->numbers);
162 free(my_profile->note);
163 free(my_profile->company);
164 free(my_profile->name);
165 free(my_profile->sips);
167 return CONTACTS_ERROR_OUT_OF_MEMORY;
170 static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_child)
172 ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
174 /* help to find double destroy bug (refer to the contacts_record_destroy) */
175 my_profile->base.plugin_cbs = NULL;
176 free(my_profile->base.properties_flags);
178 free(my_profile->display_name);
179 free(my_profile->reverse_display_name);
180 free(my_profile->uid);
181 free(my_profile->image_thumbnail_path);
183 contacts_list_destroy((contacts_list_h)my_profile->name, delete_child);
185 contacts_list_destroy((contacts_list_h)my_profile->company, delete_child);
187 contacts_list_destroy((contacts_list_h)my_profile->note, delete_child);
189 contacts_list_destroy((contacts_list_h)my_profile->numbers, delete_child);
191 contacts_list_destroy((contacts_list_h)my_profile->emails, delete_child);
193 contacts_list_destroy((contacts_list_h)my_profile->events, delete_child);
195 contacts_list_destroy((contacts_list_h)my_profile->messengers, delete_child);
197 contacts_list_destroy((contacts_list_h)my_profile->postal_addrs, delete_child);
199 contacts_list_destroy((contacts_list_h)my_profile->urls, delete_child);
201 contacts_list_destroy((contacts_list_h)my_profile->nicknames, delete_child);
203 contacts_list_destroy((contacts_list_h)my_profile->profiles, delete_child);
205 contacts_list_destroy((contacts_list_h)my_profile->relationships, delete_child);
207 contacts_list_destroy((contacts_list_h)my_profile->images, delete_child);
209 contacts_list_destroy((contacts_list_h)my_profile->extensions, delete_child);
211 contacts_list_destroy((contacts_list_h)my_profile->sips, delete_child);
215 return CONTACTS_ERROR_NONE;
218 static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int property_id, int *out)
220 ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
222 switch (property_id) {
223 case CTSVC_PROPERTY_MY_PROFILE_ID:
224 *out = my_profile->id;
226 case CTSVC_PROPERTY_MY_PROFILE_ADDRESSBOOK_ID:
227 *out = my_profile->addressbook_id;
229 case CTSVC_PROPERTY_MY_PROFILE_CHANGED_TIME:
230 *out = my_profile->changed_time;
233 ERR("property_id(%d) is not supported in value(my_profile)", property_id);
234 return CONTACTS_ERROR_INVALID_PARAMETER;
236 return CONTACTS_ERROR_NONE;
239 static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
241 ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
243 switch (property_id) {
244 case CTSVC_PROPERTY_MY_PROFILE_ID:
245 CHECK_DIRTY_VAL(my_profile->id, value, is_dirty);
246 my_profile->id = value;
248 case CTSVC_PROPERTY_MY_PROFILE_CHANGED_TIME:
249 CHECK_DIRTY_VAL(my_profile->changed_time, value, is_dirty);
250 my_profile->changed_time = value;
252 case CTSVC_PROPERTY_MY_PROFILE_ADDRESSBOOK_ID:
253 RETVM_IF(0 < my_profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
254 "property_id(%d) is a read-only value (my_profile)", property_id);
255 CHECK_DIRTY_VAL(my_profile->addressbook_id, value, is_dirty);
256 my_profile->addressbook_id = value;
259 ERR("property_id(%d) is not supported in valuecontact)", property_id);
260 return CONTACTS_ERROR_INVALID_PARAMETER;
262 return CONTACTS_ERROR_NONE;
265 static int __ctsvc_my_profile_get_str_real(contacts_record_h record,
266 unsigned int property_id, char **out_str, bool copy)
268 ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
269 switch (property_id) {
270 case CTSVC_PROPERTY_MY_PROFILE_DISPLAY_NAME:
271 *out_str = GET_STR(copy, my_profile->display_name);
273 case CTSVC_PROPERTY_MY_PROFILE_IMAGE_THUMBNAIL:
274 *out_str = GET_STR(copy, my_profile->image_thumbnail_path);
276 case CTSVC_PROPERTY_MY_PROFILE_UID:
277 *out_str = GET_STR(copy, my_profile->uid);
280 ERR("property_id(%d) is not supported in value(my_profile)", property_id);
281 return CONTACTS_ERROR_INVALID_PARAMETER;
283 return CONTACTS_ERROR_NONE;
286 static int __ctsvc_my_profile_get_str_p(contacts_record_h record,
287 unsigned int property_id, char **out_str)
289 return __ctsvc_my_profile_get_str_real(record, property_id, out_str, false);
292 static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id,
295 return __ctsvc_my_profile_get_str_real(record, property_id, out_str, true);
298 static int __ctsvc_my_profile_get_record_list_p(contacts_record_h record,
299 unsigned int property_id, contacts_list_h *list)
301 ctsvc_my_profile_s *contact = (ctsvc_my_profile_s*)record;
303 switch (property_id) {
304 case CTSVC_PROPERTY_MY_PROFILE_NAME:
305 *list = (contacts_list_h)contact->name;
307 case CTSVC_PROPERTY_MY_PROFILE_COMPANY:
308 *list = (contacts_list_h)contact->company;
310 case CTSVC_PROPERTY_MY_PROFILE_NOTE:
311 *list = (contacts_list_h)contact->note;
313 case CTSVC_PROPERTY_MY_PROFILE_NUMBER:
314 *list = (contacts_list_h)contact->numbers;
316 case CTSVC_PROPERTY_MY_PROFILE_EMAIL:
317 *list = (contacts_list_h)contact->emails;
319 case CTSVC_PROPERTY_MY_PROFILE_EVENT:
320 *list = (contacts_list_h)contact->events;
322 case CTSVC_PROPERTY_MY_PROFILE_MESSENGER:
323 *list = (contacts_list_h)contact->messengers;
325 case CTSVC_PROPERTY_MY_PROFILE_ADDRESS:
326 *list = (contacts_list_h)contact->postal_addrs;
328 case CTSVC_PROPERTY_MY_PROFILE_URL:
329 *list = (contacts_list_h)contact->urls;
331 case CTSVC_PROPERTY_MY_PROFILE_NICKNAME:
332 *list = (contacts_list_h)contact->nicknames;
334 case CTSVC_PROPERTY_MY_PROFILE_PROFILE:
335 *list = (contacts_list_h)contact->profiles;
337 case CTSVC_PROPERTY_MY_PROFILE_RELATIONSHIP:
338 *list = (contacts_list_h)contact->relationships;
340 case CTSVC_PROPERTY_MY_PROFILE_IMAGE:
341 *list = (contacts_list_h)contact->images;
343 case CTSVC_PROPERTY_MY_PROFILE_EXTENSION:
344 *list = (contacts_list_h)contact->extensions;
346 case CTSVC_PROPERTY_MY_PROFILE_SIP:
347 *list = (contacts_list_h)contact->sips;
350 ERR("property_id(%d) is not supported in value(contact)", property_id);
351 return CONTACTS_ERROR_INVALID_PARAMETER;
353 return CONTACTS_ERROR_NONE;
356 static int __ctsvc_my_profile_get_child_record_count(contacts_record_h record,
357 unsigned int property_id, int *count)
360 contacts_list_h list = NULL;
363 ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
364 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
368 contacts_list_get_count(list, count);
370 return CONTACTS_ERROR_NONE;
373 static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record,
374 unsigned int property_id, int index, contacts_record_h *out_record)
378 contacts_list_h list = NULL;
380 ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
381 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
384 contacts_list_get_count(list, &count);
386 ERR("The index(%d) is greather than total length(%d)", index, count);
388 return CONTACTS_ERROR_NO_DATA;
390 return ctsvc_list_get_nth_record_p(list, index, out_record);
394 static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record,
395 unsigned int property_id, contacts_list_h *out_list)
399 contacts_list_h list = NULL;
401 ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
402 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
405 contacts_list_get_count(list, &count);
408 return CONTACTS_ERROR_NO_DATA;
410 ctsvc_list_clone(list, out_list);
412 return CONTACTS_ERROR_NONE;
415 static int __ctsvc_my_profile_reset_child_record_id(contacts_record_h child_record)
417 ctsvc_record_s *record = (ctsvc_record_s*)child_record;
419 switch (record->r_type) {
420 case CTSVC_RECORD_NAME:
421 ((ctsvc_name_s*)record)->id = 0;
423 case CTSVC_RECORD_COMPANY:
424 ((ctsvc_company_s*)record)->id = 0;
426 case CTSVC_RECORD_NOTE:
427 ((ctsvc_note_s*)record)->id = 0;
429 case CTSVC_RECORD_NUMBER:
430 ((ctsvc_number_s*)record)->id = 0;
432 case CTSVC_RECORD_EMAIL:
433 ((ctsvc_email_s*)record)->id = 0;
435 case CTSVC_RECORD_URL:
436 ((ctsvc_url_s*)record)->id = 0;
438 case CTSVC_RECORD_EVENT:
439 ((ctsvc_event_s*)record)->id = 0;
441 case CTSVC_RECORD_NICKNAME:
442 ((ctsvc_nickname_s*)record)->id = 0;
444 case CTSVC_RECORD_ADDRESS:
445 ((ctsvc_address_s*)record)->id = 0;
447 case CTSVC_RECORD_MESSENGER:
448 ((ctsvc_messenger_s*)record)->id = 0;
450 case CTSVC_RECORD_GROUP_RELATION:
451 ((ctsvc_group_relation_s*)record)->id = 0;
453 case CTSVC_RECORD_ACTIVITY:
454 ((ctsvc_activity_s*)record)->id = 0;
456 case CTSVC_RECORD_PROFILE:
457 ((ctsvc_profile_s*)record)->id = 0;
459 case CTSVC_RECORD_RELATIONSHIP:
460 ((ctsvc_relationship_s*)record)->id = 0;
462 case CTSVC_RECORD_IMAGE:
463 ((ctsvc_image_s*)record)->id = 0;
465 case CTSVC_RECORD_EXTENSION:
466 ((ctsvc_extension_s*)record)->id = 0;
468 case CTSVC_RECORD_SIP:
469 ((ctsvc_sip_s *)record)->id = 0;
472 ERR("record(%d) is not child of contact", record->r_type);
473 return CONTACTS_ERROR_INVALID_PARAMETER;
475 return CONTACTS_ERROR_NONE;
479 static int __ctsvc_my_profile_add_child_record(contacts_record_h record,
480 unsigned int property_id, contacts_record_h child_record)
483 contacts_list_h list = NULL;
484 ctsvc_record_s *s_record = (ctsvc_record_s*)child_record;
486 ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
487 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
490 if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) {
491 ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
492 return CONTACTS_ERROR_INVALID_PARAMETER;
495 if (CTSVC_RECORD_IMAGE == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) {
496 ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
497 return CONTACTS_ERROR_INVALID_PARAMETER;
500 ret = __ctsvc_my_profile_reset_child_record_id(child_record);
501 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
504 ctsvc_list_add_child(list, child_record);
506 return CONTACTS_ERROR_NONE;
509 static int __ctsvc_my_profile_get_child_record_id(contacts_record_h child_record)
511 ctsvc_record_s *record = (ctsvc_record_s*)child_record;
513 switch (record->r_type) {
514 case CTSVC_RECORD_NAME:
515 return ((ctsvc_name_s*)record)->id;
516 case CTSVC_RECORD_COMPANY:
517 return ((ctsvc_company_s*)record)->id;
518 case CTSVC_RECORD_NOTE:
519 return ((ctsvc_note_s*)record)->id;
520 case CTSVC_RECORD_NUMBER:
521 return ((ctsvc_number_s*)record)->id;
522 case CTSVC_RECORD_EMAIL:
523 return ((ctsvc_email_s*)record)->id;
524 case CTSVC_RECORD_URL:
525 return ((ctsvc_url_s*)record)->id;
526 case CTSVC_RECORD_EVENT:
527 return ((ctsvc_event_s*)record)->id;
528 case CTSVC_RECORD_NICKNAME:
529 return ((ctsvc_nickname_s*)record)->id;
530 case CTSVC_RECORD_ADDRESS:
531 return ((ctsvc_address_s*)record)->id;
532 case CTSVC_RECORD_MESSENGER:
533 return ((ctsvc_messenger_s*)record)->id;
534 case CTSVC_RECORD_GROUP_RELATION:
535 return ((ctsvc_group_relation_s*)record)->id;
536 case CTSVC_RECORD_ACTIVITY:
537 return ((ctsvc_activity_s*)record)->id;
538 case CTSVC_RECORD_PROFILE:
539 return ((ctsvc_profile_s*)record)->id;
540 case CTSVC_RECORD_RELATIONSHIP:
541 return ((ctsvc_relationship_s*)record)->id;
542 case CTSVC_RECORD_IMAGE:
543 return ((ctsvc_image_s*)record)->id;
544 case CTSVC_RECORD_EXTENSION:
545 return ((ctsvc_extension_s*)record)->id;
546 case CTSVC_RECORD_SIP:
547 return ((ctsvc_sip_s *)record)->id;
549 ERR("record(%d) is not child of contact", record->r_type);
556 static int __ctsvc_my_profile_remove_child_record(contacts_record_h record,
557 unsigned int property_id, contacts_record_h child_record)
561 contacts_list_h list = NULL;
563 ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
564 if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
567 id = __ctsvc_my_profile_get_child_record_id(child_record);
568 ctsvc_list_remove_child(list, child_record, id ? true : false);
570 return CONTACTS_ERROR_NONE;
573 static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id,
574 const char *str, bool *is_dirty)
576 ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
578 switch (property_id) {
579 case CTSVC_PROPERTY_MY_PROFILE_DISPLAY_NAME:
580 CHECK_DIRTY_STR(my_profile->display_name, str, is_dirty);
581 FREEandSTRDUP(my_profile->display_name, str);
583 case CTSVC_PROPERTY_MY_PROFILE_IMAGE_THUMBNAIL:
584 CHECK_DIRTY_STR(my_profile->image_thumbnail_path, str, is_dirty);
585 FREEandSTRDUP(my_profile->image_thumbnail_path, str);
587 case CTSVC_PROPERTY_MY_PROFILE_UID:
588 CHECK_DIRTY_STR(my_profile->uid, str, is_dirty);
589 FREEandSTRDUP(my_profile->uid, str);
592 ERR("property_id(%d) is not supported in value(my_profile)", property_id);
593 return CONTACTS_ERROR_INVALID_PARAMETER;
595 return CONTACTS_ERROR_NONE;
598 static int __ctsvc_my_profile_clone(contacts_record_h record,
599 contacts_record_h *out_record)
601 ctsvc_my_profile_s *out_data = NULL;
602 ctsvc_my_profile_s *src_data = NULL;
604 src_data = (ctsvc_my_profile_s*)record;
605 out_data = calloc(1, sizeof(ctsvc_my_profile_s));
606 RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
608 out_data->id = src_data->id;
609 out_data->addressbook_id = src_data->addressbook_id;
610 out_data->changed_time = src_data->changed_time;
612 out_data->display_name = SAFE_STRDUP(src_data->display_name);
613 out_data->reverse_display_name = SAFE_STRDUP(src_data->reverse_display_name);
614 out_data->uid = SAFE_STRDUP(src_data->uid);
615 out_data->image_thumbnail_path = SAFE_STRDUP(src_data->image_thumbnail_path);
617 ctsvc_list_clone((contacts_list_h)src_data->name, (contacts_list_h*)&out_data->name);
618 out_data->name->l_type = CTSVC_RECORD_NAME;
620 ctsvc_list_clone((contacts_list_h)src_data->company, (contacts_list_h*)&out_data->company);
621 out_data->company->l_type = CTSVC_RECORD_COMPANY;
623 ctsvc_list_clone((contacts_list_h)src_data->note, (contacts_list_h*)&out_data->note);
624 out_data->note->l_type = CTSVC_RECORD_NOTE;
626 ctsvc_list_clone((contacts_list_h)src_data->numbers, (contacts_list_h*)&out_data->numbers);
627 out_data->numbers->l_type = CTSVC_RECORD_NUMBER;
629 ctsvc_list_clone((contacts_list_h)src_data->emails, (contacts_list_h*)&out_data->emails);
630 out_data->emails->l_type = CTSVC_RECORD_EMAIL;
632 ctsvc_list_clone((contacts_list_h)src_data->events, (contacts_list_h*)&out_data->events);
633 out_data->events->l_type = CTSVC_RECORD_EVENT;
635 ctsvc_list_clone((contacts_list_h)src_data->messengers, (contacts_list_h*)&out_data->messengers);
636 out_data->messengers->l_type = CTSVC_RECORD_MESSENGER;
638 ctsvc_list_clone((contacts_list_h)src_data->postal_addrs, (contacts_list_h*)&out_data->postal_addrs);
639 out_data->postal_addrs->l_type = CTSVC_RECORD_ADDRESS;
641 ctsvc_list_clone((contacts_list_h)src_data->urls, (contacts_list_h*)&out_data->urls);
642 out_data->urls->l_type = CTSVC_RECORD_URL;
644 ctsvc_list_clone((contacts_list_h)src_data->nicknames, (contacts_list_h*)&out_data->nicknames);
645 out_data->nicknames->l_type = CTSVC_RECORD_NICKNAME;
647 ctsvc_list_clone((contacts_list_h)src_data->profiles, (contacts_list_h*)&out_data->profiles);
648 out_data->profiles->l_type = CTSVC_RECORD_PROFILE;
650 ctsvc_list_clone((contacts_list_h)src_data->relationships, (contacts_list_h*)&out_data->relationships);
651 out_data->relationships->l_type = CTSVC_RECORD_RELATIONSHIP;
653 ctsvc_list_clone((contacts_list_h)src_data->images, (contacts_list_h*)&out_data->images);
654 out_data->images->l_type = CTSVC_RECORD_IMAGE;
656 ctsvc_list_clone((contacts_list_h)src_data->extensions, (contacts_list_h*)&out_data->extensions);
657 out_data->extensions->l_type = CTSVC_RECORD_EXTENSION;
659 ctsvc_list_clone((contacts_list_h)src_data->sips, (contacts_list_h*)&out_data->sips);
660 out_data->sips->l_type = CTSVC_RECORD_SIP;
662 int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
663 if (CONTACTS_ERROR_NONE != ret) {
664 ERR("ctsvc_record_copy_base() Fail");
665 __ctsvc_my_profile_destroy((contacts_record_h)out_data, true);
669 *out_record = (contacts_record_h)out_data;
671 return CONTACTS_ERROR_NONE;