assistant: do not remove default proxy config before end of assistant and add LC macro

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-15 16:57:23 +01:00
parent 60053876f9
commit 042e37ff93
40 changed files with 184 additions and 193 deletions

View file

@ -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;

View file

@ -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 {

View file

@ -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))) {

View file

@ -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];

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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)

View file

@ -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 {

View file

@ -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) {

View file

@ -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;

View file

@ -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];
}

View file

@ -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;

View file

@ -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)) {

View file

@ -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];
}

View file

@ -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) {

View file

@ -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];
}

View file

@ -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) {

View file

@ -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];
}

View file

@ -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"]);

View file

@ -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;

View file

@ -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)) {

View file

@ -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];
}

View file

@ -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 {

View file

@ -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];

View file

@ -43,6 +43,6 @@
}
- (IBAction)onKickClick:(id)sender {
linphone_core_remove_from_conference([LinphoneManager getLc], _call);
linphone_core_remove_from_conference(LC, _call);
}
@end

View file

@ -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);
}
}
}

View file

@ -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);
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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: {

View file

@ -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) &&

View file

@ -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 {

View file

@ -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

View file

@ -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) {

View file

@ -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)];

View file

@ -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);

View file

@ -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) {

View file

@ -21,6 +21,7 @@
#define IPAD (LinphoneManager.runningOnIpad)
#define ANIMATED ([LinphoneManager.instance lpConfigBoolForKey:@"animations_preference"])
#define LC ([LinphoneManager getLc])
@interface LinphoneUtils : NSObject