From 14f61e3cef8f474d9afab72f9a255e747f1a6e44 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 10 Jan 2022 12:06:29 +0100 Subject: [PATCH] Enable CPIM in basic chatrooms for linphone accounts --- Classes/LinphoneManager.m | 21 +++++++++++++++++++++ Resources/assistant_linphone_create.rc | 1 + 2 files changed, 22 insertions(+) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 1f9d285b3..b86a4b1fe 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1324,12 +1324,33 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat } } +- (void)activateBasicChatroomCPIMForLinphoneAccounts { + const MSList *accountsList = linphone_core_get_account_list(theLinphoneCore); + while (accountsList) { + LinphoneAccount * account = accountsList->data; + LinphoneAccountParams const * currentParams = linphone_account_get_params(account); + LinphoneAddress const * currentAddress = linphone_account_params_get_identity_address(currentParams); + + if (strcmp(linphone_address_get_domain(currentAddress), "sip.linphone.org") == 0 && !linphone_account_params_cpim_in_basic_chat_room_enabled(currentParams) ) { + + LOGI(@"Enabling CPIM in basic chatroom for user %s", linphone_address_get_username(currentAddress)); + LinphoneAccountParams * newParams = linphone_account_params_clone(linphone_account_get_params(account)); + linphone_account_params_enable_cpim_in_basic_chat_room(newParams, true); + linphone_account_set_params(account, newParams); + linphone_account_params_unref(newParams); + } + + accountsList = accountsList->next; + } +} + - (void)startLinphoneCore { bool corePushEnabled = [self lpConfigIntForKey:@"net" inSection:@"push_notification"]; linphone_core_set_push_notification_enabled([LinphoneManager getLc], corePushEnabled); linphone_core_start([LinphoneManager getLc]); [self configurePushProviderForAccounts]; + [self activateBasicChatroomCPIMForLinphoneAccounts]; } - (void)createLinphoneCore { diff --git a/Resources/assistant_linphone_create.rc b/Resources/assistant_linphone_create.rc index 434a19a72..4328453d5 100644 --- a/Resources/assistant_linphone_create.rc +++ b/Resources/assistant_linphone_create.rc @@ -17,6 +17,7 @@ 1 1 sip:conference-factory@sip.linphone.org + 1