From 042e37ff93802c76a6ce1510f5f7902d0c59e441 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 15 Jan 2016 16:57:23 +0100 Subject: [PATCH] assistant: do not remove default proxy config before end of assistant and add LC macro --- Classes/AssistantView.h | 2 +- Classes/AssistantView.m | 30 +++++++++---------- Classes/CallConferenceTableView.m | 4 +-- Classes/CallOutgoingView.m | 6 ++-- Classes/CallPausedTableView.m | 6 ++-- Classes/CallSideMenuView.m | 2 +- Classes/CallView.m | 35 +++++++++++------------ Classes/ChatConversationCreateTableView.m | 4 +-- Classes/ChatConversationView.m | 5 ++-- Classes/ChatsListTableView.m | 2 +- Classes/ContactDetailsView.m | 2 +- Classes/DialerView.m | 8 +++--- Classes/FirstLoginView.m | 6 ++-- Classes/HistoryDetailsTableView.m | 2 +- Classes/HistoryDetailsView.m | 4 +-- Classes/HistoryListTableView.m | 10 +++---- Classes/HistoryListView.m | 2 +- Classes/InAppProductsManager.m | 2 +- Classes/LinphoneAppDelegate.m | 18 ++++++------ Classes/LinphoneCoreSettingsStore.m | 20 ++++++------- Classes/LinphoneManager.m | 19 ++++++------ Classes/LinphoneUI/StatusBarView.m | 34 +++++++++++----------- Classes/LinphoneUI/TabBarView.m | 4 +-- Classes/LinphoneUI/UIBackToCallButton.m | 2 +- Classes/LinphoneUI/UICallButton.m | 4 +-- Classes/LinphoneUI/UICallConferenceCell.m | 2 +- Classes/LinphoneUI/UICamSwitch.m | 10 +++---- Classes/LinphoneUI/UIContactDetailsCell.m | 8 +++--- Classes/LinphoneUI/UIDigitButton.m | 10 +++---- Classes/LinphoneUI/UIHangUpButton.m | 4 +-- Classes/LinphoneUI/UIMicroButton.m | 6 ++-- Classes/LinphoneUI/UIPauseButton.m | 16 +++++------ Classes/LinphoneUI/UIVideoButton.m | 10 +++---- Classes/LinphoneUI/VideoZoomHandler.m | 6 ++-- Classes/PhoneMainView.m | 28 +++++++++--------- Classes/SettingsView.m | 31 ++++++++++---------- Classes/SideMenuTableView.m | 8 ++---- Classes/SideMenuView.m | 2 +- Classes/Utils/FastAddressBook.m | 2 +- Classes/Utils/Utils.h | 1 + 40 files changed, 184 insertions(+), 193 deletions(-) diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 524f22643..2ee58224c 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -29,7 +29,7 @@ UIView *nextView; NSMutableArray *historyViews; LinphoneProxyConfig *new_config; - LinphoneProxyConfig *previous_default_config; + int number_of_configs_before; } @property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index df31e2a01..292abd547 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -96,6 +96,7 @@ static UICompositeViewDescription *compositeDescription = nil; new_config = NULL; [self resetTextFields]; [self changeView:_welcomeView back:FALSE animation:FALSE]; + number_of_configs_before = ms_list_size(linphone_core_get_proxy_config_list(LC)); } - (void)viewWillDisappear:(BOOL)animated { @@ -126,9 +127,8 @@ static UICompositeViewDescription *compositeDescription = nil; } [[LinphoneManager instance] resetLinphoneCore]; account_creator = linphone_account_creator_new( - [LinphoneManager getLc], - [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] - .UTF8String); + LC, [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] + .UTF8String); linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self)); linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator), assistant_existence_tested); @@ -139,7 +139,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)loadAssistantConfig:(NSString *)rcFilename { NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]]; - linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String); + linphone_core_set_provisioning_uri(LC, fullPath.UTF8String); [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self resetLiblinphone]; @@ -149,7 +149,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[LinphoneManager instance] removeAllAccounts]; [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LCSipTransports transportValue = {5060, 5060, -1, -1}; if (linphone_core_set_sip_transports(lc, &transportValue)) { @@ -213,7 +213,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)configureProxyConfig { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneManager *lm = [LinphoneManager instance]; // remove previous proxy config, if any @@ -318,15 +318,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)fillDefaultValues { [self resetTextFields]; - LinphoneProxyConfig *current_conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - if (current_conf != NULL) { - if (linphone_proxy_config_find_auth_info(current_conf) != NULL) { - LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); - [self onDialerClick:nil]; - } - } - - LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config(LC); const char *identity = linphone_proxy_config_get_identity(default_conf); if (identity) { LinphoneAddress *default_addr = linphone_address_new(identity); @@ -478,7 +470,7 @@ static UICompositeViewDescription *compositeDescription = nil; if ([inputEntry rangeOfString:@"://"].location == NSNotFound) { inputEntry = [NSString stringWithFormat:@"http://%@", inputEntry]; } - return (linphone_core_set_provisioning_uri([LinphoneManager getLc], inputEntry.UTF8String) != 0); + return (linphone_core_set_provisioning_uri(LC, inputEntry.UTF8String) != 0); } return TRUE; }]; @@ -556,6 +548,12 @@ static UICompositeViewDescription *compositeDescription = nil; switch (status) { case LinphoneConfiguringSuccessful: + // we successfully loaded a remote provisioned config, go to dialer + if (number_of_configs_before < ms_list_size(linphone_core_get_proxy_config_list(LC))) { + LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); + [self onDialerClick:nil]; + } + if (nextView == nil) { [self fillDefaultValues]; } else { diff --git a/Classes/CallConferenceTableView.m b/Classes/CallConferenceTableView.m index 7a5f389a8..71bd14208 100644 --- a/Classes/CallConferenceTableView.m +++ b/Classes/CallConferenceTableView.m @@ -48,7 +48,7 @@ #pragma mark - UITableViewDataSource Functions - (LinphoneCall *)conferenceCallForRow:(NSInteger)row { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int i = -1; while (calls) { if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) { @@ -74,7 +74,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int count = 0; while (calls) { if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) { diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index e167cc01c..a14992e8b 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -53,7 +53,7 @@ static UICompositeViewDescription *compositeDescription = nil; name:kLinphoneBluetoothAvailabilityUpdate object:nil]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (!call) { if (![PhoneMainView.instance popCurrentView]) { [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; @@ -100,9 +100,9 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDeclineClick:(id)sender { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { - linphone_core_terminate_call([LinphoneManager getLc], call); + linphone_core_terminate_call(LC, call); } if (![PhoneMainView.instance popCurrentView]) { [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; diff --git a/Classes/CallPausedTableView.m b/Classes/CallPausedTableView.m index 2f62d8e41..5878d3588 100644 --- a/Classes/CallPausedTableView.m +++ b/Classes/CallPausedTableView.m @@ -54,7 +54,7 @@ #pragma mark - UITableViewDataSource Functions - (LinphoneCall *)conferenceCallForRow:(NSInteger)row { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int i = -1; while (calls) { if (linphone_call_get_state(calls->data) == LinphoneCallPaused) { @@ -81,7 +81,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); int count = 0; int conference_in_pause = 0; while (calls) { @@ -90,7 +90,7 @@ count++; } if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)) && - !linphone_core_is_in_conference([LinphoneManager getLc])) { + !linphone_core_is_in_conference(LC)) { conference_in_pause = 1; } calls = calls->next; diff --git a/Classes/CallSideMenuView.m b/Classes/CallSideMenuView.m index cd46d4ba8..e53fa3ffb 100644 --- a/Classes/CallSideMenuView.m +++ b/Classes/CallSideMenuView.m @@ -134,7 +134,7 @@ } - (void)updateStats:(NSTimer *)timer { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (!call) { _statsLabel.text = NSLocalizedString(@"No call in progress", nil); diff --git a/Classes/CallView.m b/Classes/CallView.m index 1f9694af8..158e96d0d 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -134,7 +134,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self updateUnreadMessage:FALSE]; // Update on show - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state animated:FALSE]; [self hideRoutes:TRUE animated:FALSE]; @@ -144,8 +144,8 @@ static UICompositeViewDescription *compositeDescription = nil; [self callDurationUpdate]; [self onCurrentCallChange]; // Set windows (warn memory leaks) - linphone_core_set_native_video_window_id([LinphoneManager getLc], (__bridge void *)(_videoView)); - linphone_core_set_native_preview_window_id([LinphoneManager getLc], (__bridge void *)(_videoPreview)); + linphone_core_set_native_video_window_id(LC, (__bridge void *)(_videoView)); + linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview)); // Enable tap [singleFingerTap setEnabled:TRUE]; @@ -215,7 +215,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Disable tap [singleFingerTap setEnabled:FALSE]; - if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) { + if (linphone_core_get_calls_nb(LC) == 0) { // reseting speaker button because no more call _speakerButton.selected = FALSE; } @@ -240,7 +240,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)updateBottomBar:(LinphoneCall *)call state:(LinphoneCallState)state { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; [_speakerButton update]; [_microButton update]; @@ -356,7 +356,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { // only show camera switch button if we have more than 1 camera _videoCameraSwitch.hidden = (disabled || !LinphoneManager.instance.frontCamId); - _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled([LinphoneManager getLc])); + _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled(LC)); if (hideControlsTimer != nil) { [hideControlsTimer invalidate]; @@ -379,7 +379,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { [_videoWaitingForFirstImage setHidden:NO]; [_videoWaitingForFirstImage startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); // linphone_call_params_get_used_video_codec return 0 if no video stream enabled if (call != NULL && linphone_call_params_get_used_video_codec(linphone_call_get_current_params(call))) { linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, (__bridge void *)(self)); @@ -403,14 +403,13 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)callDurationUpdate { - int duration = linphone_core_get_current_call([LinphoneManager getLc]) - ? linphone_call_get_duration(linphone_core_get_current_call([LinphoneManager getLc])) - : 0; + int duration = + linphone_core_get_current_call(LC) ? linphone_call_get_duration(linphone_core_get_current_call(LC)) : 0; _durationLabel.text = [LinphoneUtils durationToString:duration]; } - (void)onCurrentCallChange { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); _noActiveCallView.hidden = (call || linphone_core_is_in_conference(lc)); @@ -504,7 +503,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state animated:(BOOL)animated { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; [self updateBottomBar:call state:state]; if (hiddenVolume) { [PhoneMainView.instance setVolumeHidden:FALSE]; @@ -594,7 +593,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { #pragma mark - ActionSheet Functions - (void)displayAskToEnableVideoCall:(LinphoneCall *)call { - if (linphone_core_get_video_policy([LinphoneManager getLc])->automatically_accept) + if (linphone_core_get_video_policy(LC)->automatically_accept) return; NSString *username = [FastAddressBook displayNameForAddress:linphone_call_get_remote_address(call)]; @@ -604,9 +603,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { confirmMessage:NSLocalizedString(@"ACCEPT", nil) onCancelClick:^() { LOGI(@"User declined video proposal"); - if (call == linphone_core_get_current_call([LinphoneManager getLc])) { + if (call == linphone_core_get_current_call(LC)) { LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call)); - linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); + linphone_core_accept_call_update(LC, call, paramsCopy); linphone_call_params_destroy(paramsCopy); [videoDismissTimer invalidate]; videoDismissTimer = nil; @@ -614,10 +613,10 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } onConfirmationClick:^() { LOGI(@"User accept video proposal"); - if (call == linphone_core_get_current_call([LinphoneManager getLc])) { + if (call == linphone_core_get_current_call(LC)) { LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(paramsCopy, TRUE); - linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); + linphone_core_accept_call_update(LC, call, paramsCopy); linphone_call_params_destroy(paramsCopy); [videoDismissTimer invalidate]; videoDismissTimer = nil; @@ -738,7 +737,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { } - (IBAction)onOptionsConferenceClick:(id)sender { - linphone_core_add_all_to_conference([LinphoneManager getLc]); + linphone_core_add_all_to_conference(LC); } #pragma mark - Animation diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index a82b4fa89..0647b128b 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -45,7 +45,7 @@ }]; // also add current entry, if not listed NSString *nsuri = filter.lowercaseString; - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], nsuri.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, nsuri.UTF8String); if (addr) { char *uri = linphone_address_as_string(addr); nsuri = [NSString stringWithUTF8String:uri]; @@ -81,7 +81,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri( - [LinphoneManager getLc], ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String); + LC, ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String); if (!room) { [PhoneMainView.instance popCurrentView]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid address", nil) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 84902ccf4..28d1a1450 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -124,7 +124,7 @@ static UICompositeViewDescription *compositeDescription = nil; } [[_tableController tableView] reloadData]; - BOOL fileSharingEnabled = linphone_core_get_file_transfer_server([LinphoneManager getLc]) != NULL; + BOOL fileSharingEnabled = linphone_core_get_file_transfer_server(LC) != NULL; [_pictureButton setEnabled:fileSharingEnabled]; [self callUpdateEvent:nil]; @@ -182,8 +182,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)callUpdateEvent:(NSNotification *)notif { - _callButton.hidden = - (_tableController.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) != NULL); + _callButton.hidden = (_tableController.isEditing || linphone_core_get_current_call(LC) != NULL); } - (void)update { diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 8ed558546..045ad8ce0 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -82,7 +82,7 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo - (MSList *)sortChatRooms { MSList *sorted = nil; - const MSList *unsorted = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *unsorted = linphone_core_get_chat_rooms(LC); const MSList *iter = unsorted; while (iter) { diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 16d493c32..1cb0ba878 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -131,7 +131,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info } - (void)addCurrentContactContactField:(NSString *)address { - LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String); + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, address.UTF8String); NSString *username = linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address; diff --git a/Classes/DialerView.m b/Classes/DialerView.m index bf96f1f38..8b21dc18c 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -116,7 +116,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Update on show LinphoneManager *mgr = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state]; @@ -222,7 +222,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)coreUpdateEvent:(NSNotification *)notif { if (IPAD) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_video_display_enabled(lc) && linphone_core_video_preview_enabled(lc)) { linphone_core_set_native_preview_window_id(lc, (__bridge void *)(videoPreview)); [backgroundView setHidden:FALSE]; @@ -327,7 +327,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - - (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; BOOL callInProgress = (linphone_core_get_calls_nb(lc) > 0); addCallButton.hidden = (!callInProgress || transferMode); transferButton.hidden = (!callInProgress || !transferMode); @@ -342,7 +342,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)setTransferMode:(BOOL)atransferMode { transferMode = atransferMode; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0; [self callUpdate:call state:state]; } diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m index a0dd66fb7..c4ab68a66 100644 --- a/Classes/FirstLoginView.m +++ b/Classes/FirstLoginView.m @@ -60,7 +60,7 @@ static UICompositeViewDescription *compositeDescription = nil; [_passwordField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_password"]]; // Update on show - const MSList *list = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *list = linphone_core_get_proxy_config_list(LC); if (list != NULL) { LinphoneProxyConfig *config = (LinphoneProxyConfig *)list->data; if (config) { @@ -108,7 +108,7 @@ static UICompositeViewDescription *compositeDescription = nil; siteUrl = @"http://www.linphone.org"; } [_siteButton setTitle:siteUrl forState:UIControlStateNormal]; - account_creator = linphone_account_creator_new([LinphoneManager getLc], siteUrl.UTF8String); + account_creator = linphone_account_creator_new(LC, siteUrl.UTF8String); } - (void)shouldEnableNextButton { @@ -170,7 +170,7 @@ static UICompositeViewDescription *compositeDescription = nil; domain:_domainField.text OnSuccess:^(NSString *url) { if (url) { - linphone_core_set_provisioning_uri([LinphoneManager getLc], url.UTF8String); + linphone_core_set_provisioning_uri(LC, url.UTF8String); [[LinphoneManager instance] resetLinphoneCore]; } else { _waitView.hidden = YES; diff --git a/Classes/HistoryDetailsTableView.m b/Classes/HistoryDetailsTableView.m index 998b26949..c0a7a3dab 100644 --- a/Classes/HistoryDetailsTableView.m +++ b/Classes/HistoryDetailsTableView.m @@ -20,7 +20,7 @@ } if (peer) { - const MSList *logs = linphone_core_get_call_history_for_address([LinphoneManager getLc], peer); + const MSList *logs = linphone_core_get_call_history_for_address(LC, peer); while (logs != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)logs->data; if (linphone_address_weak_equal(linphone_call_log_get_remote_address(log), peer)) { diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index ca8f5468f..291e5a135 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -100,7 +100,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Look for the call log callLog = NULL; if (_callLogId) { - const MSList *list = linphone_core_get_call_logs([LinphoneManager getLc]); + const MSList *list = linphone_core_get_call_logs(LC); while (list != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)list->data; const char *cid = linphone_call_log_get_call_id(log); @@ -184,7 +184,7 @@ static UICompositeViewDescription *compositeDescription = nil; [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; - LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr); + LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; } diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 807d4fa35..565d1b1f8 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -110,7 +110,7 @@ } } - const MSList *logs = linphone_core_get_call_logs([LinphoneManager getLc]); + const MSList *logs = linphone_core_get_call_logs(LC); self.sections = [NSMutableDictionary dictionary]; while (logs != NULL) { LinphoneCallLog *log = (LinphoneCallLog *)logs->data; @@ -248,10 +248,10 @@ LinphoneCallLog *callLog = [log pointerValue]; MSList *count = linphone_call_log_get_user_data(callLog); while (count) { - linphone_core_remove_call_log([LinphoneManager getLc], count->data); + linphone_core_remove_call_log(LC, count->data); count = count->next; } - linphone_core_remove_call_log([LinphoneManager getLc], callLog); + linphone_core_remove_call_log(LC, callLog); linphone_call_log_unref(callLog); [[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log]; if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) { @@ -273,10 +273,10 @@ LinphoneCallLog *callLog = [log pointerValue]; MSList *count = linphone_call_log_get_user_data(callLog); while (count) { - linphone_core_remove_call_log([LinphoneManager getLc], count->data); + linphone_core_remove_call_log(LC, count->data); count = count->next; } - linphone_core_remove_call_log([LinphoneManager getLc], callLog); + linphone_core_remove_call_log(LC, callLog); linphone_call_log_unref(callLog); [[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log]; if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) { diff --git a/Classes/HistoryListView.m b/Classes/HistoryListView.m index 72fd365ca..06bb528be 100644 --- a/Classes/HistoryListView.m +++ b/Classes/HistoryListView.m @@ -58,7 +58,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self onEditionChangeClick:nil]; // Reset missed call - linphone_core_reset_missed_calls_count([LinphoneManager getLc]); + linphone_core_reset_missed_calls_count(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; } diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 44e04d504..3f3bc3360 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -299,7 +299,7 @@ - (NSString *)getPhoneNumber { NSString *phoneNumber = @""; - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); if (config) { const char *identity = linphone_proxy_config_get_identity(config); if (identity) { diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 9e2d3e3b1..7e4f664ee 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -53,7 +53,7 @@ - (void)applicationWillResignActive:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); if (call) { @@ -84,7 +84,7 @@ [instance becomeActive]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *call = linphone_core_get_current_call(lc); if (call) { @@ -220,13 +220,13 @@ - (void)applicationWillTerminate:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - linphone_core_terminate_all_calls([LinphoneManager getLc]); + linphone_core_terminate_all_calls(LC); // destroyLinphoneCore automatically unregister proxies but if we are using // remote push notifications, we want to continue receiving them if ([LinphoneManager instance].pushNotificationToken != nil) { // trick me! setting network reachable to false will avoid sending unregister - linphone_core_set_network_reachable([LinphoneManager getLc], FALSE); + linphone_core_set_network_reachable(LC, FALSE); } [[LinphoneManager instance] destroyLinphoneCore]; } @@ -276,7 +276,7 @@ NSString *loc_key = [alert objectForKey:@"loc-key"]; /*if we receive a remote notification, it is probably because our TCP background socket was no more working. As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/ - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_calls(lc) == NULL) { // if there are calls, obviously our TCP socket shall be working linphone_core_set_network_reachable(lc, FALSE); [LinphoneManager instance].connectivity = none; /*force connectivity to be discovered again*/ @@ -311,7 +311,7 @@ } - (LinphoneChatRoom *)findChatRoomForContact:(NSString *)contact { - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); const char *from = [contact UTF8String]; while (rooms) { const LinphoneAddress *room_from_address = linphone_chat_room_get_peer_address((LinphoneChatRoom *)rooms->data); @@ -373,7 +373,7 @@ userInfo:nil repeats:FALSE]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // If no call is yet received at this time, then force Linphone to drop the current socket and make new one to // register, so that we get // a better chance to receive the INVITE. @@ -411,7 +411,7 @@ LOGI(@"%@", NSStringFromSelector(_cmd)); if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LOGI(@"%@", NSStringFromSelector(_cmd)); if ([notification.category isEqualToString:@"incoming_call"]) { if ([identifier isEqualToString:@"answer"]) { @@ -511,7 +511,7 @@ selector:@selector(ConfigurationStateUpdateEvent:) name:kLinphoneConfiguringStateUpdate object:nil]; - linphone_core_set_provisioning_uri([LinphoneManager getLc], [configURL UTF8String]); + linphone_core_set_provisioning_uri(LC, [configURL UTF8String]); [[LinphoneManager instance] destroyLinphoneCore]; [[LinphoneManager instance] startLinphoneCore]; } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index c6a9269f3..528fcb247 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -99,7 +99,7 @@ } - (void)transformCodecsToKeys:(const MSList *)codecs { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; const MSList *elem = codecs; for (; elem != NULL; elem = elem->next) { @@ -115,7 +115,7 @@ } - (void)transformAccountToKeys:(NSString *)username { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; const MSList *proxies = linphone_core_get_proxy_config_list(lc); while (username && proxies && strcmp(username.UTF8String, @@ -219,11 +219,11 @@ - (void)transformLinphoneCoreToKeys { LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // root section { - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); int count = ms_list_size(accounts); for (int i = 1; i <= count; i++, accounts = accounts->next) { NSString *key = [NSString stringWithFormat:@"menu_account_%d", i]; @@ -348,7 +348,7 @@ // tunnel section if (linphone_core_tunnel_available()) { - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); [self setObject:[lm lpConfigStringForKey:@"tunnel_mode_preference" withDefault:@"off"] forKey:@"tunnel_mode_preference"]; const MSList *configs = linphone_tunnel_get_servers(tunnel); @@ -400,7 +400,7 @@ - (void)synchronizeAccounts { LOGI(@"Account changed, synchronizing."); LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneProxyConfig *proxyCfg = NULL; NSString *error = nil; @@ -577,7 +577,7 @@ } - (void)synchronizeCodecs:(const MSList *)codecs { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; PayloadType *pt; const MSList *elem; @@ -590,7 +590,7 @@ - (BOOL)synchronize { LinphoneManager *lm = [LinphoneManager instance]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; // root section { BOOL account_changed = NO; @@ -758,7 +758,7 @@ NSString *lTunnelPrefMode = [self stringForKey:@"tunnel_mode_preference"]; NSString *lTunnelPrefAddress = [self stringForKey:@"tunnel_address_preference"]; int lTunnelPrefPort = [self integerForKey:@"tunnel_port_preference"]; - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); TunnelMode mode = tunnel_off; int lTunnelPort = 443; if (lTunnelPrefPort) { @@ -841,7 +841,7 @@ } - (void)removeAccount { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneProxyConfig *config = ms_list_nth_data(linphone_core_get_proxy_config_list(lc), [self integerForKey:@"current_proxy_config_preference"]); diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 2034050bd..951e2fbf9 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -519,9 +519,8 @@ exit_dbmigration: /* File transfer migration */ if ([self lpConfigBoolForKey:@"file_transfer_migration_done"] == FALSE) { const char *newURL = "https://www.linphone.org:444/lft.php"; - LOGI(@"Migrating sharing server url from %s to %s", - linphone_core_get_file_transfer_server([LinphoneManager getLc]), newURL); - linphone_core_set_file_transfer_server([LinphoneManager getLc], newURL); + LOGI(@"Migrating sharing server url from %s to %s", linphone_core_get_file_transfer_server(LC), newURL); + linphone_core_set_file_transfer_server(LC, newURL); [self lpConfigSetBool:TRUE forKey:@"file_transfer_migration_done"]; } } @@ -905,7 +904,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char LinphoneAuthInfo *info = linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL, realm.UTF8String, domain.UTF8String); - linphone_core_add_auth_info([LinphoneManager getLc], info); + linphone_core_add_auth_info(LC, info); [LinphoneManager.instance refreshRegisters]; }]; [alertView addButtonWithTitle:NSLocalizedString(@"Go to settings", nil) @@ -1162,7 +1161,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach lm.connectivity = none; [LinphoneManager kickOffNetworkConnection]; } else { - LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]); + LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC); Connectivity newConnectivity; BOOL isWifiOnly = [lm lpConfigBoolForKey:@"wifi_only_preference" withDefault:FALSE]; if (!ctx || ctx->testWWan) @@ -1944,7 +1943,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { // Continue by checking that the provided address is a valid SIP address, abort otherwise. if ([address length] == 0) { // no address provided... nothing to do - } else if ((addr = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String)) == NULL) { + } else if ((addr = linphone_core_interpret_url(LC, address.UTF8String)) == NULL) { UIAlertView *error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address", nil) message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a " @@ -2078,7 +2077,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { + (int)unreadMessageCount { int count = 0; - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); const MSList *item = rooms; while (item) { LinphoneChatRoom *room = (LinphoneChatRoom *)item->data; @@ -2347,15 +2346,15 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { #pragma mark - - (void)removeAllAccounts { - linphone_core_clear_proxy_config([LinphoneManager getLc]); - linphone_core_clear_all_auth_info([LinphoneManager getLc]); + linphone_core_clear_proxy_config(LC); + linphone_core_clear_all_auth_info(LC); } + (BOOL)isMyself:(const LinphoneAddress *)addr { if (!addr) return NO; - const MSList *it = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *it = linphone_core_get_proxy_config_list(LC); while (it) { if (linphone_address_weak_equal(addr, linphone_proxy_config_get_identity_address(it->data))) { return YES; diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m index 6457645a0..524d80989 100644 --- a/Classes/LinphoneUI/StatusBarView.m +++ b/Classes/LinphoneUI/StatusBarView.m @@ -66,12 +66,11 @@ object:nil]; // Update to default state - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - messagesUnreadCount = - lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", 0); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); + messagesUnreadCount = lp_config_get_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", 0); [self proxyConfigUpdate:config]; - [self updateUI:linphone_core_get_calls_nb([LinphoneManager getLc])]; + [self updateUI:linphone_core_get_calls_nb(LC)]; [self updateVoicemail]; } @@ -102,7 +101,7 @@ #pragma mark - Event Functions - (void)registrationUpdate:(NSNotification *)notif { - LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC); [self proxyConfigUpdate:config]; } @@ -111,7 +110,7 @@ } - (void)onCallEncryptionChanged:(NSNotification *)notif { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) && @@ -139,8 +138,7 @@ LOGI(@"Received new NOTIFY from voice mail: there is/are now %d message(s) unread", messagesUnreadCount); // save in lpconfig for future - lp_config_set_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", - messagesUnreadCount); + lp_config_set_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", messagesUnreadCount); [self updateVoicemail]; } @@ -152,7 +150,7 @@ - (void)callUpdate:(NSNotification *)notif { // show voice mail only when there is no call - [self updateUI:linphone_core_get_calls([LinphoneManager getLc]) != NULL]; + [self updateUI:linphone_core_get_calls(LC) != NULL]; [self updateVoicemail]; } @@ -174,7 +172,7 @@ - (void)proxyConfigUpdate:(LinphoneProxyConfig *)config { LinphoneRegistrationState state = LinphoneRegistrationNone; NSString *message = nil; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneGlobalState gstate = linphone_core_get_global_state(lc); if (gstate == LinphoneGlobalConfiguring) { @@ -182,7 +180,7 @@ } else if (config == NULL) { state = LinphoneRegistrationNone; if (linphone_core_get_proxy_config_list(lc) != NULL) { - if (linphone_core_is_network_reachable([LinphoneManager getLc])) { + if (linphone_core_is_network_reachable(LC)) { message = NSLocalizedString(@"No default account", nil); } else { message = NSLocalizedString(@"Network down", nil); @@ -258,7 +256,7 @@ BOOL pending = false; BOOL security = true; - const MSList *list = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *list = linphone_core_get_calls(LC); if (list == NULL) { if (securityDialog) { [securityDialog dismiss]; @@ -285,7 +283,7 @@ } - (void)callQualityUpdate { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { int quality = MIN(4, floor(linphone_call_get_average_quality(call))); NSString *accessibilityValue = [NSString stringWithFormat:NSLocalizedString(@"Call quality: %d", nil), quality]; @@ -304,8 +302,8 @@ #pragma mark - Action Functions - (IBAction)onSecurityClick:(id)sender { - if (linphone_core_get_calls_nb([LinphoneManager getLc])) { - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + if (linphone_core_get_calls_nb(LC)) { + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); @@ -319,13 +317,13 @@ cancelMessage:NSLocalizedString(@"DENY", nil) confirmMessage:NSLocalizedString(@"ACCEPT", nil) onCancelClick:^() { - if (linphone_core_get_current_call([LinphoneManager getLc]) == call) { + if (linphone_core_get_current_call(LC) == call) { linphone_call_set_authentication_token_verified(call, NO); } weakSelf->securityDialog = nil; } onConfirmationClick:^() { - if (linphone_core_get_current_call([LinphoneManager getLc]) == call) { + if (linphone_core_get_current_call(LC) == call) { linphone_call_set_authentication_token_verified(call, YES); } weakSelf->securityDialog = nil; @@ -342,7 +340,7 @@ } - (IBAction)onRegistrationStateClick:(id)sender { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_default_proxy_config(lc)) { linphone_core_refresh_registers(lc); } else if (linphone_core_get_proxy_config_list(lc)) { diff --git a/Classes/LinphoneUI/TabBarView.m b/Classes/LinphoneUI/TabBarView.m index af0c6fbc8..49478bcdf 100644 --- a/Classes/LinphoneUI/TabBarView.m +++ b/Classes/LinphoneUI/TabBarView.m @@ -56,7 +56,7 @@ - (void)callUpdate:(NSNotification *)notif { // LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue]; // LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue]; - [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:TRUE]; + [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:TRUE]; } - (void)changeViewEvent:(NSNotification *)notif { @@ -74,7 +74,7 @@ - (void)update:(BOOL)appear { [self updateSelectedButton:[PhoneMainView.instance currentView]]; - [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:appear]; + [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:appear]; [self updateUnreadMessage:appear]; } diff --git a/Classes/LinphoneUI/UIBackToCallButton.m b/Classes/LinphoneUI/UIBackToCallButton.m index 20e25fabc..a85002303 100644 --- a/Classes/LinphoneUI/UIBackToCallButton.m +++ b/Classes/LinphoneUI/UIBackToCallButton.m @@ -31,7 +31,7 @@ } - (void)update { - self.hidden = (_tableView.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) == NULL); + self.hidden = (_tableView.isEditing || linphone_core_get_current_call(LC) == NULL); } - (IBAction)onBackToCallClick:(id)sender { diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 184b5c20c..5269de7bf 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -61,7 +61,7 @@ - (void)touchUp:(id)sender { NSString *address = addressField.text; if (address.length == 0) { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(lc); if (log) { LinphoneAddress *to = linphone_call_log_get_to(log); @@ -96,7 +96,7 @@ } - (void)updateVideoPolicy { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_video_capture_enabled(lc) && linphone_core_get_video_policy(lc)->automatically_initiate) { [self setImage:[UIImage imageNamed:@"call_video_start_default.png"] forState:UIControlStateNormal]; [self setImage:[UIImage imageNamed:@"call_video_start_disabled.png"] forState:UIControlStateDisabled]; diff --git a/Classes/LinphoneUI/UICallConferenceCell.m b/Classes/LinphoneUI/UICallConferenceCell.m index 6470df9cf..ce2dde8f8 100644 --- a/Classes/LinphoneUI/UICallConferenceCell.m +++ b/Classes/LinphoneUI/UICallConferenceCell.m @@ -43,6 +43,6 @@ } - (IBAction)onKickClick:(id)sender { - linphone_core_remove_from_conference([LinphoneManager getLc], _call); + linphone_core_remove_from_conference(LC, _call); } @end diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index 67d36e2cc..ae606a272 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -34,8 +34,8 @@ INIT_WITH_COMMON_CF { #pragma mark - - (void)touchUp:(id)sender { - const char *currentCamId = (char *)linphone_core_get_video_device([LinphoneManager getLc]); - const char **cameras = linphone_core_get_video_devices([LinphoneManager getLc]); + const char *currentCamId = (char *)linphone_core_get_video_device(LC); + const char **cameras = linphone_core_get_video_devices(LC); const char *newCamId = NULL; int i; @@ -49,10 +49,10 @@ INIT_WITH_COMMON_CF { } if (newCamId) { LOGI(@"Switching from [%s] to [%s]", currentCamId, newCamId); - linphone_core_set_video_device([LinphoneManager getLc], newCamId); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + linphone_core_set_video_device(LC, newCamId); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call != NULL) { - linphone_core_update_call([LinphoneManager getLc], call, NULL); + linphone_core_update_call(LC, call, NULL); } } } diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m index 2d301fdbd..e4c023f51 100644 --- a/Classes/LinphoneUI/UIContactDetailsCell.m +++ b/Classes/LinphoneUI/UIContactDetailsCell.m @@ -43,7 +43,7 @@ - (void)setAddress:(NSString *)address { _addressLabel.text = _editTextfield.text = address; - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); _chatButton.enabled = _callButton.enabled = (addr != NULL); _chatButton.accessibilityLabel = @@ -75,7 +75,7 @@ } - (IBAction)onCallClick:(id)event { - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); if (addr == NULL) return; char *lAddress = linphone_address_as_string_uri_only(addr); @@ -89,13 +89,13 @@ } - (IBAction)onChatClick:(id)event { - LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String); + LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String); if (addr == NULL) return; [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription]; ChatConversationView *view = VIEW(ChatConversationView); [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; - LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr); + LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr); [view setChatRoom:room]; linphone_address_destroy(addr); } diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index 700b15faa..af417e17d 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -64,18 +64,18 @@ #pragma mark - Actions Functions - (void)touchDown:(id)sender { - if (addressField && (!dtmf || !linphone_core_in_call([LinphoneManager getLc]))) { + if (addressField && (!dtmf || !linphone_core_in_call(LC))) { NSString *newAddress = [NSString stringWithFormat:@"%@%c", addressField.text, digit]; [addressField setText:newAddress]; - linphone_core_play_dtmf([LinphoneManager getLc], digit, -1); + linphone_core_play_dtmf(LC, digit, -1); } else { - linphone_call_send_dtmf(linphone_core_get_current_call([LinphoneManager getLc]), digit); - linphone_core_play_dtmf([LinphoneManager getLc], digit, 100); + linphone_call_send_dtmf(linphone_core_get_current_call(LC), digit); + linphone_core_play_dtmf(LC, digit, 100); } } - (void)touchUp:(id)sender { - linphone_core_stop_dtmf([LinphoneManager getLc]); + linphone_core_stop_dtmf(LC); } @end diff --git a/Classes/LinphoneUI/UIHangUpButton.m b/Classes/LinphoneUI/UIHangUpButton.m index 47e4b2c3b..665ed00e6 100644 --- a/Classes/LinphoneUI/UIHangUpButton.m +++ b/Classes/LinphoneUI/UIHangUpButton.m @@ -76,7 +76,7 @@ #pragma mark - - (void)update { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (linphone_core_get_calls_nb(lc) == 1 || // One call linphone_core_get_current_call(lc) != NULL || // In call linphone_core_is_in_conference(lc) || // In conference @@ -91,7 +91,7 @@ #pragma mark - Action Functions - (void)touchUp:(id)sender { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentcall = linphone_core_get_current_call(lc); if (linphone_core_is_in_conference(lc) || // In conference (linphone_core_get_conference_size(lc) > 0 && [UIHangUpButton callCount:lc] == 0) // Only one conf diff --git a/Classes/LinphoneUI/UIMicroButton.m b/Classes/LinphoneUI/UIMicroButton.m index 80a1cc13e..8a4944a69 100644 --- a/Classes/LinphoneUI/UIMicroButton.m +++ b/Classes/LinphoneUI/UIMicroButton.m @@ -24,15 +24,15 @@ @implementation UIMicroButton - (void)onOn { - linphone_core_enable_mic([LinphoneManager getLc], false); + linphone_core_enable_mic(LC, false); } - (void)onOff { - linphone_core_enable_mic([LinphoneManager getLc], true); + linphone_core_enable_mic(LC, true); } - (bool)onUpdate { - return !linphone_core_mic_enabled([LinphoneManager getLc]); + return !linphone_core_mic_enabled(LC); } @end diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index d10999eab..c390d056a 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -75,7 +75,7 @@ } + (LinphoneCall *)getCall { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentCall = linphone_core_get_current_call(lc); if (currentCall == nil && linphone_core_get_calls_nb(lc) == 1) { currentCall = (LinphoneCall *)linphone_core_get_calls(lc)->data; @@ -96,14 +96,14 @@ switch (type) { case UIPauseButtonType_Call: { if (call != nil) { - linphone_core_pause_call([LinphoneManager getLc], call); + linphone_core_pause_call(LC, call); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } case UIPauseButtonType_Conference: { - linphone_core_leave_conference([LinphoneManager getLc]); + linphone_core_leave_conference(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; @@ -112,7 +112,7 @@ case UIPauseButtonType_CurrentCall: { LinphoneCall *currentCall = [UIPauseButton getCall]; if (currentCall != nil) { - linphone_core_pause_call([LinphoneManager getLc], currentCall); + linphone_core_pause_call(LC, currentCall); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } @@ -125,14 +125,14 @@ switch (type) { case UIPauseButtonType_Call: { if (call != nil) { - linphone_core_resume_call([LinphoneManager getLc], call); + linphone_core_resume_call(LC, call); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } case UIPauseButtonType_Conference: { - linphone_core_enter_conference([LinphoneManager getLc]); + linphone_core_enter_conference(LC); // Fake event [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self]; break; @@ -140,7 +140,7 @@ case UIPauseButtonType_CurrentCall: { LinphoneCall *currentCall = [UIPauseButton getCall]; if (currentCall != nil) { - linphone_core_resume_call([LinphoneManager getLc], currentCall); + linphone_core_resume_call(LC, currentCall); } else { LOGW(@"Cannot toggle pause buttton, because no current call"); } @@ -151,7 +151,7 @@ - (bool)onUpdate { bool ret = false; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *c = call; switch (type) { case UIPauseButtonType_Conference: { diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index 0c1f5aebe..04e298e63 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -33,7 +33,7 @@ INIT_WITH_COMMON_CF { } - (void)onOn { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (!linphone_core_video_display_enabled(lc)) return; @@ -41,7 +41,7 @@ INIT_WITH_COMMON_CF { [self setEnabled:FALSE]; [waitView startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { LinphoneCallAppData *callAppData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); callAppData->videoRequested = @@ -56,7 +56,7 @@ INIT_WITH_COMMON_CF { } - (void)onOff { - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; if (!linphone_core_video_display_enabled(lc)) return; @@ -64,7 +64,7 @@ INIT_WITH_COMMON_CF { [self setEnabled:FALSE]; [waitView startAnimating]; - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { LinphoneCallParams *call_params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(call_params, FALSE); @@ -77,7 +77,7 @@ INIT_WITH_COMMON_CF { - (bool)onUpdate { bool video_enabled = false; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LinphoneCall *currentCall = linphone_core_get_current_call(lc); if (linphone_core_video_supported(lc)) { if (linphone_core_video_display_enabled(lc) && currentCall && !linphone_call_media_in_progress(currentCall) && diff --git a/Classes/LinphoneUI/VideoZoomHandler.m b/Classes/LinphoneUI/VideoZoomHandler.m index 85c4940f8..87a62126a 100644 --- a/Classes/LinphoneUI/VideoZoomHandler.m +++ b/Classes/LinphoneUI/VideoZoomHandler.m @@ -36,7 +36,7 @@ } else { cx = cy = 0.5; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &cx, &cy); + linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &cx, &cy); } - (void)videoPan:(UIPanGestureRecognizer *)reco { @@ -58,7 +58,7 @@ return; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &x, &y); + linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &x, &y); cx = x; cy = y; } @@ -82,7 +82,7 @@ return; } - linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), s, &cx, &cy); + linphone_call_zoom_video(linphone_core_get_current_call(LC), s, &cx, &cy); } - (void)resetZoom { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 48ec5cb01..19ce95a01 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -288,7 +288,7 @@ static RootViewManager *rootViewManagerInstance = nil; LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue]; static BOOL already_shown = FALSE; if (state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned) { - LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config(LC); if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) { already_shown = TRUE; AssistantView *view = VIEW(AssistantView); @@ -338,7 +338,7 @@ static RootViewManager *rootViewManagerInstance = nil; [self displayCallError:call message:message]; } case LinphoneCallEnd: { - const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]); + const MSList *calls = linphone_core_get_calls(LC); if (calls == NULL) { // if ((currentView == CallView.compositeViewDescription) || // (currentView == CallIncomingView.compositeViewDescription) || @@ -350,7 +350,7 @@ static RootViewManager *rootViewManagerInstance = nil; // [self popCurrentView]; // } } else { - linphone_core_resume_call([LinphoneManager getLc], (LinphoneCall *)calls->data); + linphone_core_resume_call(LC, (LinphoneCall *)calls->data); [self changeCurrentView:CallView.compositeViewDescription]; } break; @@ -375,7 +375,7 @@ static RootViewManager *rootViewManagerInstance = nil; #pragma mark - - (void)orientationUpdate:(UIInterfaceOrientation)orientation { - int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]); + int oldLinphoneOrientation = linphone_core_get_device_rotation(LC); int newRotation = 0; switch (orientation) { case UIInterfaceOrientationPortrait: @@ -394,18 +394,18 @@ static RootViewManager *rootViewManagerInstance = nil; newRotation = oldLinphoneOrientation; } if (oldLinphoneOrientation != newRotation) { - linphone_core_set_device_rotation([LinphoneManager getLc], newRotation); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + linphone_core_set_device_rotation(LC, newRotation); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { // Orientation has changed, must call update call - linphone_core_update_call([LinphoneManager getLc], call, NULL); + linphone_core_update_call(LC, call, NULL); } } } - (void)startUp { LinphoneCore *core = nil; @try { - core = [LinphoneManager getLc]; + core = LC; LinphoneManager *lm = [LinphoneManager instance]; if (linphone_core_get_global_state(core) != LinphoneGlobalOn) { [self changeCurrentView:DialerView.compositeViewDescription]; @@ -431,9 +431,9 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)updateApplicationBadgeNumber { int count = 0; - count += linphone_core_get_missed_calls_count([LinphoneManager getLc]); + count += linphone_core_get_missed_calls_count(LC); count += [LinphoneManager unreadMessageCount]; - count += linphone_core_get_calls_nb([LinphoneManager getLc]); + count += linphone_core_get_calls_nb(LC); [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count]; } @@ -616,7 +616,7 @@ static RootViewManager *rootViewManagerInstance = nil; NSString *lTitle; // get default proxy - LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config(LC); if (proxyCfg == nil) { lMessage = NSLocalizedString(@"Please make sure your device is connected to the internet and double check your " @"SIP account configuration in the settings.", @@ -700,7 +700,7 @@ static RootViewManager *rootViewManagerInstance = nil; UIDeviceBatteryState state = [UIDevice currentDevice].batteryState; LOGD(@"Battery state:%d level:%.2f", state, level); - LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); + LinphoneCall *call = linphone_core_get_current_call(LC); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { LinphoneCallAppData *callData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); if (callData != nil) { @@ -717,7 +717,7 @@ static RootViewManager *rootViewManagerInstance = nil; linphone_call_params_copy(linphone_call_get_current_params(call)); // stop video linphone_call_params_enable_video(paramsCopy, FALSE); - linphone_core_update_call([LinphoneManager getLc], call, paramsCopy); + linphone_core_update_call(LC, call, paramsCopy); }]; [sheet showInView:self.view]; callData->batteryWarningShown = TRUE; @@ -740,7 +740,7 @@ static RootViewManager *rootViewManagerInstance = nil; } - (void)incomingCallDeclined:(LinphoneCall *)call { - linphone_core_terminate_call([LinphoneManager getLc], call); + linphone_core_terminate_call(LC, call); } @end diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 4994f1d52..bf3538bb2 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -370,8 +370,8 @@ static UICompositeViewDescription *compositeDescription = nil; // Set observer [NSNotificationCenter.defaultCenter removeObserver:self name:kIASKAppSettingChanged object:nil]; - if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer([LinphoneManager getLc]))) { - linphone_core_stop_ringing([LinphoneManager getLc]); + if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer(LC))) { + linphone_core_stop_ringing(LC); } } @@ -442,7 +442,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - + (IASKSpecifier *)filterSpecifier:(IASKSpecifier *)specifier { - if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) { + if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) { if ([[specifier key] isEqualToString:@"account_transport_preference"]) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]]; NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; @@ -456,7 +456,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else { if ([[specifier key] isEqualToString:@"media_encryption_preference"]) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]]; - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionZRTP)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionZRTP)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"ZRTP"]; [dict setObject:titles forKey:@"Titles"]; @@ -464,7 +464,7 @@ static UICompositeViewDescription *compositeDescription = nil; [values removeObject:@"ZRTP"]; [dict setObject:values forKey:@"Values"]; } - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionSRTP)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionSRTP)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"SRTP"]; [dict setObject:titles forKey:@"Titles"]; @@ -472,7 +472,7 @@ static UICompositeViewDescription *compositeDescription = nil; [values removeObject:@"SRTP"]; [dict setObject:values forKey:@"Values"]; } - if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionDTLS)) { + if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionDTLS)) { NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]]; [titles removeObject:@"DTLS"]; [dict setObject:titles forKey:@"Titles"]; @@ -485,7 +485,7 @@ static UICompositeViewDescription *compositeDescription = nil; } if ([specifier.key hasPrefix:@"menu_account_"]) { - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); int index = [specifier.key substringFromIndex:@"menu_account_".length].intValue - 1; if (index < ms_list_size(accounts)) { LinphoneProxyConfig *proxy = (LinphoneProxyConfig *)ms_list_nth_data(accounts, index); @@ -502,12 +502,12 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneManager *lm = [LinphoneManager instance]; NSMutableSet *hiddenKeys = [NSMutableSet set]; - const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]); + const MSList *accounts = linphone_core_get_proxy_config_list(LC); for (int i = ms_list_size(accounts) + 1; i <= 5; i++) { [hiddenKeys addObject:[NSString stringWithFormat:@"menu_account_%d", i]]; } - if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) { + if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) { [hiddenKeys addObject:@"media_encryption_preference"]; } @@ -538,7 +538,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"quit_button"]; // Hide for the moment [hiddenKeys addObject:@"about_button"]; // Hide for the moment - if (!linphone_core_video_supported([LinphoneManager getLc])) { + if (!linphone_core_video_supported(LC)) { [hiddenKeys addObject:@"video_menu"]; } @@ -564,16 +564,15 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"enable_first_login_view_preference"]; - if (!linphone_core_video_supported([LinphoneManager getLc])) { + if (!linphone_core_video_supported(LC)) { [hiddenKeys addObject:@"enable_video_preference"]; } - if (!linphone_core_video_display_enabled([LinphoneManager getLc])) { + if (!linphone_core_video_display_enabled(LC)) { [hiddenKeys addObject:@"video_menu"]; } - if (!linphone_core_get_video_preset([LinphoneManager getLc]) || - strcmp(linphone_core_get_video_preset([LinphoneManager getLc]), "custom") != 0) { + if (!linphone_core_get_video_preset(LC) || strcmp(linphone_core_get_video_preset(LC), "custom") != 0) { [hiddenKeys addObject:@"video_preferred_fps_preference"]; [hiddenKeys addObject:@"download_bandwidth_preference"]; } @@ -585,7 +584,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"port_preference"]; } - if (linphone_core_get_stun_server([LinphoneManager getLc]) == NULL) { + if (linphone_core_get_stun_server(LC) == NULL) { [hiddenKeys addObject:@"ice_preference"]; } @@ -671,7 +670,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[UIDevice currentDevice] _setBatteryLevel:0.01f]; [NSNotificationCenter.defaultCenter postNotificationName:UIDeviceBatteryLevelDidChangeNotification object:self]; } else if ([key isEqual:@"flush_images_button"]) { - const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms(LC); while (rooms) { const MSList *messages = linphone_chat_room_get_history(rooms->data, 0); while (messages) { diff --git a/Classes/SideMenuTableView.m b/Classes/SideMenuTableView.m index 40985246b..d5bca31d5 100644 --- a/Classes/SideMenuTableView.m +++ b/Classes/SideMenuTableView.m @@ -68,10 +68,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { - BOOL hasDefault = (linphone_core_get_default_proxy_config([LinphoneManager getLc]) != NULL); + BOOL hasDefault = (linphone_core_get_default_proxy_config(LC) != NULL); // default account is shown in the header already - return MAX(0, - ms_list_size(linphone_core_get_proxy_config_list([LinphoneManager getLc])) - (hasDefault ? 1 : 0)); + return MAX(0, ms_list_size(linphone_core_get_proxy_config_list(LC)) - (hasDefault ? 1 : 0)); } else { return [_sideMenuEntries count]; } @@ -80,8 +79,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[UITableViewCell alloc] init]; if (indexPath.section == 0) { - LinphoneProxyConfig *proxy = - ms_list_nth_data(linphone_core_get_proxy_config_list([LinphoneManager getLc]), (int)indexPath.row); + LinphoneProxyConfig *proxy = ms_list_nth_data(linphone_core_get_proxy_config_list(LC), (int)indexPath.row); if (proxy) { cell.textLabel.text = [NSString stringWithUTF8String:linphone_proxy_config_get_identity(proxy)]; cell.imageView.image = [StatusBarView imageForState:linphone_proxy_config_get_state(proxy)]; diff --git a/Classes/SideMenuView.m b/Classes/SideMenuView.m index bb903046e..bc1fcc5a6 100644 --- a/Classes/SideMenuView.m +++ b/Classes/SideMenuView.m @@ -47,7 +47,7 @@ } - (void)updateHeader { - LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config(LC); if (default_proxy != NULL) { const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy); diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index d683a7ab4..eb8d81520 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -90,7 +90,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info address = [[address componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString:@" "]; NSString *normalizedSipAddress = nil; - LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], [address UTF8String]); + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, [address UTF8String]); if (linphoneAddress != NULL) { char *tmp = linphone_address_as_string_uri_only(linphoneAddress); if (tmp != NULL) { diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index b39e90e45..eb139926c 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -21,6 +21,7 @@ #define IPAD (LinphoneManager.runningOnIpad) #define ANIMATED ([LinphoneManager.instance lpConfigBoolForKey:@"animations_preference"]) +#define LC ([LinphoneManager getLc]) @interface LinphoneUtils : NSObject