disable groupchat capability if it is not set

This commit is contained in:
Danmei Chen 2019-04-23 17:56:30 +02:00
parent ad47d9b24e
commit 319cc03c85
12 changed files with 38 additions and 39 deletions

View file

@ -419,6 +419,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[[LinphoneManager.instance fastAddressBook] fetchContactsInBackGroundThread];
} else
[self displayAssistantConfigurationError];
[LinphoneManager.instance migrationPerAccount];
}
- (void)displayAssistantConfigurationError {

View file

@ -61,6 +61,8 @@ static UICompositeViewDescription *compositeDescription = nil;
selector:@selector(viewUpdateEvent:)
name:kLinphoneChatCreateViewChange
object:nil];
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
_chiffreOptionView.hidden = !(cfg && linphone_proxy_config_get_conference_factory_uri(cfg));
}
- (void)viewUpdateEvent:(NSNotification *)notif {

View file

@ -38,6 +38,8 @@
[_backToCallButton update];
self.tableController.waitView = _waitView;
[self setEditing:NO];
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
_addGroupChatButton.hidden = !(cfg && linphone_proxy_config_get_conference_factory_uri(cfg));
}
- (void)viewWillDisappear:(BOOL)animated {

View file

@ -148,7 +148,8 @@ static UICompositeViewDescription *compositeDescription = nil;
const LinphonePresenceModel *model = contact.friend ? linphone_friend_get_presence_model(contact.friend) : NULL;
_linphoneImage.hidden =
! ((model && linphone_presence_model_get_basic_status(model) == LinphonePresenceBasicStatusOpen) || [FastAddressBook contactHasValidSipDomain:contact]);
[self shouldHideEncryptedChatView:model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
[self shouldHideEncryptedChatView:cfg && linphone_proxy_config_get_conference_factory_uri(cfg) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];
char *addrURI = linphone_address_as_string_uri_only(addr);
ms_free(addrURI);

View file

@ -214,6 +214,7 @@ typedef struct _LinphoneManagerSounds {
- (void)checkNewVersion;
- (void)loadAvatar;
- (void)migrationPerAccount;
@property ProviderDelegate *providerDelegate;

View file

@ -330,8 +330,7 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre
- (void)migrationAllPost {
[self migrationLinphoneSettings];
[self migratePushNotificationPerAccount];
[self migrateLimeSettings];
[self migrationPerAccount];
}
- (void)migrationAllPre {
@ -441,12 +440,28 @@ 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"];
}
if ([self lpConfigBoolForKey:@"lime_migration_done"] == FALSE) {
const MSList *proxies = linphone_core_get_proxy_config_list(LC);
while (proxies) {
if (!strcmp(linphone_proxy_config_get_domain((LinphoneProxyConfig *)proxies->data),"sip.linphone.org")) {
linphone_core_set_lime_x3dh_server_url(LC, "https://lime.linphone.org/lime-server/lime-server.php");
break;
}
proxies = proxies->next;
}
[self lpConfigSetBool:TRUE forKey:@"lime_migration_done"];
}
}
- (void)migrationPerAccount {
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;
// can not create group chat without conference factory
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");
@ -454,15 +469,7 @@ static int check_should_migrate_images(void *data, int argc, char **argv, char *
}
proxies = proxies->next;
}
}
static void migrateWizardToAssistant(const char *entry, void *user_data) {
LinphoneManager *thiz = (__bridge LinphoneManager *)(user_data);
NSString *key = [NSString stringWithUTF8String:entry];
[thiz lpConfigSetString:[thiz lpConfigStringForKey:key inSection:@"wizard"] forKey:key inSection:@"assistant"];
}
- (void)migratePushNotificationPerAccount {
NSString *s = [self lpConfigStringForKey:@"pushnotification_preference"];
if (s && s.boolValue) {
LOGI(@"Migrating push notification per account, enabling for ALL");
@ -476,18 +483,10 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) {
}
}
- (void)migrateLimeSettings {
if ([self lpConfigBoolForKey:@"lime_migration_done"] == FALSE) {
const MSList *proxies = linphone_core_get_proxy_config_list(LC);
while (proxies) {
if (!strcmp(linphone_proxy_config_get_domain((LinphoneProxyConfig *)proxies->data),"sip.linphone.org")) {
linphone_core_set_lime_x3dh_server_url(LC, "https://lime.linphone.org/lime-server/lime-server.php");
break;
}
proxies = proxies->next;
}
[self lpConfigSetBool:TRUE forKey:@"lime_migration_done"];
}
static void migrateWizardToAssistant(const char *entry, void *user_data) {
LinphoneManager *thiz = (__bridge LinphoneManager *)(user_data);
NSString *key = [NSString stringWithUTF8String:entry];
[thiz lpConfigSetString:[thiz lpConfigStringForKey:key inSection:@"wizard"] forKey:key inSection:@"assistant"];
}
#pragma mark - Linphone Core Functions
@ -2372,12 +2371,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
[self iterate];
}
/*linphone_core_enable_friend_list_subscription(LC, enabled && [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]);
const MSList *lists = linphone_core_get_friends_lists(LC);
while (lists) {
linphone_friend_list_enable_subscriptions(lists->data, enabled && [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]);
lists = lists->next;
}*/
linphone_core_enable_friend_list_subscription(LC, enabled && [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]);
}
- (BOOL)enterBackgroundMode {

View file

@ -70,7 +70,8 @@
[FastAddressBook isSipURIValid:_addressLabel.text]));
ContactDetailsView *contactDetailsView = VIEW(ContactDetailsView);
self.inviteButton.hidden = !ENABLE_SMS_INVITE || [[contactDetailsView.contact sipAddresses] count] > 0 || !self.linphoneImage.hidden;
[self shouldHideEncryptedChatView:model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
[self shouldHideEncryptedChatView:cfg && linphone_proxy_config_get_conference_factory_uri(cfg) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];
}
if (addr) {

View file

@ -184,12 +184,8 @@
NSLog(@"error fetching contacts %@",
contactError);
} else {
dispatch_async(dispatch_get_main_queue(), ^{
Contact *newContact = [[Contact alloc] initWithCNContact:contact];
[self registerAddrsFor:newContact];
});
Contact *newContact = [[Contact alloc] initWithCNContact:contact];
[self registerAddrsFor:newContact];
}
}];
}

View file

@ -15,7 +15,6 @@
<entry name="refkey" overwrite="true">push_notification</entry>
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
</section>
<section name="nat_policy_default_values">

View file

@ -15,7 +15,6 @@
<entry name="refkey" overwrite="true">push_notification</entry>
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
</section>
<section name="nat_policy_default_values">

View file

@ -16,6 +16,7 @@ repeat_call_notification=1
display_phone_only=0
auto_download_incoming_files_max_size=0
lime_migration_done=0
use_rls_presence=1
[in_app_purchase]
#set to 1 if in-app purchases are to be shown in the application

View file

@ -22,6 +22,7 @@ send_logs_include_linphonerc_and_chathistory=0
#use_phone_number=0
publish_presence=0
backgroundmode_preference=0
use_rls_presence=1
accept_early_media=0