From 5a8f48fa5b66792873052830f55e540983bf4ca7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 8 Feb 2013 17:34:44 +0100 Subject: [PATCH] update exosip and linphone, and use new call log apis. --- Classes/HistoryDetailsViewController.m | 36 +++++++------------------- Classes/HistoryTableViewController.m | 8 +++--- Classes/LinphoneAppDelegate.m | 2 +- Classes/LinphoneManager.m | 14 ++++++---- Classes/LinphoneUI/UIHistoryCell.m | 8 +++--- Classes/PhoneMainView.m | 2 +- submodules/externals/exosip | 2 +- submodules/linphone | 2 +- 8 files changed, 31 insertions(+), 43 deletions(-) diff --git a/Classes/HistoryDetailsViewController.m b/Classes/HistoryDetailsViewController.m index 553f8e38c..d2a0c1fb6 100644 --- a/Classes/HistoryDetailsViewController.m +++ b/Classes/HistoryDetailsViewController.m @@ -166,12 +166,7 @@ static UICompositeViewDescription *compositeDescription = nil; return; } - LinphoneAddress* addr = NULL; - if (callLog->dir == LinphoneCallIncoming) { - addr = callLog->from; - } else { - addr = callLog->to; - } + LinphoneAddress* addr =linphone_call_log_get_remote_address(callLog); UIImage *image = nil; NSString* address = nil; @@ -220,12 +215,12 @@ static UICompositeViewDescription *compositeDescription = nil; // State NSMutableString *state = [NSMutableString string]; - if (callLog->dir == LinphoneCallIncoming) { + if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) { [state setString:NSLocalizedString(@"Incoming call", nil)]; } else { [state setString:NSLocalizedString(@"Outgoing call", nil)]; } - switch (callLog->status) { + switch (linphone_call_log_get_status(callLog)) { case LinphoneCallSuccess: break; case LinphoneCallAborted: @@ -241,11 +236,11 @@ static UICompositeViewDescription *compositeDescription = nil; [typeLabel setText:state]; // Date - NSDate *startData = [NSDate dateWithTimeIntervalSince1970:callLog->start_date_time]; + NSDate *startData = [NSDate dateWithTimeIntervalSince1970:linphone_call_log_get_start_date(callLog)]; [dateLabel setText:[dateFormatter stringFromDate:startData]]; // Duration - int duration = callLog->duration; + int duration = linphone_call_log_get_duration(callLog); [durationLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration/60), duration - 60 * (duration / 60), nil]]; // contact name @@ -288,12 +283,9 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onAddContactClick:(id)event { - LinphoneAddress* addr = NULL; - if (callLog->dir == LinphoneCallIncoming) { - addr = callLog->from; - } else { - addr = callLog->to; - } + LinphoneAddress* addr; + + addr=linphone_call_log_get_remote_address(callLog); if (addr != NULL) { char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress != NULL) { @@ -311,11 +303,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onCallClick:(id)event { LinphoneAddress* addr; - if (callLog->dir == LinphoneCallIncoming) { - addr = callLog->from; - } else { - addr = callLog->to; - } + addr=linphone_call_log_get_remote_address(callLog); char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress == NULL) @@ -347,11 +335,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onMessageClick:(id)event { LinphoneAddress* addr; - if (callLog->dir == LinphoneCallIncoming) { - addr = callLog->from; - } else { - addr = callLog->to; - } + addr=linphone_call_log_get_remote_address(callLog); char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress == NULL) diff --git a/Classes/HistoryTableViewController.m b/Classes/HistoryTableViewController.m index 7bf6de6a7..a87b89bf1 100644 --- a/Classes/HistoryTableViewController.m +++ b/Classes/HistoryTableViewController.m @@ -85,7 +85,7 @@ while(logs != NULL) { LinphoneCallLog* log = (LinphoneCallLog *) logs->data; if(missedFilter) { - if (log->status == LinphoneCallMissed) { + if (linphone_call_log_get_status(log) == LinphoneCallMissed) { [callLogs addObject:[NSValue valueWithPointer: log]]; } } else { @@ -129,10 +129,10 @@ LinphoneCallLog *callLog = [[callLogs objectAtIndex:[indexPath row]] pointerValue]; LinphoneAddress* addr; - if (callLog->dir == LinphoneCallIncoming) { - addr = callLog->from; + if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) { + addr = linphone_call_log_get_from(callLog); } else { - addr = callLog->to; + addr = linphone_call_log_get_to(callLog); } NSString* displayName = nil; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 03910325c..2a584c733 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -232,7 +232,7 @@ const MSList * logs = linphone_core_get_call_logs([LinphoneManager getLc]); while(logs != NULL) { LinphoneCallLog* log = (LinphoneCallLog *) logs->data; - if([callLog isEqualToString:[NSString stringWithUTF8String:log->call_id]]) { + if([callLog isEqualToString:[NSString stringWithUTF8String:linphone_call_log_get_call_id(log)]]) { theLog = log; break; } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 0fe37be17..4664c5460 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -420,7 +420,11 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char /*should we reject this call ?*/ if ([lCTCallCenter currentCalls]!=nil) { - [LinphoneLogger logc:LinphoneLoggerLog format:"Mobile call ongoing... rejecting call from [%s]",linphone_address_get_username(linphone_call_get_call_log(call)->from)]; + char *tmp=linphone_call_get_remote_address_as_string(call); + if (tmp) { + [LinphoneLogger logc:LinphoneLoggerLog format:"Mobile call ongoing... rejecting call from [%s]",tmp]; + ms_free(tmp); + } linphone_core_decline_call(theLinphoneCore, call,LinphoneReasonBusy); [lCTCallCenter release]; return; @@ -431,7 +435,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) { LinphoneCallLog* callLog=linphone_call_get_call_log(call); - NSString* callId=[NSString stringWithUTF8String:callLog->call_id]; + NSString* callId=[NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]; if (![[LinphoneManager instance] shouldAutoAcceptCallForCallId:callId]){ // case where a remote notification is not already received @@ -475,12 +479,12 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char [data->notification release]; data->notification = nil; - if(log == NULL || log->status == LinphoneCallMissed) { + if(log == NULL || linphone_call_log_get_status(log) == LinphoneCallMissed) { UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.repeatInterval = 0; notification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"You miss %@ call", nil), address]; notification.alertAction = NSLocalizedString(@"Show", nil); - notification.userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:log->call_id] forKey:@"callLog"]; + notification.userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:linphone_call_log_get_call_id(log)] forKey:@"callLog"]; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; [notification release]; } @@ -936,7 +940,7 @@ static LinphoneCoreVTable linphonec_vtable = { } static int comp_call_id(const LinphoneCall* call , const char *callid) { - return strcmp(linphone_call_get_call_log(call)->call_id, callid); + return strcmp(linphone_call_log_get_call_id(linphone_call_get_call_log(call)), callid); } - (void)acceptCallForCallId:(NSString*)callid { diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index 4f7387b44..4591fee7a 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -102,16 +102,16 @@ // Set up the cell... LinphoneAddress* addr; UIImage *image; - if (callLog->dir == LinphoneCallIncoming) { - if (callLog->status != LinphoneCallMissed) { + if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) { + if (linphone_call_log_get_status(callLog) != LinphoneCallMissed) { image = [UIImage imageNamed:@"call_status_incoming.png"]; } else { image = [UIImage imageNamed:@"call_status_missed.png"]; } - addr = callLog->from; + addr = linphone_call_log_get_from(callLog); } else { image = [UIImage imageNamed:@"call_status_outgoing.png"]; - addr = callLog->to; + addr = linphone_call_log_get_to(callLog); } NSString* address = nil; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 88f4b0324..50fd131d6 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -553,7 +553,7 @@ static PhoneMainView* phoneMainViewInstance=nil; - (void)displayIncomingCall:(LinphoneCall*) call{ LinphoneCallLog* callLog=linphone_call_get_call_log(call); - NSString* callId=[NSString stringWithUTF8String:callLog->call_id]; + NSString* callId=[NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]; if (![[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] || [UIApplication sharedApplication].applicationState == UIApplicationStateActive) { diff --git a/submodules/externals/exosip b/submodules/externals/exosip index c76a9d434..ea5d69281 160000 --- a/submodules/externals/exosip +++ b/submodules/externals/exosip @@ -1 +1 @@ -Subproject commit c76a9d4340f436d2f61f8b031d46bc511776b136 +Subproject commit ea5d692816953ac506464a53238f2103cda8cfee diff --git a/submodules/linphone b/submodules/linphone index 3b722ada2..2584c08c3 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3b722ada225c8adfcb19a0784f05288f8abfcada +Subproject commit 2584c08c313799871cdef3926f311e9a673674e4