1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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;
}
|