void *user_data)
{
int ret;
- contacts_h contact = NULL;
RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
"_client_noti_check_read_permission() Fail(%d)", ret);
- ret = ctsvc_client_handle_get_p(&contact);
- if (CONTACTS_ERROR_NONE != ret) {
- ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
- return ret;
- }
-
- ret = ctsvc_inotify_subscribe(contact, view_uri, cb, user_data);
+ ret = ctsvc_inotify_subscribe(view_uri, cb, user_data);
if (CONTACTS_ERROR_NONE != ret) {
ERR("ctsvc_inotify_subscribe(%s) Fail(%d)", view_uri, ret);
return ret;
void *user_data)
{
int ret;
- contacts_h contact = NULL;
RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
- ret = ctsvc_client_handle_get_p(&contact);
- if (CONTACTS_ERROR_NONE != ret) {
- ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
- return ret;
- }
-
- ret = ctsvc_inotify_unsubscribe(contact, view_uri, cb, user_data);
+ ret = ctsvc_inotify_unsubscribe(view_uri, cb, user_data);
if (CONTACTS_ERROR_NONE != ret) {
ERR("ctsvc_inotify_unsubscribe(%s) Fail(%d)", view_uri, ret);
return ret;
}
if (1 == base->connection_count)
- ctsvc_inotify_subscribe_ipc_ready(contact, _ctsvc_ipc_initialized_cb, NULL);
+ ctsvc_inotify_subscribe_ipc_ready(_ctsvc_ipc_initialized_cb, NULL);
_ctsvc_connection++;
ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
return ret;
}
- ctsvc_inotify_unsubscribe_ipc_ready(contact);
+ ctsvc_inotify_unsubscribe_ipc_ready();
}
base->connection_count--;
}
if (1 == base->connection_count)
- ctsvc_inotify_subscribe_ipc_ready(contact, _ctsvc_ipc_initialized_cb, NULL);
+ ctsvc_inotify_subscribe_ipc_ready(_ctsvc_ipc_initialized_cb, NULL);
_ctsvc_connection_on_thread++;
ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
return ret;
}
- ctsvc_inotify_unsubscribe_ipc_ready(contact);
+ ctsvc_inotify_unsubscribe_ipc_ready();
}
base->connection_count--;
return CONTACTS_ERROR_NONE;
}
-
-int ctsvc_handle_compare(contacts_h contact1, contacts_h contact2)
-{
- if (NULL == contact1 && NULL == contact2)
- return 0;
- else if (NULL == contact1)
- return 1;
- else if (NULL == contact2)
- return 1;
-
- ctsvc_base_s *base1 = (ctsvc_base_s*)contact1;
- ctsvc_base_s *base2 = (ctsvc_base_s*)contact2;
-
- if ((base1->connection_count == base2->connection_count) &&
- (base1->version == base2->version)) {
- return 0;
- } else {
- return 1;
- }
-}
-
int ctsvc_handle_create(contacts_h *contact);
int ctsvc_handle_destroy(contacts_h contact);
int ctsvc_handle_clone(contacts_h contact, contacts_h *pcontact);
-int ctsvc_handle_compare(contacts_h contact1, contacts_h contact2);
-
#endif /* __CTSVC_HANDLE_H__ */
\ No newline at end of file
#endif
typedef struct {
- contacts_h contact;
int wd;
char *view_uri;
contacts_db_changed_cb cb;
return NULL;
}
-int ctsvc_inotify_subscribe_ipc_ready(contacts_h contact, void (*cb)(void *), void *user_data)
+int ctsvc_inotify_subscribe_ipc_ready(void (*cb)(void *), void *user_data)
{
const char *noti_path = CTSVC_NOTI_IPC_READY;
struct socket_init_noti_info *noti_info = NULL;
return CONTACTS_ERROR_NONE;
}
-int ctsvc_inotify_unsubscribe_ipc_ready(contacts_h contact)
+int ctsvc_inotify_unsubscribe_ipc_ready()
{
const char *noti_path = CTSVC_NOTI_IPC_READY;
struct socket_init_noti_info *noti_info = NULL;
}
-int ctsvc_inotify_subscribe(contacts_h contact, const char *view_uri,
- void *cb, void *data)
+int ctsvc_inotify_subscribe(const char *view_uri, void *cb, void *data)
{
int ret, wd;
noti_info *noti, *same_noti = NULL;
same_noti = it->data;
if (same_noti->wd == wd && same_noti->cb == cb
&& STRING_EQUAL == strcmp(same_noti->view_uri, view_uri)
- && same_noti->cb_data == data
- && 0 == ctsvc_handle_compare(contact, same_noti->contact)) {
+ && same_noti->cb_data == data) {
break;
} else {
same_noti = NULL;
noti->view_uri = strdup(view_uri);
noti->cb_data = data;
noti->cb = cb;
- ctsvc_handle_clone(contact, &(noti->contact));
noti->blocked = false;
__noti_list = g_slist_append(__noti_list, noti);
return CONTACTS_ERROR_NONE;
}
-static inline int __ctsvc_del_noti(GSList **noti_list, contacts_h contact, int wd,
- const char *view_uri, void *cb, void *user_data)
+static inline int __ctsvc_del_noti(GSList **noti_list, int wd, const char *view_uri, void *cb, void *user_data)
{
int del_cnt, remain_cnt;
GSList *it, *result;
noti_info *noti = it->data;
if (noti && wd == noti->wd) {
if (cb == noti->cb && user_data == noti->cb_data
- && STRING_EQUAL == strcmp(noti->view_uri, view_uri)
- && 0 == ctsvc_handle_compare(contact, noti->contact)) {
+ && STRING_EQUAL == strcmp(noti->view_uri, view_uri)) {
it = it->next;
result = g_slist_remove(result, noti);
- ctsvc_handle_destroy(noti->contact);
free(noti->view_uri);
free(noti);
del_cnt++;
}
it = it->next;
}
- RETVM_IF(del_cnt == 0, CONTACTS_ERROR_NO_DATA, "No Data: nothing deleted");
+ RETVM_IF(del_cnt == 0, CONTACTS_ERROR_NO_DATA, "No Data: nothing deleted, remain_cnt : %d", remain_cnt);
*noti_list = result;
return remain_cnt;
}
-int ctsvc_inotify_unsubscribe(contacts_h contact, const char *view_uri, void *cb, void *user_data)
+int ctsvc_inotify_unsubscribe(const char *view_uri, void *cb, void *user_data)
{
int ret, wd;
const char *path;
return CONTACTS_ERROR_SYSTEM;
}
- ret = __ctsvc_del_noti(&__noti_list, contact, wd, view_uri, cb, user_data);
+ ret = __ctsvc_del_noti(&__noti_list, wd, view_uri, cb, user_data);
WARN_IF(ret < CONTACTS_ERROR_NONE, "__ctsvc_del_noti() Fail(%d)", ret);
if (0 == ret)
{
noti_info *noti = (noti_info *)data;
- ctsvc_handle_destroy(noti->contact);
free(noti->view_uri);
free(noti);
}
int ctsvc_inotify_init(void);
void ctsvc_inotify_close(void);
-int ctsvc_inotify_subscribe(contacts_h contact, const char *view_uri, contacts_db_changed_cb cb, void *data);
-int ctsvc_inotify_unsubscribe(contacts_h contact, const char *view_uri, contacts_db_changed_cb cb, void *user_data);
+int ctsvc_inotify_subscribe(const char *view_uri, contacts_db_changed_cb cb, void *data);
+int ctsvc_inotify_unsubscribe(const char *view_uri, contacts_db_changed_cb cb, void *user_data);
-int ctsvc_inotify_subscribe_ipc_ready(contacts_h contact, void (*cb)(void *), void *user_data);
-int ctsvc_inotify_unsubscribe_ipc_ready(contacts_h contact);
+int ctsvc_inotify_subscribe_ipc_ready(void (*cb)(void *), void *user_data);
+int ctsvc_inotify_unsubscribe_ipc_ready();
#endif /* __CTSVC_INOTIFY_H__ */
GMutex __ctsvc_server_bg_delete_mutex;
account_subscribe_h account = NULL;
-contacts_h bg_contact;
static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_s *data)
{
void ctsvc_server_bg_add_cb()
{
int ret;
- ctsvc_handle_create(&bg_contact);
- ret = ctsvc_inotify_subscribe(bg_contact, _contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
+
+ ret = ctsvc_inotify_subscribe(_contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
DBG("call ctsvc_inotify_subscribe (_contacts_address_book) : return (%d)", ret);
- ret = ctsvc_inotify_subscribe(bg_contact, _contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
+ ret = ctsvc_inotify_subscribe(_contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
DBG("call ctsvc_inotify_subscribe (_contacts_contact): return (%d)", ret);
ret = account_subscribe_create(&account);
{
int ret;
- ret = ctsvc_inotify_unsubscribe(bg_contact, _contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
+ ret = ctsvc_inotify_unsubscribe(_contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
ERR("call ctsvc_inotify_unsubscribe (_contacts_address_book): return (%d)", ret);
- ret = ctsvc_inotify_unsubscribe(bg_contact, _contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
+ ret = ctsvc_inotify_unsubscribe(_contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
ERR("call ctsvc_inotify_unsubscribe (_contacts_contact) : return (%d)", ret);
if (account) {