diff options
author | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 19:06:08 +0900 |
---|---|---|
committer | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 19:06:08 +0900 |
commit | 2fe4ba6f7e660a945ed94559110c76852c5edd47 (patch) | |
tree | 1c3b126230f27c8e1451b5669a2e7f760be29fe1 /client/ctsvc_client_activity.c | |
parent | a1311c9da85162a82223c73aa63e6c9b7d91c565 (diff) | |
download | contacts-service-tizen_2.0.tar.gz contacts-service-tizen_2.0.tar.bz2 contacts-service-tizen_2.0.zip |
Tizen 2.0 Releasesubmit/tizen_2.0/20130216.100704accepted/tizen_2.0/20130216.0940012.0_releasetizen_2.0
Diffstat (limited to 'client/ctsvc_client_activity.c')
-rw-r--r-- | client/ctsvc_client_activity.c | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/client/ctsvc_client_activity.c b/client/ctsvc_client_activity.c new file mode 100644 index 0000000..b3856a9 --- /dev/null +++ b/client/ctsvc_client_activity.c @@ -0,0 +1,126 @@ +/*
+ * Contacts Service
+ *
+ * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <glib.h>
+
+#include "contacts.h"
+#include "ctsvc_internal.h"
+#include "ctsvc_ipc_define.h"
+#include "ctsvc_ipc_marshal.h"
+#include "ctsvc_client_ipc.h"
+#include <pims-ipc-data.h>
+
+API int contacts_activity_delete_by_contact_id(int contact_id)
+{
+ int ret = CONTACTS_ERROR_NONE;
+ pims_ipc_data_h indata = NULL;
+ pims_ipc_data_h outdata = NULL;
+
+ RETVM_IF(contact_id <= 0,CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+
+ // make indata
+ indata = pims_ipc_data_create(0);
+ if (indata == NULL)
+ {
+ CTS_ERR("ipc data created fail!");
+ ret = CONTACTS_ERROR_OUT_OF_MEMORY;
+ return ret;
+ }
+
+ ret = ctsvc_ipc_marshal_int( contact_id, indata);
+ if (ret != CONTACTS_ERROR_NONE)
+ {
+ CTS_ERR("marshal fail");
+ return ret;
+ }
+
+ // ipc call
+ if (ctsvc_ipc_call( CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_CONTACT_ID, indata, &outdata) != 0)
+ {
+ CTS_ERR("pims_ipc_call failed");
+ pims_ipc_data_destroy(indata);
+ return CONTACTS_ERROR_IPC;
+ }
+
+ if (indata)
+ {
+ pims_ipc_data_destroy(indata);
+ }
+
+ if (outdata)
+ {
+ // check result
+ unsigned int size = 0;
+ ret = *(int*) pims_ipc_data_get(outdata, &size);
+
+ pims_ipc_data_destroy(outdata);
+ }
+
+ return ret;
+}
+
+API int contacts_activity_delete_by_account_id(int account_id)
+{
+ int ret = CONTACTS_ERROR_NONE;
+ pims_ipc_data_h indata = NULL;
+ pims_ipc_data_h outdata = NULL;
+
+ RETVM_IF(account_id <= 0,CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+
+ // make indata
+ indata = pims_ipc_data_create(0);
+ if (indata == NULL)
+ {
+ CTS_ERR("ipc data created fail!");
+ ret = CONTACTS_ERROR_OUT_OF_MEMORY;
+ return ret;
+ }
+
+ ret = ctsvc_ipc_marshal_int( account_id, indata);
+ if (ret != CONTACTS_ERROR_NONE)
+ {
+ CTS_ERR("marshal fail");
+ return ret;
+ }
+
+ // ipc call
+ if (ctsvc_ipc_call( CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_ACCOUNT_ID, indata, &outdata) != 0)
+ {
+ CTS_ERR("pims_ipc_call failed");
+ pims_ipc_data_destroy(indata);
+ return CONTACTS_ERROR_IPC;
+ }
+
+ if (indata)
+ {
+ pims_ipc_data_destroy(indata);
+ }
+
+ if (outdata)
+ {
+ // check result
+ unsigned int size = 0;
+ ret = *(int*) pims_ipc_data_get(outdata, &size);
+
+ pims_ipc_data_destroy(outdata);
+ }
+
+ return ret;
+}
+
|