diff options
Diffstat (limited to 'src/plugins/ds-public/xcalllog/src/plugin_interface.c')
-rwxr-xr-x | src/plugins/ds-public/xcalllog/src/plugin_interface.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/src/plugins/ds-public/xcalllog/src/plugin_interface.c b/src/plugins/ds-public/xcalllog/src/plugin_interface.c index 3ba4c05..b2c6889 100755 --- a/src/plugins/ds-public/xcalllog/src/plugin_interface.c +++ b/src/plugins/ds-public/xcalllog/src/plugin_interface.c @@ -187,6 +187,7 @@ static sync_agent_da_return_e _get_calllog_name(int contact_id, char **name) // } else // name = 0; +/* sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS; contacts_error_e err = CONTACTS_ERROR_NONE; contacts_record_h record = NULL; @@ -212,6 +213,103 @@ static sync_agent_da_return_e _get_calllog_name(int contact_id, char **name) _INNER_FUNC_EXIT; return ret; +*/ +//////////////////////////////////////////////////////////////////////////////////// + + sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS; + contacts_error_e err = CONTACTS_ERROR_NONE; + contacts_record_h record = NULL; + + contacts_query_h query = NULL; + contacts_filter_h filter = NULL; + contacts_list_h list = NULL; + int count = 0; + + if (contact_id != 0) { + err = contacts_query_create(_contacts_person_phone_log._uri, &query); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_query_create Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_filter_create(_contacts_person_phone_log._uri, &filter); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_filter_create Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_filter_add_int(filter, _contacts_person_phone_log.person_id, CONTACTS_MATCH_EQUAL, contact_id /* person_id */ ); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_filter_set_int Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_query_set_filter(query, filter); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_query_set_filter Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_db_get_count_with_query(query, &count); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_db_get_count_with_query Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + _DEBUG_INFO("count = %d", count); + + if( count > 0 ) { + err = contacts_db_get_records_with_query(query, 0, 1, &list); + if (err == CONTACTS_ERROR_NONE) { + _DEBUG_INFO("[da_xcalllog_plugIn] contacts_db_get_records_with_query Success!! \n"); + + err = contacts_list_first(list); + if(err == CONTACTS_ERROR_NONE) { + err = contacts_list_get_current_record_p(list, &record); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_list_get_current_record_p Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_record_get_str(record, _contacts_person_phone_log.display_name, name); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_record_get_str Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } else { + _DEBUG_INFO("[da_xcalllog_plugIn] contacts_record_get_str Success !! \n"); + } + } + } + + } else { + name = 0; + } + } + + contacts_query_destroy(query); + contacts_filter_destroy(filter); + contacts_list_destroy(list, true); + + _INNER_FUNC_EXIT; + return ret; + + + GET_FINISH: + + contacts_query_destroy(query); + contacts_filter_destroy(filter); + contacts_list_destroy(list, true); + + *name = 0; + _EXTERN_FUNC_EXIT; + return ret; + } static char *_calllog_put_content(char *vcard_stream, char *content_type, char *content_value) |