History: fix history deletions when having multiple consecutive calls

This commit is contained in:
Gautier Pelloux-Prayer 2015-12-08 11:42:29 +01:00
parent 4813b753ff
commit a8e696e613
2 changed files with 11 additions and 6 deletions

View file

@ -122,11 +122,11 @@
LinphoneCallLog *prev = [eventsOnThisDay lastObject] ? [[eventsOnThisDay lastObject] pointerValue] : NULL;
if (prev && linphone_address_weak_equal(linphone_call_log_get_remote_address(prev),
linphone_call_log_get_remote_address(log))) {
long value = (long)linphone_call_log_get_user_data(prev);
value++;
linphone_call_log_set_user_data(prev, (void *)value);
MSList *list = linphone_call_log_get_user_data(prev);
list = ms_list_append(list, log);
linphone_call_log_set_user_data(prev, list);
} else {
linphone_call_log_set_user_data(log, (void *)1);
linphone_call_log_set_user_data(log, NULL);
[eventsOnThisDay addObject:[NSValue valueWithPointer:log]];
}
}
@ -239,6 +239,11 @@
[super removeSelectionUsing:^(NSIndexPath *indexPath) {
id log = [_sections objectForKey:_sortedDays[indexPath.section]][indexPath.row];
LinphoneCallLog *callLog = [log pointerValue];
MSList *count = linphone_call_log_get_user_data(callLog);
while (count) {
linphone_core_remove_call_log([LinphoneManager getLc], count->data);
count = count->next;
}
linphone_core_remove_call_log([LinphoneManager getLc], callLog);
[[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log];
if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) {

View file

@ -96,10 +96,10 @@
[ContactDisplay setDisplayNameLabel:displayNameLabel forAddress:addr];
long count = (long)(linphone_call_log_get_user_data(callLog) ?: 0);
int count = ms_list_size(linphone_call_log_get_user_data(callLog)) + 1;
if (count > 1) {
displayNameLabel.text =
[displayNameLabel.text stringByAppendingString:[NSString stringWithFormat:@" (%ld)", count]];
[displayNameLabel.text stringByAppendingString:[NSString stringWithFormat:@" (%d)", count]];
}
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];