Commit 9152d890 authored by Benjamin REIS's avatar Benjamin REIS

only create group chat room if proxy config has a confernce-factory-uri

parent bcc6d586
......@@ -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:@""];
......
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment