#endif
}
-static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, char *minmatch, int person_id, int *find_number_type)
+static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num,
+ char *minmatch, int person_id, int *find_number_type)
{
int ret;
int find_person_id = -1;
return find_person_id;
}
-int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, int candidate_person_id, bool person_link)
+int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id,
+ int candidate_person_id, bool person_link)
{
CTS_FN_CALL;
int ret;
GSList *bind_text = NULL;
GSList *cursor = NULL;
int i = 0;
+ bool need_noti = false;
RETVM_IF(old_person_id <= 0 && NULL == number, CONTACTS_ERROR_INVALID_PARAMETER,
"old person_id (%d), number is NULL", old_person_id);
ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), true);
if (0 < ret) {
char minmatch[sizeof(normal_num)+1];
- ret = ctsvc_get_minmatch_number(normal_num, minmatch, sizeof(minmatch), ctsvc_get_phonenumber_min_match_digit());
+ ret = ctsvc_get_minmatch_number(normal_num, minmatch, sizeof(minmatch),
+ ctsvc_get_phonenumber_min_match_digit());
if (CONTACTS_ERROR_NONE == ret) {
len += snprintf(query+len, sizeof(query)-len,
"OR (minmatch = ? AND _NUMBER_COMPARE_(normal_num, ?, NULL, NULL))) ");
/* CASE : number is inserted (contact insert/update) => update person_id of phone logs from NULL */
if (number && old_person_id <= 0 && 0 < candidate_person_id) {
- __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, candidate_person_id, &number_type);
+ __ctsvc_db_phone_log_find_person_id(address, normal_address,
+ minmatch_address, candidate_person_id, &number_type);
new_person_id = candidate_person_id;
} else if (number && old_person_id <= 0) {
/* CASE : phonelog insert without person_id */
/* address == number */
- new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, -1, &number_type);
- if (new_person_id <= 0) continue;
+ new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address,
+ minmatch_address, -1, &number_type);
+ if (new_person_id <= 0)
+ continue;
} else if (number && 0 < old_person_id) {
/* CASE : number update/delete (contact update/delete) => find new_person_id by address */
/* CASE : phonelog insert with person_id */
/* address == number */
/* although new_person_id and old_person_id are same, update phonelog for setting number_type */
- new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, old_person_id, &number_type);
+ new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address,
+ minmatch_address, old_person_id, &number_type);
} else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id && person_link) {
/* CASE : person link => deleted person_id -> new person_id (base_person_id) */
new_person_id = candidate_person_id;
} else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id) {
/* CASE : person unlink => check person_id of the address, */
/* if person_id is not old_person_id then change person_id to new_person_id */
- temp_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, candidate_person_id, &number_type);
+ temp_id = __ctsvc_db_phone_log_find_person_id(address, normal_address,
+ minmatch_address, candidate_person_id, &number_type);
if (0 < temp_id && temp_id == old_person_id)
continue;
else if (0 < temp_id && temp_id != old_person_id)
* continue;
*/
+ if (!need_noti)
+ need_noti = true;
+
if (0 < new_person_id)
ctsvc_stmt_bind_int(update_log, 1, new_person_id);
if (0 <= number_type)
ctsvc_stmt_finalize(get_log);
ctsvc_stmt_finalize(update_log);
+ if (need_noti)
+ ctsvc_set_phonelog_noti();
+
if (bind_text) {
for (cursor = bind_text; cursor; cursor = cursor->next)
free(cursor->data);