#define LOG_TAG "PLUGIN_DA_TASK"
#endif
-#define FW_TASK 11
+#define FW_TASK 10
static sync_agent_util_async_queue_s *queue;
static sync_agent_get_account_id_list_cb_plugin callback_get_account_id_list;
+static sync_agent_del_child_item_cb_plugin callback_delete_child_item;
+
static void _set_is_noti_from_me(int set_flag);
static int __get_is_noti_from_me(void);
_INNER_FUNC_ENTER;
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
- int service_ret = 0;
+ int service_ret = CALENDAR_ERROR_NONE;
unsigned int ids[1];
calendar_query_h query = NULL;
calendar_filter_h filter = NULL;
calendar_list_h list = NULL;
- // start pre condition
service_ret = calendar_query_create(_calendar_todo._uri, &query);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_create Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_create() Fail!: err[%d]", service_ret);
+
service_ret = calendar_filter_create(_calendar_todo._uri, &filter);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_filter_create Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_filter_create() Fail!: err[%d]", service_ret);
+
service_ret = calendar_filter_add_int(filter, _calendar_todo.calendar_book_id, CALENDAR_MATCH_EQUAL, folder_id);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_filter_add_int Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
- // end pre condition
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_filter_add_int() Fail!: err[%d]", service_ret);
service_ret = calendar_query_set_filter(query, filter);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_set_filter Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_set_filter() Fail!: err[%d]", service_ret);
ids[0] = _calendar_todo.id;
service_ret = calendar_query_set_projection(query, ids, 1);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_set_projection Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_set_projection() Fail!: err[%d]", service_ret);
service_ret = calendar_db_get_records_with_query(query, 0, 0, &list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_db_get_records_with_query Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_db_get_records_with_query() Fail!: err[%d]", service_ret);
+
service_ret = calendar_list_get_count(list, count);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_get_count() Fail!: err[%d]", service_ret);
_DEBUG_INFO("count(%d)", *count);
service_ret = calendar_list_first(list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_first() Fail!: err[%d]", service_ret);
- DACI_FINISH:
+ return_part:
+ ret = _convert_service_error_to_common_error(service_ret);
calendar_filter_destroy(filter);
calendar_query_destroy(query);
*item_list = list;
- return ret;
_INNER_FUNC_EXIT;
+ return ret;
}
static sync_agent_da_return_e _get_service_folder_list_by_account_id(int account_id, calendar_list_h * item_list, int *count)
calendar_filter_h filter = NULL;
calendar_list_h list = NULL;
- // start pre condition
service_ret = calendar_query_create(_calendar_book._uri, &query);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_create Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_create() Fail!: err[%d]", service_ret);
+
service_ret = calendar_filter_create(_calendar_book._uri, &filter);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_filter_create Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_filter_create() Fail!: err[%d]", service_ret);
+
service_ret = calendar_filter_add_int(filter, _calendar_book.account_id, CALENDAR_MATCH_EQUAL, account_id);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_filter_add_int Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
- // end pre condition
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_filter_add_int() Fail!: err[%d]", service_ret);
service_ret = calendar_query_set_filter(query, filter);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_set_filter Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_set_filter() Fail!: err[%d]", service_ret);
ids[0] = _calendar_book.id;
service_ret = calendar_query_set_projection(query, ids, 1);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_query_set_projection Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_query_set_projection() Fail!: err[%d]", service_ret);
service_ret = calendar_db_get_records_with_query(query, 0, 0, &list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_db_get_records_with_query Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_db_get_records_with_query() Fail!: err[%d]", service_ret);
+
service_ret = calendar_list_get_count(list, count);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_get_count() Fail!: err[%d]", service_ret);
_DEBUG_INFO("count(%d)", *count);
service_ret = calendar_list_first(list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_first() Fail!: err[%d]", service_ret);
- DACI_FINISH:
+ return_part:
+ ret = _convert_service_error_to_common_error(service_ret);
calendar_filter_destroy(filter);
calendar_query_destroy(query);
*item_list = list;
- return ret;
_INNER_FUNC_EXIT;
+ return ret;
}
EXPORT_API sync_agent_da_return_e sync_agent_plugin_open_service(void)
_EXTERN_FUNC_ENTER;
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
- //int err = calendar_connect_on_thread();
int err = calendar_connect();
+
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] calendar_connect Fail!\n");
+ _DEBUG_ERROR("[task] calendar_connect Fail!\n");
ret = _convert_service_error_to_common_error(err);
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_connect Success!\n");
+ _DEBUG_INFO("[task] calendar_connect Success!\n");
}
_EXTERN_FUNC_EXIT;
-
return ret;
}
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
int err = calendar_disconnect();
- //int err = calendar_disconnect_on_thread();
+
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] calendar_disconnect Fail!\n");
+ _DEBUG_ERROR("[task] calendar_disconnect Fail!\n");
ret = _convert_service_error_to_common_error(err);
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_disconnect Success!\n");
+ _DEBUG_INFO("[task] calendar_disconnect Success!\n");
}
_EXTERN_FUNC_EXIT;
-
return ret;
}
int un_type = 0;
memcpy(&un_type, item, 4);
int int_folder_id = atoi(folder_id);
- _DEBUG_INFO("[da_task_plugIn] calendar type %d, in %d, folder id [%d]", un_type, item, int_folder_id);
+ _DEBUG_INFO("[task] calendar type %d, in %d, folder id [%d]", un_type, item, int_folder_id);
/* setting folder id */
service_ret = calendar_record_set_int(item, _calendar_todo.calendar_book_id, int_folder_id);
ret = SYNC_AGENT_DA_ERRORS;
goto DACI_FINISH;
}
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_struct_set_int(folder %d) return [%d]!\n", atoi(folder_id), service_ret);
+ _DEBUG_INFO("[task] calendar_svc_struct_set_int(folder %d) return [%d]!\n", atoi(folder_id), service_ret);
/* add item */
int slp_cal_info_id = 0;
*item_id = 0;
goto DACI_FINISH;
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_insert() Success!");
+ _DEBUG_INFO("[task] calendar_svc_insert() Success!");
_DEBUG_INFO("calendar_svc_insert() Success!: id = %d", slp_cal_info_id);
*item_id = g_strdup_printf("%d", slp_cal_info_id);
is_storage_changed = 1;
retvm_if(folder_id == NULL, SYNC_AGENT_DA_ERR_INVALID_CONTENT, "folder_id is NULL. FAIL !!!");
retvm_if(item_id == NULL, SYNC_AGENT_DA_ERR_INVALID_CONTENT, "item_id is NULL. FAIL !!!");
- sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
- int err = 0;
calendar_record_h item = (calendar_record_h) data;
+ sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
+ int service_ret = CALENDAR_ERROR_NONE;
int int_folder_id = atoi(folder_id);
- /* setting folder id */
- int service_ret = calendar_record_set_int(item, _calendar_todo.calendar_book_id, int_folder_id);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_record_set_int() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
+ service_ret = calendar_record_set_int(item, _calendar_todo.calendar_book_id, int_folder_id);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_record_set_int() Fail!: err[%d]", service_ret);
/* update item */
- err = calendar_db_update_record(item);
- if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] calendar_svc_update() Fail!\n");
- ret = _convert_service_error_to_common_error(err);
- } else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_update() Success!");
- is_storage_changed = 1;
- }
+ service_ret = calendar_db_update_record(item);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_db_update_record() Fail!: err[%d]", service_ret);
- /* memory free */
- DACI_FINISH:
- /* memory free */
+ _DEBUG_INFO("[task] calendar_svc_update() Success!");
+ is_storage_changed = 1;
+
+ return_part:
+ ret = _convert_service_error_to_common_error(service_ret);
if (item != NULL) {
- calendar_record_destroy(item, false);
- if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_record_destroy() Fail! : err = %d", err);
+ service_ret = calendar_record_destroy(item, false);
+ if (service_ret != CALENDAR_ERROR_NONE) {
+ _DEBUG_ERROR("calendar_record_destroy() Fail! : service_ret = %d", service_ret);
}
item = NULL;
}
_EXTERN_FUNC_EXIT;
-
return ret;
}
int err = calendar_db_delete_record(_calendar_todo._uri, atoi(item_id));
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_delete() Fail!");
+ _DEBUG_INFO("[task] calendar_svc_delete() Fail!");
ret = _convert_service_error_to_common_error(err);
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_delete() Success!");
+ _DEBUG_INFO("[task] calendar_svc_delete() Success!");
is_storage_changed = 1;
}
/* get folder id list for account id */
folder_id_list = sync_agent_plugin_get_folder_id_list(account_id, &folder_id_list_cnt, &folder_type_list);
if (folder_id_list == NULL || folder_id_list_cnt == 0) {
- _DEBUG_INFO("[da_task_plugIn] folder id list cnt : %d", folder_id_list_cnt);
+ _DEBUG_INFO("[task] folder id list cnt : %d", folder_id_list_cnt);
if (folder_type_list != NULL) {
cfree(folder_type_list);
folder_type_list = NULL;
}
+ if (folder_id_list != NULL) {
+ free(folder_id_list);
+ folder_id_list = NULL;
+ }
return SYNC_AGENT_DA_ERR_NO_DATA;
}
int folder_iter = 0;
for (; folder_iter < folder_id_list_cnt; folder_iter++) {
int int_folder_id = atoi(folder_id_list[folder_iter]);
- _DEBUG_INFO("[da_task_plugIn] folder id : %d\n", int_folder_id);
+ _DEBUG_INFO("[task] folder id : %d\n", int_folder_id);
int event_count = 0;
ret = _get_service_event_list_by_folder_id(int_folder_id, &event_list, &event_count);
if (ret != SYNC_AGENT_DA_SUCCESS) {
event = NULL;
service_ret = calendar_list_get_current_record_p(event_list, &event);
if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_current_record_p Fail!\n");
+ _DEBUG_ERROR("[task] in calendar_list_get_current_record_p Fail!\n");
ret = _convert_service_error_to_common_error(service_ret);
continue;
}
service_ret = calendar_record_get_int(event, _calendar_todo.id, &item_id);
if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_record_get_int Fail!\n");
+ _DEBUG_ERROR("[task] in calendar_record_get_int Fail!\n");
ret = _convert_service_error_to_common_error(service_ret);
continue;
}
- _DEBUG_INFO("[da_task_plugIn] item id : %d\n", item_id);
+ _DEBUG_INFO("[task] item id : %d\n", item_id);
err = calendar_db_delete_record(_calendar_todo._uri, item_id);
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] calendar_svc_delete(%d) Fail!\n", item_id);
+ _DEBUG_ERROR("[task] calendar_svc_delete(%d) Fail!\n", item_id);
ret = _convert_service_error_to_common_error(err);
goto DACI_FINISH;
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_delete(%d) Success!\n", item_id);
+ _DEBUG_INFO("[task] calendar_svc_delete(%d) Success!\n", item_id);
is_storage_changed = 1;
}
for (cnt = 0; cnt < folder_id_list_cnt; cnt++) {
if (folder_id_list[cnt] != NULL) {
free(folder_id_list[cnt]);
- _DEBUG_INFO("[da_task_plugIn] folder id free !! \n");
+ _DEBUG_INFO("[task] folder id free !! \n");
}
}
cfree(folder_id_list);
- _DEBUG_INFO("[da_task_plugIn] folder id list free !! \n");
+ _DEBUG_INFO("[task] folder id list free !! \n");
}
if (folder_type_list != NULL) {
cfree(folder_type_list);
/* get item */
err = calendar_db_get_record(_calendar_todo._uri, atoi(item_id), &item);
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_INFO("[da_task_plugIn] calendar_db_get_record() Fail!\n");
+ _DEBUG_INFO("[task] calendar_db_get_record() Fail!\n");
ret = _convert_service_error_to_common_error(err);
*data = 0;
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_get() Success!\n");
+ _DEBUG_INFO("[task] calendar_svc_get() Success!\n");
*data = (void *)item;
}
retvm_if(folder_name == NULL, SYNC_AGENT_DA_ERR_INVALID_CONTENT, "folder_name is NULL. FAIL !!!");
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
- int err = 0;
+ int service_ret = CALENDAR_ERROR_NONE;
calendar_record_h folder = 0;
/* new service struct */
calendar_record_create(_calendar_book._uri, &folder);
if (folder == NULL) {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_struct_new() Fail!\n");
+ _DEBUG_INFO("[task] calendar_svc_struct_new() Fail!\n");
*folder_id = 0;
return SYNC_AGENT_DA_ERRORS;
}
/* setting folder data */
- int cal_ret = calendar_record_set_int(folder, _calendar_book.account_id, account_id);
- if (cal_ret != CALENDAR_ERROR_NONE) {
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
- cal_ret = calendar_record_set_int(folder, _calendar_book.visibility, 1);
- if (cal_ret != CALENDAR_ERROR_NONE) {
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
- cal_ret = calendar_record_set_str(folder, _calendar_book.name, folder_name);
- if (cal_ret != CALENDAR_ERROR_NONE) {
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
+ service_ret = calendar_record_set_int(folder, _calendar_book.account_id, account_id);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_record_set_int() Fail!: err[%d]", service_ret);
+
+ service_ret = calendar_record_set_int(folder, _calendar_book.visibility, 1);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_record_set_int() Fail!: err[%d]", service_ret);
+
+ service_ret = calendar_record_set_str(folder, _calendar_book.name, folder_name);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_record_set_str() Fail!: err[%d]", service_ret);
/* add folder */
int service_folder_item_id = 0;
- cal_ret = calendar_db_insert_record(folder, &service_folder_item_id);
- if (cal_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_insert() Fail!\n");
- ret = _convert_service_error_to_common_error(cal_ret);
+ service_ret = calendar_db_insert_record(folder, &service_folder_item_id);
+ if (service_ret != CALENDAR_ERROR_NONE) {
+ _DEBUG_INFO("[task] calendar_svc_insert() Fail!\n");
*folder_id = 0;
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_insert() Success!");
+ _DEBUG_INFO("[task] calendar_svc_insert() Success!");
*folder_id = g_strdup_printf("%d", service_folder_item_id);
is_storage_changed = 1;
}
- DACI_FINISH:
- /* memory free */
+
+ return_part:
+ ret = _convert_service_error_to_common_error(service_ret);
if (folder != NULL) {
calendar_record_destroy(folder, false);
- if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_record_destroy() Fail! : err = %d", err);
+ if (service_ret != CALENDAR_ERROR_NONE) {
+ _DEBUG_ERROR("calendar_record_destroy() Fail! : service_ret = %d", service_ret);
}
folder = NULL;
}
/* delete folder */
err = calendar_db_delete_record(_calendar_book._uri, atoi(folder_id));
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_INFO("[da_task_plugIn] calendar_db_delete_record() Fail, err[%d]", err);
+ _DEBUG_INFO("[task] calendar_db_delete_record() Fail, err[%d]", err);
ret = _convert_service_error_to_common_error(err);
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_delete() Success!");
+ _DEBUG_INFO("[task] calendar_svc_delete() Success!");
calendar_db_clean_after_sync(atoi(folder_id), 0);
is_storage_changed = 1;
}
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
int err = 0;
calendar_record_h folder = 0;
-
- /* get item */
int task_folder_id = atoi(folder_id);
- _DEBUG_INFO("[da_task_plugIn] task_folder_id : %d\n", task_folder_id);
+ _DEBUG_INFO("[task] task_folder_id : %d\n", task_folder_id);
+
err = calendar_db_get_record(_calendar_book._uri, task_folder_id, &folder);
if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_INFO("[da_contact_plugIn] contacts_svc_get_addressbook() Fail!\n");
+ _DEBUG_INFO("[task] contacts_svc_get_addressbook() Fail!\n");
ret = _convert_service_error_to_common_error(err);
*out_folder_name = 0;
*out_folder_type = -1;
- } else {
- _DEBUG_INFO("[da_contact_plugIn] contacts_svc_get_addressbook() Success!\n");
+ goto return_part;
+ }
+
+ _DEBUG_INFO("[task] contacts_svc_get_addressbook() Success!\n");
+
+ *out_folder_name = 0;
+ err = calendar_record_get_str(folder, _calendar_book.name, out_folder_name);
+ if (err != CALENDAR_ERROR_NONE) {
+ _DEBUG_INFO("[task] calendar_record_get_str() Fail!\n");
+ ret = _convert_service_error_to_common_error(err);
*out_folder_name = 0;
- calendar_record_get_str(folder, _calendar_book.name, out_folder_name);
- *out_folder_type = DEFAULT_CALENDAR_FOLDER;
+ *out_folder_type = -1;
+ goto return_part;
}
- /* memory free */
+ *out_folder_type = DEFAULT_CALENDAR_FOLDER;
+
+return_part:
if (folder != NULL) {
calendar_record_destroy(folder, false);
if (err != CALENDAR_ERROR_NONE) {
folder = NULL;
}
_EXTERN_FUNC_EXIT;
-
return ret;
}
{
_EXTERN_FUNC_ENTER;
- _DEBUG_INFO("[da_task_plugIn] service is not supported execute. \n");
+ _DEBUG_INFO("[task] service is not supported execute. \n");
*result = 0;
_EXTERN_FUNC_EXIT;
int used_cnt = 0;
ret = calendar_db_get_count_with_query(query, &used_cnt);
if (ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] calendar_db_get_count() Fail\n");
+ _DEBUG_ERROR("[task] calendar_db_get_count() Fail\n");
} else {
- _DEBUG_INFO("[da_task_plugIn] calendar_db_get_count() Success\n");
- _DEBUG_INFO("[da_task_plugIn] used_count = %d\n", used_cnt);
+ _DEBUG_INFO("[task] calendar_db_get_count() Success\n");
+ _DEBUG_INFO("[task] used_count = %d\n", used_cnt);
}
if (filter != NULL)
calendar_query_destroy(query);
_EXTERN_FUNC_EXIT;
-
return used_cnt;
}
char **folder_id_list = NULL;
int count = 0;
calendar_list_h service_folder_list = 0;
- calendar_record_h folder = NULL;
int err = 0;
int i = 0;
*folder_count = 0;
err = _get_service_folder_list_by_account_id(account_id, &service_folder_list, &count);
if (err != SYNC_AGENT_DA_SUCCESS || count == 0) {
_DEBUG_ERROR("_get_service_folder_list_by_account_id failed !!!");
- return NULL;
+ folder_id_list = NULL;
+ goto return_part;
}
+
if (count > 0) {
folder_id_list = (char **)calloc(count, sizeof(char *));
if (folder_id_list == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
- if (service_folder_list != NULL) {
- err = calendar_list_destroy(service_folder_list, true);
- if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_list_destroy() Fail! : err = %d", err);
- }
- service_folder_list = NULL;
- }
- return NULL;
+ goto return_part;
}
*folder_type_list = (int *)calloc(count, sizeof(int));
if (*folder_type_list == NULL) {
free(folder_id_list);
folder_id_list = NULL;
}
- if (service_folder_list != NULL) {
- err = calendar_list_destroy(service_folder_list, true);
- if (err != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_list_destroy() Fail! : err = %d", err);
- }
- service_folder_list = NULL;
- }
- return NULL;
+ goto return_part;
}
- /* find */
do {
- /* get */
- err = calendar_list_get_current_record_p(service_folder_list, &folder);
- if ((err != CALENDAR_ERROR_NONE) && (folder == NULL)) {
- _DEBUG_ERROR("calendar_list_get_current_record_p() Fail! : err = %d", err);
+ int int_folder_id = 0;
+ calendar_record_h todo = NULL;
+ err = calendar_record_create(_calendar_todo._uri, &todo);
+ if ((err != CALENDAR_ERROR_NONE) && (todo == NULL)) {
+ _DEBUG_ERROR("calendar_record_create() Fail! : err = %d", err);
+ break;
+ }
+
+ err = calendar_record_get_int(todo, _calendar_todo.calendar_book_id, &int_folder_id);
+ if (err != CALENDAR_ERROR_NONE) {
+ _DEBUG_ERROR("calendar_record_get_int() Fail! : err = %d", err);
break;
}
- /* check */
- int int_folder_id = 0;
- err = calendar_record_get_int(folder, _calendar_book.id, &int_folder_id);
folder_id_list[i] = g_strdup_printf("%d", int_folder_id);
(*folder_type_list)[i] = DEFAULT_CALENDAR_FOLDER;
i++;
*folder_count = i;
-
-// if (folder != NULL){
-// calendar_record_destroy(folder, false);
-// if (err != CALENDAR_ERROR_NONE) {
-// _DEBUG_ERROR("calendar_record_destroy() Fail! : err = %d", err);
-// }
-// folder = NULL;
-// }
-
} while (calendar_list_next(service_folder_list) != CALENDAR_ERROR_NO_DATA);
}
+
+return_part:
+ _DEBUG_INFO("return_part");
if (service_folder_list != NULL) {
err = calendar_list_destroy(service_folder_list, true);
if (err != CALENDAR_ERROR_NONE) {
service_folder_list = NULL;
}
_EXTERN_FUNC_EXIT;
-
return folder_id_list;
}
{
_EXTERN_FUNC_ENTER;
- _DEBUG_INFO("[da_task_plugIn] start!!\n");
+ _DEBUG_INFO("[task] start!!\n");
int error_code = account_connect();
error_code = account_disconnect();
- _DEBUG_INFO("[da_task_plugIn] end!!\n");
+ _DEBUG_INFO("[task] end!!\n");
_EXTERN_FUNC_EXIT;
{
_EXTERN_FUNC_ENTER;
- _DEBUG_INFO("[da_task_plugIn] account_id : %d\n", account_id);
- _DEBUG_INFO("[da_task_plugIn] folder_id : %s\n", folder_id);
- _DEBUG_INFO("[da_task_plugIn] changepoint : %d\n", changepoint);
- sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
+ _DEBUG_INFO("[task] account_id : %d\n", account_id);
+ _DEBUG_INFO("[task] folder_id : %s\n", folder_id);
+ _DEBUG_INFO("[task] changepoint : %d\n", changepoint);
int taskTimeStamp = changepoint;
int current_change_point = 0;
int temp_folder_id = atoi(folder_id);
- int service_ret = 0;
+ int service_ret = CALENDAR_ERROR_NONE;
sync_agent_plugin_item_node_s *root_ptr = 0;
sync_agent_plugin_item_node_s *cursor_ptr = 0;
calendar_record_h changed_task = NULL;
service_ret = calendar_db_get_changes_by_version(_calendar_todo._uri, temp_folder_id, taskTimeStamp, &service_changed_list, ¤t_change_point);
- _DEBUG_INFO("[da_task_plugIn] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
- if ((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL)) {
- _DEBUG_ERROR("calendar_db_get_changes_by_version() Fail! : err = %d", service_ret);
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ _DEBUG_INFO("[task] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL), "[task] calendar_db_get_changes_by_version() Fail!: err[%d]", service_ret);
int list_count = 0;
service_ret = calendar_list_get_count(service_changed_list, &list_count);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_get_count() Fail!: err[%d]", service_ret);
- _DEBUG_INFO("[da_task_plugIn] in calendar_list_get_count [%d]!", list_count);
+ _DEBUG_INFO("[task] in calendar_list_get_count [%d]!", list_count);
if (list_count <= 0) {
-// ret =SYNC_AGENT_DA_ERR_NO_DATA;
- goto DACI_FINISH;
- }
-// service_ret = calendar_svc_iter_next(iter);
- service_ret = calendar_list_first(service_changed_list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_list_first() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
+ goto return_part;
}
- _DEBUG_INFO("[da_task_plugIn] calendar_svc_iter_next service_ret : %d\n", service_ret);
+ service_ret = calendar_list_first(service_changed_list);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_first() Fail!: err[%d]", service_ret);
do {
_DEBUG_INFO("while start");
service_ret = calendar_list_get_current_record_p(service_changed_list, &changed_task);
- if ((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL)) {
- _DEBUG_ERROR("calendar_list_get_current_record_p() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL), "[task] calendar_list_get_current_record_p() Fail!: err[%d]", service_ret);
+
int type = 0;
service_ret = calendar_record_get_int(changed_task, _calendar_updated_info.modified_status, &type);
if (service_ret != CALENDAR_ERROR_NONE) {
break;
}
- _DEBUG_INFO("[da_task_plugIn] type is [%d]", type);
+ _DEBUG_INFO("[task] type is [%d]", type);
if (type == CALENDAR_EVENT_MODIFIED_STATUS_INSERTED) {
int task_id = 0;
service_ret = calendar_record_get_int(changed_task, _calendar_updated_info.id, &task_id);
_DEBUG_ERROR("calendar_record_get_int() Fail!: err = %d", service_ret);
break;
}
- _DEBUG_INFO("[da_task_plugIn] calendar id is [%d]", task_id);
+ _DEBUG_INFO("[task] calendar id is [%d]", task_id);
char *task_id_str = g_strdup_printf("%d", task_id);
- _DEBUG_INFO("[da_task_plugIn] CALS_UPDATED_TYPE_INSERTED : [%s]\n", task_id_str);
+ _DEBUG_INFO("[task] CALS_UPDATED_TYPE_INSERTED : [%s]\n", task_id_str);
if (root_ptr == NULL) {
root_ptr = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (root_ptr == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
return NULL;
}
root_ptr->item_id = task_id_str;
cursor_ptr->next = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (cursor_ptr->next == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
+ if (root_ptr) {
+ free(root_ptr);
+ root_ptr = NULL;
+ }
return NULL;
}
cursor_ptr->next->item_id = task_id_str;
chagned_count++;
}
-
- /*if list can successfully free child than dont need this free */
-// if (changed_task != NULL)
-// calendar_record_destroy(changed_task, true);
} while (calendar_list_next(service_changed_list) != CALENDAR_ERROR_NO_DATA);
- DACI_FINISH:
-
+ return_part:
if (service_changed_list != NULL) {
calendar_list_destroy(service_changed_list, true);
service_changed_list = NULL;
*changeCount = chagned_count;
_EXTERN_FUNC_EXIT;
-
return root_ptr;
}
{
_EXTERN_FUNC_ENTER;
- _DEBUG_INFO("[da_task_plugIn] account_id : %d\n", account_id);
- _DEBUG_INFO("[da_task_plugIn] folder_id : %s\n", folder_id);
- _DEBUG_INFO("[da_task_plugIn] changepoint : %d\n", change_point);
+ _DEBUG_INFO("[task] account_id : %d\n", account_id);
+ _DEBUG_INFO("[task] folder_id : %s\n", folder_id);
+ _DEBUG_INFO("[task] changepoint : %d\n", change_point);
int current_change_point = 0;
int task_time_stamp = change_point;
int temp_folder_id = atoi(folder_id);
- int service_ret = 0;
- sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
+ int service_ret = CALENDAR_ERROR_NONE;
+
sync_agent_plugin_item_node_s *root_ptr = 0;
sync_agent_plugin_item_node_s *cursor_ptr = 0;
int chagned_count = 0;
calendar_record_h changed_task = NULL;
service_ret = calendar_db_get_changes_by_version(_calendar_todo._uri, temp_folder_id, task_time_stamp, &service_changed_list, ¤t_change_point);
- _DEBUG_INFO("[da_task_plugIn] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
- if ((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL)) {
- _DEBUG_ERROR("calendar_db_get_changes_by_version() Fail! : err = %d", service_ret);
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ _DEBUG_INFO("[task] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL), "[task] calendar_db_get_changes_by_version() Fail!: err[%d]", service_ret);
int list_count = 0;
service_ret = calendar_list_get_count(service_changed_list, &list_count);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_get_count() Fail!: err[%d]", service_ret);
- _DEBUG_INFO("[da_task_plugIn] in calendar_list_get_count [%d]!", list_count);
+ _DEBUG_INFO("[task] in calendar_list_get_count [%d]!", list_count);
if (list_count <= 0) {
- goto DACI_FINISH;
+ goto return_part;
}
service_ret = calendar_list_first(service_changed_list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_list_first() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
- _DEBUG_INFO("[da_task_plugIn] service_ret : %d\n", service_ret);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_first() Fail!: err[%d]", service_ret);
do {
service_ret = calendar_list_get_current_record_p(service_changed_list, &changed_task);
- if ((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL)) {
- _DEBUG_ERROR("calendar_list_get_current_record_p() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL), "[task] calendar_list_get_current_record_p() Fail!: err[%d]", service_ret);
int type = 0;
service_ret = calendar_record_get_int(changed_task, _calendar_updated_info.modified_status, &type);
break;
}
char *task_id_str = g_strdup_printf("%d", task_id);
- _DEBUG_INFO("[da_task_plugIn] CALS_UPDATED_TYPE_DELETED : [%s]\n", task_id_str);
+ _DEBUG_INFO("[task] CALS_UPDATED_TYPE_DELETED : [%s]\n", task_id_str);
if (root_ptr == NULL) {
root_ptr = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (root_ptr == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
return NULL;
}
root_ptr->item_id = task_id_str;
cursor_ptr->next = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (cursor_ptr->next == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
+ if (root_ptr) {
+ free(root_ptr);
+ root_ptr = NULL;
+ }
return NULL;
}
cursor_ptr->next->item_id = task_id_str;
chagned_count++;
}
-
- /*if list can successfully free child than dont need this free */
-// if (changed_task != NULL)
-// calendar_record_destroy(changed_task, true);
} while (calendar_list_next(service_changed_list) != CALENDAR_ERROR_NO_DATA);
- DACI_FINISH:
-
+ return_part:
if (service_changed_list != NULL) {
calendar_list_destroy(service_changed_list, true);
service_changed_list = NULL;
}
-
*change_count = chagned_count;
-
_EXTERN_FUNC_EXIT;
-
return root_ptr;
}
{
_EXTERN_FUNC_ENTER;
- _DEBUG_INFO("\n[da_task_plugIn] account_id : %d\n", account_id);
- _DEBUG_INFO("[da_task_plugIn] folder_id : %s\n", folder_id);
- _DEBUG_INFO("[da_task_plugIn] changepoint : %d\n", change_point);
- sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
+ _DEBUG_INFO("\n[task] account_id : %d\n", account_id);
+ _DEBUG_INFO("[task] folder_id : %s\n", folder_id);
+ _DEBUG_INFO("[task] changepoint : %d\n", change_point);
+
int task_time_stamp = change_point;
int temp_folder_id = atoi(folder_id);
- int service_ret = 0;
+ int service_ret = CALENDAR_ERROR_NONE;
calendar_list_h service_changed_list = 0;
calendar_record_h changed_task = NULL;
- sync_agent_plugin_item_node_s *root_ptr = 0;
- sync_agent_plugin_item_node_s *cursor_ptr = 0;
+ sync_agent_plugin_item_node_s *root_ptr = NULL;
+ sync_agent_plugin_item_node_s *cursor_ptr = NULL;
int chagned_count = 0;
int current_change_point = 0;
service_ret = calendar_db_get_changes_by_version(_calendar_todo._uri, temp_folder_id, task_time_stamp, &service_changed_list, ¤t_change_point);
- _DEBUG_INFO("[da_task_plugIn] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
- if ((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL)) {
- _DEBUG_ERROR("calendar_db_get_changes_by_version() Fail! : err = %d", service_ret);
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ _DEBUG_INFO("[task] calendar_db_get_changes_by_version service_ret : %d, input folder id [%d], current change point [%d]", service_ret, temp_folder_id, current_change_point);
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (service_changed_list == NULL), "[task] calendar_db_get_changes_by_version() Fail!: err[%d]", service_ret);
int list_count = 0;
service_ret = calendar_list_get_count(service_changed_list, &list_count);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("[da_task_plugIn] in calendar_list_get_count Fail!\n");
- ret = _convert_service_error_to_common_error(service_ret);
- goto DACI_FINISH;
- }
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_get_count() Fail!: err[%d]", service_ret);
- _DEBUG_INFO("[da_task_plugIn] in calendar_list_get_count [%d]!", list_count);
+ _DEBUG_INFO("[task] in calendar_list_get_count [%d]!", list_count);
if (list_count <= 0) {
- goto DACI_FINISH;
+ goto return_part;
}
service_ret = calendar_list_first(service_changed_list);
- if (service_ret != CALENDAR_ERROR_NONE) {
- _DEBUG_ERROR("calendar_list_first() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
-
- _DEBUG_INFO("[da_task_plugIn] service_ret : %d\n", service_ret);
+ goto_if(service_ret != CALENDAR_ERROR_NONE, "[task] calendar_list_first() Fail!: err[%d]", service_ret);
do {
service_ret = calendar_list_get_current_record_p(service_changed_list, &changed_task);
- if ((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL)) {
- _DEBUG_ERROR("calendar_list_get_current_record_p() Fail! : err = %d", service_ret);
- ret = SYNC_AGENT_DA_ERRORS;
- goto DACI_FINISH;
- }
+ goto_if((service_ret != CALENDAR_ERROR_NONE) && (changed_task == NULL), "[task] calendar_list_get_current_record_p() Fail!: err[%d]", service_ret);
+
int type = 0;
service_ret = calendar_record_get_int(changed_task, _calendar_updated_info.modified_status, &type);
if (service_ret != CALENDAR_ERROR_NONE) {
break;
}
char *task_id_str = g_strdup_printf("%d", task_id);
- _DEBUG_INFO("[da_task_plugIn] CALS_UPDATED_TYPE_MODIFIED : [%s]\n", task_id_str);
+ _DEBUG_INFO("[task] CALS_UPDATED_TYPE_MODIFIED : [%s]\n", task_id_str);
if (root_ptr == NULL) {
root_ptr = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (root_ptr == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
return NULL;
}
root_ptr->item_id = task_id_str;
- root_ptr->next = 0;
+ root_ptr->next = NULL;
cursor_ptr = root_ptr;
} else {
cursor_ptr->next = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
if (cursor_ptr->next == NULL) {
_DEBUG_ERROR("CALLOC failed !!!");
+ if (service_changed_list != NULL) {
+ calendar_list_destroy(service_changed_list, true);
+ service_changed_list = NULL;
+ }
+ if (root_ptr) {
+ free(root_ptr);
+ root_ptr = NULL;
+ }
return NULL;
}
cursor_ptr->next->item_id = task_id_str;
- cursor_ptr->next->next = 0;
+ cursor_ptr->next->next = NULL;
cursor_ptr = cursor_ptr->next;
}
chagned_count++;
}
-
- /*if list can successfully free child than dont need this free */
-// if (changed_task != NULL)
-// calendar_record_destroy(changed_task, true);
} while (calendar_list_next(service_changed_list) != CALENDAR_ERROR_NO_DATA);
- DACI_FINISH:
-
+ return_part:
if (service_changed_list != NULL) {
calendar_list_destroy(service_changed_list, true);
service_changed_list = NULL;
}
-
*change_count = chagned_count;
-
_EXTERN_FUNC_EXIT;
-
return root_ptr;
}
_EXTERN_FUNC_EXIT;
}
+EXPORT_API void sync_agent_plugin_set_callback_delete_child_item(sync_agent_del_child_item_cb_plugin callback)
+{
+ _EXTERN_FUNC_ENTER;
+ callback_delete_child_item = callback;
+ _EXTERN_FUNC_EXIT;
+}
+
EXPORT_API int sync_agent_plugin_get_max_item_count(int folder_type)
{
_EXTERN_FUNC_ENTER;
_INNER_FUNC_ENTER;
if (pthread_mutex_lock(&lockx)) {
- _DEBUG_ERROR("[da_task_plugIn] pthread_mutex_lock error");
+ _DEBUG_ERROR("[task] pthread_mutex_lock error");
}
is_noti_from_me = set_flag;
if (pthread_mutex_unlock(&lockx)) {
- _DEBUG_ERROR("[da_task_plugIn] pthread_mutex_unlock error");
+ _DEBUG_ERROR("[task] pthread_mutex_unlock error");
}
_INNER_FUNC_EXIT;
{
_INNER_FUNC_ENTER;
- _DEBUG_TRACE("[da_task_plugIn] detected task storage changed\n");
+ _DEBUG_TRACE("[task] detected task storage changed\n");
int from_Me = __get_is_noti_from_me();
if (from_Me == 1) {
_set_is_noti_from_me(0);
- _DEBUG_TRACE("[da_task_plugIn] This noti is from Me!! so will be ignored!!\n");
+ _DEBUG_TRACE("[task] This noti is from Me!! so will be ignored!!\n");
return;
}
if (sync_agent_async_queue_length(queue) < 1) {
sync_agent_send_msg_async_queue(queue, (void *)taskVersion);
_DEBUG_INFO("fw_async_queue_length = %d", sync_agent_async_queue_length(queue));
+ } else {
+ _DEBUG_INFO("send_msg_failed... sync_agent_async_queue_length(queue) >= 1");
+ if(taskVersion != NULL) {
+ free(taskVersion);
+ taskVersion = NULL;
+ }
}
_INNER_FUNC_EXIT;
{
_INNER_FUNC_ENTER;
- _DEBUG_TRACE("[da_task_plugIn] Start __rutine_task_Change (create thread)\n");
+ _DEBUG_TRACE("[task] Start __rutine_task_Change (create thread)\n");
/*
* Create Queue
int i = 0;
for (; i < account_list_count; i++) {
int task_account_id = account_list[i];
- _DEBUG_TRACE("[da_task_plugIn] task_account_id : %d, count : %d\n", task_account_id, account_list_count);
- _DEBUG_TRACE("[da_task_plugIn] Before calendar_svc_event_get_changes : %d\n", task_version);
+ _DEBUG_TRACE("[task] task_account_id : %d, count : %d\n", task_account_id, account_list_count);
+ _DEBUG_TRACE("[task] Before calendar_svc_event_get_changes : %d\n", task_version);
/*get folder id */
int folder_list_count = 0;
_DEBUG_ERROR("calendar_list_get_count() Fail! : err = %d", service_ret);
break;
}
- _DEBUG_TRACE("[da_task_plugIn] folder_list_count : %d", folder_list_count);
+ _DEBUG_TRACE("[task] folder_list_count : %d", folder_list_count);
do {
char task_folder_id_str[12];
snprintf(task_folder_id_str, sizeof(task_folder_id_str), "%d", task_folder_id);
- _DEBUG_TRACE("[da_task_plugIn] task Inserted!\n");
- _DEBUG_TRACE("[da_task_plugIn] task folder id : %s\n", task_folder_id_str);
- int result = callback_add_item(account_list[i], i, task_id_str, FW_TASK, task_folder_id_str, 0);
+ _DEBUG_TRACE("[task] task Inserted!\n");
+ _DEBUG_TRACE("[task] task folder id : %s\n", task_folder_id_str);
+ int result = callback_add_item(account_list[i], i, task_id_str, NULL, FW_TASK, task_folder_id_str, 0);
if (!result)
- _DEBUG_TRACE("[da_task_plugIn] Failed to call SA_EH_Add_Item() \n");
+ _DEBUG_TRACE("[task] Failed to call SA_EH_Add_Item() \n");
else
- _DEBUG_TRACE("[da_task_plugIn] Success to call SA_EH_Add_Item() \n");
+ _DEBUG_TRACE("[task] Success to call SA_EH_Add_Item() \n");
}
break;
case CALENDAR_EVENT_MODIFIED_STATUS_UPDATED:
{
- _DEBUG_TRACE("[da_task_plugIn] task Updated!\n");
- int result = callback_update_item(account_list[i], i, task_id_str, FW_TASK);
+ _DEBUG_TRACE("[task] task Updated!\n");
+ int result = callback_update_item(account_list[i], i, task_id_str, NULL, FW_TASK);
if (!result)
- _DEBUG_TRACE("[da_task_plugIn] Failed to call callback_del_item() \n");
+ _DEBUG_TRACE("[task] Failed to call callback_del_item() \n");
}
break;
case CALENDAR_EVENT_MODIFIED_STATUS_DELETED:
{
- _DEBUG_TRACE("[da_task_plugIn] task Deleted!\n");
+ _DEBUG_TRACE("[task] task Deleted!\n");
int result = callback_del_item(account_list[i], i, task_id_str, FW_TASK);
if (!result)
- _DEBUG_TRACE("[da_task_plugIn] Failed to call callback_del_item() \n");
+ _DEBUG_TRACE("[task] Failed to call callback_del_item() \n");
}
break;
default:
- _DEBUG_TRACE("[da_task_plugIn] cached Another task Change Noti!\n");
+ _DEBUG_TRACE("[task] cached Another task Change Noti!\n");
break;
}
-
- /*if list can successfully free child than dont need this free */
-// if (row_event != NULL){
-// calendar_record_destroy(row_event, true);
-// row_event = NULL;
-// }
-
} while (calendar_list_next(record_list) != CALENDAR_ERROR_NO_DATA);
if (record_list != NULL) {
}
record_list = NULL;
}
- /*if list can successfully free child than dont need this free */
-// if (folder != NULL){
-// calendar_record_destroy(folder, true);
-// folder = NULL;
-// }
-
- } while (calendar_list_next(folder_list) != CALENDAR_ERROR_NO_DATA); /*folder iter list */
+ } while (calendar_list_next(folder_list) != CALENDAR_ERROR_NO_DATA);
_DEBUG_TRACE("folder list free");
if (folder_list != NULL) {
folder_list = NULL;
}
- } /*account loop for */
+ }
_DEBUG_TRACE("account list free");
if (account_list != NULL) {
free(account_list);
}
- } /*while (1) */
+ }
- // close calendar service
sync_agent_plugin_close_service();
-
- _DEBUG_TRACE("[da_task_plugIn] End __rutine_task_Change (create thread)\n");
-
+ _DEBUG_TRACE("[task] End __rutine_task_Change (create thread)\n");
_INNER_FUNC_EXIT;
-
return 0;
}
_INNER_FUNC_ENTER;
sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
- _DEBUG_TRACE("[da_task_plugIn] Error Code : %d\n", err);
+ _DEBUG_TRACE("[task] Error Code : %d\n", err);
switch (err) {
+ case CALENDAR_ERROR_NONE:
+ ret = SYNC_AGENT_DA_SUCCESS;
+ break;
+
case CALENDAR_ERROR_INVALID_PARAMETER: /* -4 */
ret = SYNC_AGENT_DA_ERR_INVALID_CONTENT;
break;
}
_INNER_FUNC_EXIT;
-
return ret;
}