4 * Copyright (c) 2000 - 2012 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.
23 #ifdef ENABLE_LOG_FEATURE
24 #include "contacts_phone_log_internal.h"
25 #endif //ENABLE_LOG_FEATURE
27 #include "ctsvc_service.h"
28 #include "ctsvc_db_init.h"
29 #include "ctsvc_db_access_control.h"
32 #include "ctsvc_ipc_marshal.h"
33 #include "ctsvc_internal.h"
34 #include "ctsvc_ipc_server.h"
35 #include "ctsvc_utils.h"
37 void ctsvc_ipc_activity_delete_by_contact_id(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
39 int ret = CONTACTS_ERROR_NONE;
44 ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
45 if (ret != CONTACTS_ERROR_NONE)
47 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
53 CTS_ERR("ctsvc_ipc_server_db_insert_record fail");
57 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
58 ret = CONTACTS_ERROR_PERMISSION_DENIED;
61 ret = contacts_activity_delete_by_contact_id(contact_id);
68 *outdata = pims_ipc_data_create(0);
71 CTS_ERR("pims_ipc_data_create fail");
74 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
76 pims_ipc_data_destroy(*outdata);
78 CTS_ERR("pims_ipc_data_put fail");
82 if (ret == CONTACTS_ERROR_NONE) {
83 int transaction_ver = ctsvc_get_transaction_ver();
84 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
85 pims_ipc_data_destroy(*outdata);
87 CTS_ERR("ctsvc_ipc_marshal_int fail");
94 CTS_ERR("outdata is NULL");
100 void ctsvc_ipc_activity_delete_by_account_id(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
102 int ret = CONTACTS_ERROR_NONE;
107 ret = ctsvc_ipc_unmarshal_int(indata, &account_id);
108 if (ret != CONTACTS_ERROR_NONE)
110 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
116 CTS_ERR("ctsvc_ipc_activity_delete_by_account_id fail");
120 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
121 ret = CONTACTS_ERROR_PERMISSION_DENIED;
124 ret = contacts_activity_delete_by_account_id(account_id);
130 *outdata = pims_ipc_data_create(0);
133 CTS_ERR("pims_ipc_data_create fail");
136 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
138 pims_ipc_data_destroy(*outdata);
140 CTS_ERR("pims_ipc_data_put fail");
144 if (ret == CONTACTS_ERROR_NONE) {
145 int transaction_ver = ctsvc_get_transaction_ver();
146 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
147 pims_ipc_data_destroy(*outdata);
149 CTS_ERR("ctsvc_ipc_marshal_int fail");
156 CTS_ERR("outdata is NULL");
162 void ctsvc_ipc_group_add_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
164 int ret = CONTACTS_ERROR_NONE;
170 ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
171 if (ret != CONTACTS_ERROR_NONE)
173 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
176 ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
177 if (ret != CONTACTS_ERROR_NONE)
179 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
185 CTS_ERR("ctsvc_ipc_group_add_contact fail");
189 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
190 ret = CONTACTS_ERROR_PERMISSION_DENIED;
194 ret = contacts_group_add_contact(group_id, contact_id);
200 *outdata = pims_ipc_data_create(0);
203 CTS_ERR("pims_ipc_data_create fail");
206 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
208 pims_ipc_data_destroy(*outdata);
210 CTS_ERR("pims_ipc_data_put fail");
214 if (ret == CONTACTS_ERROR_NONE) {
215 int transaction_ver = ctsvc_get_transaction_ver();
216 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
217 pims_ipc_data_destroy(*outdata);
219 CTS_ERR("ctsvc_ipc_marshal_int fail");
226 CTS_ERR("outdata is NULL");
232 void ctsvc_ipc_group_remove_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
234 int ret = CONTACTS_ERROR_NONE;
240 ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
241 if (ret != CONTACTS_ERROR_NONE)
243 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
246 ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
247 if (ret != CONTACTS_ERROR_NONE)
249 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
255 CTS_ERR("ctsvc_ipc_group_remove_contact fail");
259 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
260 ret = CONTACTS_ERROR_PERMISSION_DENIED;
265 ret = contacts_group_remove_contact(group_id, contact_id);
271 *outdata = pims_ipc_data_create(0);
274 CTS_ERR("pims_ipc_data_create fail");
277 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
279 pims_ipc_data_destroy(*outdata);
281 CTS_ERR("pims_ipc_data_put fail");
284 if (ret == CONTACTS_ERROR_NONE) {
285 int transaction_ver = ctsvc_get_transaction_ver();
286 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
287 pims_ipc_data_destroy(*outdata);
289 CTS_ERR("ctsvc_ipc_marshal_int fail");
297 CTS_ERR("outdata is NULL");
303 void ctsvc_ipc_group_set_group_order(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
305 int ret = CONTACTS_ERROR_NONE;
307 int previous_group_id;
312 ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
313 if (ret != CONTACTS_ERROR_NONE)
315 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
318 ret = ctsvc_ipc_unmarshal_int(indata, &previous_group_id);
319 if (ret != CONTACTS_ERROR_NONE)
321 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
324 ret = ctsvc_ipc_unmarshal_int(indata, &next_group_id);
325 if (ret != CONTACTS_ERROR_NONE)
327 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
333 CTS_ERR("ctsvc_ipc_group_link_group fail");
337 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
338 ret = CONTACTS_ERROR_PERMISSION_DENIED;
342 ret = contacts_group_set_group_order(group_id, previous_group_id, next_group_id );
348 *outdata = pims_ipc_data_create(0);
351 CTS_ERR("pims_ipc_data_create fail");
354 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
356 pims_ipc_data_destroy(*outdata);
358 CTS_ERR("pims_ipc_data_put fail");
361 if (ret == CONTACTS_ERROR_NONE) {
362 int transaction_ver = ctsvc_get_transaction_ver();
363 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
364 pims_ipc_data_destroy(*outdata);
366 CTS_ERR("ctsvc_ipc_marshal_int fail");
373 CTS_ERR("outdata is NULL");
379 void ctsvc_ipc_person_link_person(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
381 int ret = CONTACTS_ERROR_NONE;
382 int base_person_id = 0;
387 ret = ctsvc_ipc_unmarshal_int(indata, &base_person_id);
388 if (ret != CONTACTS_ERROR_NONE)
390 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
393 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
394 if (ret != CONTACTS_ERROR_NONE)
396 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
402 CTS_ERR("ctsvc_ipc_person_link_person fail");
406 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
407 ret = CONTACTS_ERROR_PERMISSION_DENIED;
411 ret = contacts_person_link_person(base_person_id, person_id);
417 *outdata = pims_ipc_data_create(0);
420 CTS_ERR("pims_ipc_data_create fail");
423 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
425 pims_ipc_data_destroy(*outdata);
427 CTS_ERR("pims_ipc_data_put fail");
430 if (ret == CONTACTS_ERROR_NONE) {
431 int transaction_ver = ctsvc_get_transaction_ver();
432 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
433 pims_ipc_data_destroy(*outdata);
435 CTS_ERR("ctsvc_ipc_marshal_int fail");
442 CTS_ERR("outdata is NULL");
447 void ctsvc_ipc_person_unlink_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
449 int ret = CONTACTS_ERROR_NONE;
455 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
456 if (ret != CONTACTS_ERROR_NONE)
458 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
461 ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
462 if (ret != CONTACTS_ERROR_NONE)
464 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
470 CTS_ERR("ctsvc_ipc_person_link_person fail");
474 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
475 ret = CONTACTS_ERROR_PERMISSION_DENIED;
479 int unlinked_person_id;
480 ret = contacts_person_unlink_contact(person_id, contact_id, &unlinked_person_id);
486 *outdata = pims_ipc_data_create(0);
489 CTS_ERR("pims_ipc_data_create fail");
492 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
494 pims_ipc_data_destroy(*outdata);
496 CTS_ERR("pims_ipc_data_put fail");
499 if (ret == CONTACTS_ERROR_NONE) {
500 int transaction_ver = ctsvc_get_transaction_ver();
501 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
502 pims_ipc_data_destroy(*outdata);
504 CTS_ERR("ctsvc_ipc_marshal_int fail");
508 if (pims_ipc_data_put(*outdata, (void*)&unlinked_person_id, sizeof(int)) != 0)
510 pims_ipc_data_destroy(*outdata);
512 CTS_ERR("pims_ipc_data_put fail");
518 CTS_ERR("outdata is NULL");
523 void ctsvc_ipc_person_reset_usage(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
525 int ret = CONTACTS_ERROR_NONE;
527 contacts_usage_type_e type;
531 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
532 if (ret != CONTACTS_ERROR_NONE)
534 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
538 ret = ctsvc_ipc_unmarshal_int(indata, &temp);
540 if (ret != CONTACTS_ERROR_NONE)
542 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
548 CTS_ERR("ctsvc_ipc_person_link_person fail");
552 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
553 ret = CONTACTS_ERROR_PERMISSION_DENIED;
557 ret = contacts_person_reset_usage(person_id, type);
563 *outdata = pims_ipc_data_create(0);
566 CTS_ERR("pims_ipc_data_create fail");
569 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
571 pims_ipc_data_destroy(*outdata);
573 CTS_ERR("pims_ipc_data_put fail");
576 if (ret == CONTACTS_ERROR_NONE) {
577 int transaction_ver = ctsvc_get_transaction_ver();
578 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
579 pims_ipc_data_destroy(*outdata);
581 CTS_ERR("ctsvc_ipc_marshal_int fail");
588 CTS_ERR("outdata is NULL");
593 void ctsvc_ipc_person_set_favorite_order(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
595 int ret = CONTACTS_ERROR_NONE;
597 int previous_person_id;
602 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
603 if (ret != CONTACTS_ERROR_NONE)
605 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
608 ret = ctsvc_ipc_unmarshal_int(indata, &previous_person_id);
609 if (ret != CONTACTS_ERROR_NONE)
611 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
614 ret = ctsvc_ipc_unmarshal_int(indata, &next_person_id);
615 if (ret != CONTACTS_ERROR_NONE)
617 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
623 CTS_ERR("ctsvc_ipc_person_link_person fail");
627 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
628 ret = CONTACTS_ERROR_PERMISSION_DENIED;
632 ret = contacts_person_set_favorite_order(person_id, previous_person_id, next_person_id );
638 *outdata = pims_ipc_data_create(0);
641 CTS_ERR("pims_ipc_data_create fail");
644 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
646 pims_ipc_data_destroy(*outdata);
648 CTS_ERR("pims_ipc_data_put fail");
651 if (ret == CONTACTS_ERROR_NONE) {
652 int transaction_ver = ctsvc_get_transaction_ver();
653 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
654 pims_ipc_data_destroy(*outdata);
656 CTS_ERR("ctsvc_ipc_marshal_int fail");
663 CTS_ERR("outdata is NULL");
669 void ctsvc_ipc_person_set_default_property(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
671 int ret = CONTACTS_ERROR_NONE;
674 contacts_person_property_e property;
678 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
679 if (ret != CONTACTS_ERROR_NONE)
681 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
684 ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &property);
685 if (ret != CONTACTS_ERROR_NONE)
687 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
690 ret = ctsvc_ipc_unmarshal_int(indata, &id);
691 if (ret != CONTACTS_ERROR_NONE)
693 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
699 CTS_ERR("ctsvc_ipc_person_set_default_property fail");
703 ret = contacts_person_set_default_property(property, person_id, id );
709 *outdata = pims_ipc_data_create(0);
712 CTS_ERR("pims_ipc_data_create fail");
715 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
717 pims_ipc_data_destroy(*outdata);
719 CTS_ERR("pims_ipc_data_put fail");
722 if (ret == CONTACTS_ERROR_NONE) {
723 int transaction_ver = ctsvc_get_transaction_ver();
724 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
725 pims_ipc_data_destroy(*outdata);
727 CTS_ERR("ctsvc_ipc_marshal_int fail");
734 CTS_ERR("outdata is NULL");
740 void ctsvc_ipc_person_get_default_property(pims_ipc_h ipc, pims_ipc_data_h indata,
741 pims_ipc_data_h *outdata, void *userdata)
743 int ret = CONTACTS_ERROR_NONE;
746 contacts_person_property_e op;
749 ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
750 if (ret != CONTACTS_ERROR_NONE) {
751 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
754 ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &op);
755 if (ret != CONTACTS_ERROR_NONE) {
756 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
761 CTS_ERR("ctsvc_ipc_person_get_default_property fail");
765 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) {
766 ret = CONTACTS_ERROR_PERMISSION_DENIED;
770 ret = contacts_person_get_default_property(op, person_id, &id );
775 *outdata = pims_ipc_data_create(0);
777 CTS_ERR("pims_ipc_data_create fail");
780 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
781 pims_ipc_data_destroy(*outdata);
783 CTS_ERR("pims_ipc_data_put fail (return value)");
786 if (pims_ipc_data_put(*outdata, (void*)&id, sizeof(int)) != 0) {
787 pims_ipc_data_destroy(*outdata);
789 CTS_ERR("pims_ipc_data_put fail (id)");
794 CTS_ERR("outdata is NULL");
800 #ifdef ENABLE_LOG_FEATURE
801 void ctsvc_ipc_phone_log_reset_statistics(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
805 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
806 ret = CONTACTS_ERROR_PERMISSION_DENIED;
810 ret = contacts_phone_log_reset_statistics();
815 *outdata = pims_ipc_data_create(0);
818 CTS_ERR("pims_ipc_data_create fail");
821 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0)
823 pims_ipc_data_destroy(*outdata);
825 CTS_ERR("pims_ipc_data_put fail");
828 if (ret == CONTACTS_ERROR_NONE) {
829 int transaction_ver = ctsvc_get_transaction_ver();
830 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
831 pims_ipc_data_destroy(*outdata);
833 CTS_ERR("ctsvc_ipc_marshal_int fail");
840 CTS_ERR("outdata is NULL");
846 void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata,
847 pims_ipc_data_h *outdata, void *userdata)
849 int ret= CONTACTS_ERROR_NONE;
852 contacts_phone_log_delete_e op;
854 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
855 ret = CONTACTS_ERROR_PERMISSION_DENIED;
860 ret = ctsvc_ipc_unmarshal_int(indata, (int*)&op);
861 if (ret != CONTACTS_ERROR_NONE) {
862 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
867 case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS:
868 ret = ctsvc_ipc_unmarshal_string(indata, &number);
869 if (ret != CONTACTS_ERROR_NONE) {
870 CTS_ERR("ctsvc_ipc_unmarshal_string fail");
873 ret = contacts_phone_log_delete(op, number);
875 case CONTACTS_PHONE_LOG_DELETE_BY_MESSAGE_EXTRA_DATA1:
876 case CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1:
877 ret = ctsvc_ipc_unmarshal_int(indata, &extra_data1);
878 if (ret != CONTACTS_ERROR_NONE) {
879 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
882 ret = contacts_phone_log_delete(op, extra_data1);
885 CTS_ERR("Invalid parameter : the operation is not proper (op : %d)", op);
886 ret = CONTACTS_ERROR_INVALID_PARAMETER;
893 *outdata = pims_ipc_data_create(0);
895 CTS_ERR("pims_ipc_data_create fail");
898 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
899 pims_ipc_data_destroy(*outdata);
901 CTS_ERR("pims_ipc_data_put fail");
904 if (ret == CONTACTS_ERROR_NONE) {
905 int transaction_ver = ctsvc_get_transaction_ver();
906 if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
907 pims_ipc_data_destroy(*outdata);
909 CTS_ERR("ctsvc_ipc_marshal_int fail");
919 #endif // ENABLE_LOG_FEATURE
921 void ctsvc_ipc_setting_get_name_display_order(pims_ipc_h ipc, pims_ipc_data_h indata,
922 pims_ipc_data_h *outdata, void *userdata)
924 int ret = CONTACTS_ERROR_NONE;
925 contacts_name_display_order_e order;
927 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) {
928 ret = CONTACTS_ERROR_PERMISSION_DENIED;
932 ret = contacts_setting_get_name_display_order(&order);
936 *outdata = pims_ipc_data_create(0);
938 CTS_ERR("pims_ipc_data_create fail");
941 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
942 pims_ipc_data_destroy(*outdata);
944 CTS_ERR("pims_ipc_data_put fail (return value)");
947 if (pims_ipc_data_put(*outdata, (void*)&order, sizeof(int)) != 0) {
948 pims_ipc_data_destroy(*outdata);
950 CTS_ERR("pims_ipc_data_put fail (id)");
955 CTS_ERR("outdata is NULL");
961 void ctsvc_ipc_setting_get_name_sorting_order(pims_ipc_h ipc, pims_ipc_data_h indata,
962 pims_ipc_data_h *outdata, void *userdata)
964 int ret = CONTACTS_ERROR_NONE;
965 contacts_name_sorting_order_e order;
967 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) {
968 ret = CONTACTS_ERROR_PERMISSION_DENIED;
972 ret = contacts_setting_get_name_sorting_order(&order);
976 *outdata = pims_ipc_data_create(0);
978 CTS_ERR("pims_ipc_data_create fail");
981 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
982 pims_ipc_data_destroy(*outdata);
984 CTS_ERR("pims_ipc_data_put fail (return value)");
987 if (pims_ipc_data_put(*outdata, (void*)&order, sizeof(int)) != 0) {
988 pims_ipc_data_destroy(*outdata);
990 CTS_ERR("pims_ipc_data_put fail (id)");
995 CTS_ERR("outdata is NULL");
1001 void ctsvc_ipc_setting_set_name_display_order(pims_ipc_h ipc,
1002 pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
1004 int ret = CONTACTS_ERROR_NONE;
1008 ret = ctsvc_ipc_unmarshal_int(indata, &order);
1009 if (ret != CONTACTS_ERROR_NONE) {
1010 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
1015 CTS_ERR("ctsvc_ipc_person_set_default_property fail");
1019 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
1020 ret = CONTACTS_ERROR_PERMISSION_DENIED;
1024 ret = contacts_setting_set_name_display_order((contacts_name_display_order_e)order);
1028 *outdata = pims_ipc_data_create(0);
1030 CTS_ERR("pims_ipc_data_create fail");
1033 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
1034 pims_ipc_data_destroy(*outdata);
1036 CTS_ERR("pims_ipc_data_put fail");
1041 CTS_ERR("outdata is NULL");
1047 void ctsvc_ipc_setting_set_name_sorting_order(pims_ipc_h ipc,
1048 pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
1050 int ret = CONTACTS_ERROR_NONE;
1054 ret = ctsvc_ipc_unmarshal_int(indata, &order);
1055 if (ret != CONTACTS_ERROR_NONE) {
1056 CTS_ERR("ctsvc_ipc_unmarshal_int fail");
1061 CTS_ERR("ctsvc_ipc_person_set_default_property fail");
1065 if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) {
1066 ret = CONTACTS_ERROR_PERMISSION_DENIED;
1070 ret = contacts_setting_set_name_sorting_order((contacts_name_sorting_order_e)order);
1074 *outdata = pims_ipc_data_create(0);
1076 CTS_ERR("pims_ipc_data_create fail");
1079 if (pims_ipc_data_put(*outdata, (void*)&ret, sizeof(int)) != 0) {
1080 pims_ipc_data_destroy(*outdata);
1082 CTS_ERR("pims_ipc_data_put fail");
1087 CTS_ERR("outdata is NULL");