Fix “Add to contact” action for encrypted chatrooms

This commit is contained in:
QuentinArguillere 2022-07-08 17:11:12 +02:00
parent 81688b416b
commit 9612e21162

View file

@ -1780,7 +1780,14 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
if (indexPath.row == 0) {
if (isOneToOne) {
[self addOrGoToContact:linphone_chat_room_get_peer_address(_chatRoom)];
if (isEncrypted) {
LinphoneAddress* contactAddress = linphone_address_clone(linphone_participant_get_address(bctbx_list_nth_data(linphone_chat_room_get_participants(_chatRoom), 0)));
linphone_address_clean(contactAddress);
[self addOrGoToContact:contactAddress];
linphone_address_unref(contactAddress);
} else {
[self addOrGoToContact:linphone_chat_room_get_peer_address(_chatRoom)];
}
} else {
[self displayGroupInfo];
}
@ -1838,7 +1845,15 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
if (indexPath.row == 0) {
if (isOneToOne) {
Contact *contact = [FastAddressBook getContactWithAddress:linphone_chat_room_get_peer_address(_chatRoom)];
Contact *contact;
if (isEncrypted) {
LinphoneAddress * contactAddress = linphone_address_clone(linphone_participant_get_address(bctbx_list_nth_data(linphone_chat_room_get_participants(_chatRoom), 0)));
linphone_address_clean(contactAddress);
contact = [FastAddressBook getContactWithAddress:contactAddress];
linphone_address_unref(contactAddress);
} else {
contact = [FastAddressBook getContactWithAddress:linphone_chat_room_get_peer_address(_chatRoom)];
}
if (contact == nil) {
cell.imageView.image = [LinphoneUtils resizeImage:[UIImage imageNamed:@"contact_add_default.png"] newSize:CGSizeMake(20, 25)];
cell.textLabel.text = NSLocalizedString(@"Add to contacts",nil);