diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index 295a59481..7d9cced7c 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -135,8 +135,17 @@ } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; UIChatCreateCell *cell = [tableView cellForRowAtIndexPath:indexPath]; + + if (!linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(LC))) { + // Create directly a basic chat room if there's no factory uri + bctbx_list_t *addresses = NULL; + addresses = bctbx_list_append(addresses, (void *)cell.addressLabel.text.UTF8String); + [PhoneMainView.instance createChatRoomWithSubject:NULL addresses:addresses andWaitView:NULL]; + return; + } + + [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSInteger index = 0; _searchBar.text = @""; [self searchBar:_searchBar textDidChange:@""]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 6d08523a7..227d0703e 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -435,6 +435,19 @@ static int check_should_migrate_images(void *data, int argc, char **argv, char * linphone_core_set_file_transfer_server(LC, newURL); [self lpConfigSetBool:TRUE forKey:@"file_transfer_migration_done"]; } + const bctbx_list_t * proxies = linphone_core_get_proxy_config_list(LC); + NSString *appDomain = [LinphoneManager.instance lpConfigStringForKey:@"domain_name" + inSection:@"app" + withDefault:@"sip.linphone.org"]; + while (proxies) { + LinphoneProxyConfig *config = proxies->data; + if (!linphone_proxy_config_get_conference_factory_uri(config)) { + if (strcmp(appDomain.UTF8String, linphone_proxy_config_get_domain(config)) == 0) { + linphone_proxy_config_set_conference_factory_uri(config, "sip:conference-factory@sip.linphone.org"); + } + } + proxies = proxies->next; + } } static void migrateWizardToAssistant(const char *entry, void *user_data) { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index c4b374a24..565637674 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -876,6 +876,27 @@ static RootViewManager *rootViewManagerInstance = nil; } - (void)createChatRoomWithSubject:(const char *)subject addresses:(bctbx_list_t *)addresses andWaitView:(UIView *)waitView { + if (!linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(LC))) { + // If there's no factory uri, create a basic chat room + if (bctbx_list_size(addresses) != 1) { + // Display Error: unsuported group chat + UIAlertController *errView = + [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Conversation creation error", nil) + message:NSLocalizedString(@"Group conversation is not supported.", nil) + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *action) {}]; + [errView addAction:defaultAction]; + [self presentViewController:errView animated:YES completion:nil]; + return; + } + LinphoneChatRoom *basicRoom = linphone_core_get_chat_room(LC, addresses->data); + [self goToChatRoom:basicRoom]; + return; + } + _waitView = waitView; _waitView.hidden = NO; LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, subject ?: LINPHONE_DUMMY_SUBJECT);