diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index 2780d723f..0eba8c776 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -86,7 +86,7 @@ - (void)updateChatEntry:(LinphoneChatMessage*)chat { NSInteger index = ms_list_index(self->messageList, chat); if (index<0) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"chat entry doesn't exist"]; + LOGW(@"chat entry doesn't exist"); return; } [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:index inSection:0]] withRowAnimation:FALSE]; //just reload diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 458aa7e01..bb999d7b4 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -262,7 +262,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)update { if(chatRoom == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room header: null contact"]; + LOGW(@"Cannot update chat room header: null contact"); return; } @@ -311,14 +311,13 @@ static UICompositeViewDescription *compositeDescription = nil; static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) { ChatRoomViewController* thiz = (ChatRoomViewController*)ud; const char*text = linphone_chat_message_get_text(msg); - [LinphoneLogger log:LinphoneLoggerLog - format:@"Delivery status for [%s] is [%s]",text,linphone_chat_message_state_to_string(state)]; + LOGI(@"Delivery status for [%s] is [%s]",text,linphone_chat_message_state_to_string(state)); [thiz.tableController updateChatEntry:msg]; } - (BOOL)sendMessage:(NSString *)message withExterlBodyUrl:(NSURL*)externalUrl withInternalURL:(NSURL*)internalUrl { if(chatRoom == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot send message: No chatroom"]; + LOGW(@"Cannot send message: No chatroom"); return FALSE; } @@ -350,7 +349,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta dispatch_async(dispatch_get_main_queue(), ^{ [waitView setHidden:TRUE]; if (error) { - [LinphoneLogger log:LinphoneLoggerError format:@"Cannot save image data downloaded [%@]", [error localizedDescription]]; + LOGE(@"Cannot save image data downloaded [%@]", [error localizedDescription]); UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) message:NSLocalizedString(@"Cannot write image to photo library", nil) @@ -361,7 +360,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [errorAlert release]; return; } - [LinphoneLogger log:LinphoneLoggerLog format:@"Image saved to [%@]", [assetURL absoluteString]]; + LOGI(@"Image saved to [%@]", [assetURL absoluteString]); [self chatRoomStartImageUpload:image url:assetURL]; }); }]; @@ -653,7 +652,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [transferView setHidden:TRUE]; NSString *url = [aimageSharing.connection.currentRequest.URL absoluteString]; if (aimageSharing.upload) { - [LinphoneLogger log:LinphoneLoggerError format:@"Cannot upload file to server [%@] because [%@]", url, [error localizedDescription]]; + LOGE(@"Cannot upload file to server [%@] because [%@]", url, [error localizedDescription]); UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) message:NSLocalizedString(@"Cannot transfer file to remote contact", nil) delegate:nil @@ -662,7 +661,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [errorAlert show]; [errorAlert release]; } else { - [LinphoneLogger log:LinphoneLoggerError format:@"Cannot download file from [%@] because [%@]", url, [error localizedDescription]]; + LOGE(@"Cannot download file from [%@] because [%@]", url, [error localizedDescription]); UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) message:NSLocalizedString(@"Cannot transfer file from remote contact", nil) delegate:nil @@ -691,7 +690,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){ if (error) { - [LinphoneLogger log:LinphoneLoggerError format:@"Cannot save image data downloaded [%@]", [error localizedDescription]]; + LOGE(@"Cannot save image data downloaded [%@]", [error localizedDescription]); UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) message:NSLocalizedString(@"Cannot write image to photo library", nil) @@ -702,7 +701,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [errorAlert release]; return; } - [LinphoneLogger log:LinphoneLoggerLog format:@"Image saved to [%@]", [assetURL absoluteString]]; + LOGI(@"Image saved to [%@]", [assetURL absoluteString]); [LinphoneManager setValueInMessageAppData:[assetURL absoluteString] forKey:@"localimage" inMessage:chat]; [tableController updateChatEntry:chat]; }]; diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index be2b15b28..be6a18b35 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "ContactDetailsTableViewController.h" #import "PhoneMainView.h" @@ -74,7 +74,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe labelArray = [[NSMutableArray alloc] initWithObjects: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], - [NSString stringWithString:(NSString*)kABPersonPhoneMobileLabel], + [NSString stringWithString:(NSString*)kABPersonPhoneMobileLabel], [NSString stringWithString:(NSString*)kABPersonPhoneIPhoneLabel], [NSString stringWithString:(NSString*)kABPersonPhoneMainLabel], nil]; editingIndexPath = nil; @@ -94,7 +94,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe [self initContactDetailsTableViewController]; } return self; -} +} - (void)dealloc { if(contact != nil && ABRecordGetRecordID(contact) == kABRecordInvalidID) { @@ -105,7 +105,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } [labelArray release]; [dataCache release]; - + [super dealloc]; } @@ -116,7 +116,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe [super viewDidLoad]; [headerController view]; // Force view load [footerController view]; // Force view load - + self.tableView.accessibilityIdentifier = @"Contact numbers table"; } @@ -176,12 +176,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe - (void)loadData { [dataCache removeAllObjects]; - - if(contact == NULL) + + if(contact == NULL) return; - - [LinphoneLogger logc:LinphoneLoggerLog format:"Load data from contact %p", contact]; - // Phone numbers + + LOGI(@"Load data from contact %p", contact); + // Phone numbers { ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty); NSMutableArray *subArray = [NSMutableArray array]; @@ -196,7 +196,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } [dataCache addObject:subArray]; } - + // SIP (IM) { ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonInstantMessageProperty); @@ -237,7 +237,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } [dataCache addObject:subArray]; } - + // Email if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) { @@ -274,7 +274,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } ABMultiValueIdentifier index; NSError* error = NULL; - + CFStringRef keys[] = { kABPersonInstantMessageUsernameKey, kABPersonInstantMessageServiceKey}; CFTypeRef values[] = { [value copy], [LinphoneManager instance].contactSipField }; CFDictionaryRef lDict = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL); @@ -287,7 +287,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } if (!ABRecordSetValue(contact, kABPersonInstantMessageProperty, lMap, (CFErrorRef*)&error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]]; + LOGI(@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]); CFRelease(lMap); } else { if (entry == nil) { @@ -314,7 +314,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe CFDictionaryRef lDict2 = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL); ABMultiValueReplaceValueAtIndex(lMap, lDict2, index); if (!ABRecordSetValue(contact, kABPersonInstantMessageProperty, lMap, (CFErrorRef*)&error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]]; + LOGI(@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]); } CFRelease(lDict2); linphone_address_destroy(address); @@ -324,7 +324,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe CFRelease(lMap); } CFRelease(lDict); - + return entry; } @@ -354,14 +354,14 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe if(!ABMultiValueAddValueAndLabel(lMap, [[value copy] autorelease], label, &identifier)) { added = false; } - + if(added && ABRecordSetValue(contact, kABPersonPhoneProperty, lMap, (CFErrorRef*)&error)) { Entry *entry = [[Entry alloc] initWithData:identifier]; [sectionArray addObject:entry]; [entry release]; } else { added = false; - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; + LOGI(@"Can't add entry: %@", [error localizedDescription]); } CFRelease(lMap); } else if(contactSections[section] == ContactSections_Sip) { @@ -371,7 +371,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe added=true; } else { added=false; - [LinphoneLogger log:LinphoneLoggerError format:@"Can't add entry for value: %@", value]; + LOGE(@"Can't add entry for value: %@", value); } } else if(contactSections[section] == ContactSections_Email) { ABMultiValueIdentifier identifier; @@ -387,18 +387,18 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe if(!ABMultiValueAddValueAndLabel(lMap, [[value copy] autorelease], label, &identifier)) { added = false; } - + if(added && ABRecordSetValue(contact, kABPersonEmailProperty, lMap, (CFErrorRef*)&error)) { Entry *entry = [[Entry alloc] initWithData:identifier]; [sectionArray addObject:entry]; [entry release]; } else { added = false; - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; + LOGI(@"Can't add entry: %@", [error localizedDescription]); } CFRelease(lMap); } - + if (added && animated) { // Update accessory if (count > 0) { @@ -456,7 +456,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } [sectionArray removeObjectAtIndex:[indexPath row]]; - + NSArray *tagInsertIndexPath = [NSArray arrayWithObject:indexPath]; if (animated) { [tableview deleteRowsAtIndexPaths:tagInsertIndexPath withRowAnimation:UITableViewRowAnimationFade]; @@ -507,26 +507,26 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kCellId = @"ContactDetailsCell"; UIEditableTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId]; - if (cell == nil) { + if (cell == nil) { cell = [[[UIEditableTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kCellId] autorelease]; [cell.detailTextField setDelegate:self]; [cell.detailTextField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [cell.detailTextField setAutocorrectionType:UITextAutocorrectionTypeNo]; [cell setBackgroundColor:[UIColor whiteColor]]; - + // Background View UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease]; cell.selectedBackgroundView = selectedBackgroundView; [selectedBackgroundView setBackgroundColor:LINPHONE_TABLE_CELL_BACKGROUND_COLOR]; } - + NSMutableArray *sectionDict = [self getSectionData:[indexPath section]]; Entry *entry = [sectionDict objectAtIndex:[indexPath row]]; - + NSString *value = @""; // default label is our app name NSString *label = [ContactDetailsTableViewController localizeLabel:[labelArray objectAtIndex:0]]; - + if(contactSections[[indexPath section]] == ContactSections_Number) { ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty); NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); @@ -701,7 +701,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe [headerController setEditing:editing animated:animated]; [footerController setEditing:editing animated:animated]; - + if(animated) { [self.tableView beginUpdates]; } @@ -732,7 +732,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe if(animated) { [self.tableView endUpdates]; } - + [super setEditing:editing animated:animated]; if(contactDetailsDelegate != nil) { [contactDetailsDelegate onModification:nil]; @@ -747,7 +747,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe return UITableViewCellEditingStyleDelete; } -- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if(section == ContactSections_None) { return [headerController view]; } else { @@ -755,7 +755,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } } -- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { if(section == (ContactSections_MAX - 1)) { if(ABRecordGetRecordID(contact) != kABRecordInvalidID) { return [footerController view]; @@ -781,14 +781,14 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe return nil; } -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if(section == ContactSections_None) { return [UIContactDetailsHeader height:[headerController isEditing]]; } else { // Hide section if nothing in it if([[self getSectionData:section] count] > 0) return 22; - else + else return 0.000001f; // Hack UITableView = 0 } } @@ -846,12 +846,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } - (BOOL)textFieldShouldReturn:(UITextField *)textField { - [textField resignFirstResponder]; + [textField resignFirstResponder]; return YES; } - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { - UIView *view = [textField superview]; + UIView *view = [textField superview]; // Find TableViewCell while(view != nil && ![view isKindOfClass:[UIEditableTableViewCell class]]) view = [view superview]; if(view != nil) { @@ -878,7 +878,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe [cell.detailTextLabel setText:value]; } else { - [LinphoneLogger logc:LinphoneLoggerError format:"Not valid UIEditableTableViewCell"]; + LOGE(@"Not valid UIEditableTableViewCell"); } if(contactDetailsDelegate != nil) { [self performSelector:@selector(updateModification) withObject:nil afterDelay:0]; diff --git a/Classes/ContactDetailsViewController.m b/Classes/ContactDetailsViewController.m index 35f010ae3..d37ab5384 100644 --- a/Classes/ContactDetailsViewController.m +++ b/Classes/ContactDetailsViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "ContactDetailsViewController.h" #import "PhoneMainView.h" @@ -47,16 +47,16 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); CFRelease(addressBook); [tableController release]; - + [editButton release]; [backButton release]; [cancelButton release]; - + [super dealloc]; } -#pragma mark - +#pragma mark - - (void)resetData { [self disableEdit:FALSE]; @@ -64,8 +64,8 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf ABAddressBookRevert(addressBook); return; } - - [LinphoneLogger logc:LinphoneLoggerLog format:"Reset data to contact %p", contact]; + + LOGI(@"Reset data to contact %p", contact); ABRecordID recordID = ABRecordGetRecordID(contact); ABAddressBookRevert(addressBook); contact = ABAddressBookGetPersonWithRecordID(addressBook, recordID); @@ -88,27 +88,27 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf [[PhoneMainView instance] popCurrentView]; return; } - + // Remove contact from book if(ABRecordGetRecordID(contact) != kABRecordInvalidID) { NSError* error = NULL; ABAddressBookRemoveRecord(addressBook, contact, (CFErrorRef*)&error); if (error != NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Remove contact %p: Fail(%@)", contact, [error localizedDescription]]; + LOGE(@"Remove contact %p: Fail(%@)", contact, [error localizedDescription]); } else { - [LinphoneLogger logc:LinphoneLoggerLog format:"Remove contact %p: Success!", contact]; + LOGI(@"Remove contact %p: Success!", contact); } contact = NULL; - + // Save address book error = NULL; inhibUpdate = TRUE; ABAddressBookSave(addressBook, (CFErrorRef*)&error); inhibUpdate = FALSE; if (error != NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Save AddressBook: Fail(%@)", [error localizedDescription]]; + LOGE(@"Save AddressBook: Fail(%@)", [error localizedDescription]); } else { - [LinphoneLogger logc:LinphoneLoggerLog format:"Save AddressBook: Success!"]; + LOGI(@"Save AddressBook: Success!"); } [[LinphoneManager instance].fastAddressBook reload]; } @@ -119,27 +119,27 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf [[PhoneMainView instance] popCurrentView]; return; } - + // Add contact to book NSError* error = NULL; if(ABRecordGetRecordID(contact) == kABRecordInvalidID) { ABAddressBookAddRecord(addressBook, contact, (CFErrorRef*)&error); if (error != NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Add contact %p: Fail(%@)", contact, [error localizedDescription]]; + LOGE(@"Add contact %p: Fail(%@)", contact, [error localizedDescription]); } else { - [LinphoneLogger logc:LinphoneLoggerLog format:"Add contact %p: Success!", contact]; + LOGI(@"Add contact %p: Success!", contact); } } - + // Save address book error = NULL; inhibUpdate = TRUE; ABAddressBookSave(addressBook, (CFErrorRef*)&error); inhibUpdate = FALSE; if (error != NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Save AddressBook: Fail(%@)", [error localizedDescription]]; + LOGE(@"Save AddressBook: Fail(%@)", [error localizedDescription]); } else { - [LinphoneLogger logc:LinphoneLoggerLog format:"Save AddressBook: Success!"]; + LOGI(@"Save AddressBook: Success!"); } [[LinphoneManager instance].fastAddressBook reload]; } @@ -202,15 +202,15 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf - (void)viewDidLoad{ [super viewDidLoad]; - + // Set selected+over background: IB lack ! [editButton setBackgroundImage:[UIImage imageNamed:@"contact_ok_over.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - + // Set selected+disabled background: IB lack ! [editButton setBackgroundImage:[UIImage imageNamed:@"contact_ok_disabled.png"] forState:(UIControlStateDisabled | UIControlStateSelected)]; - + [LinphoneUtils buttonFixStates:editButton]; [tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4 @@ -233,12 +233,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"ContactDetails" - content:@"ContactDetailsViewController" - stateBar:nil - stateBarEnabled:false - tabBar:@"UIMainBar" - tabBarEnabled:true + compositeDescription = [[UICompositeViewDescription alloc] init:@"ContactDetails" + content:@"ContactDetailsViewController" + stateBar:nil + stateBarEnabled:false + tabBar:@"UIMainBar" + tabBarEnabled:true fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index 79675a18d..a87dbfd0d 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -127,7 +127,7 @@ static int ms_strcmpfuz(const char * fuzzy_word, const char * sentence) { } - (void)loadData { - [LinphoneLogger logc:LinphoneLoggerLog format:"Load contact list"]; + LOGI(@"Load contact list"); @synchronized (addressBookMap) { // Reset Address book diff --git a/Classes/ImageSharing.m b/Classes/ImageSharing.m index 0b41cfc6c..42742a031 100644 --- a/Classes/ImageSharing.m +++ b/Classes/ImageSharing.m @@ -73,7 +73,7 @@ - (void)cancel { [connection cancel]; - [LinphoneLogger log:LinphoneLoggerLog format:@"File transfer interrupted by user"]; + LOGI(@"File transfer interrupted by user"); if(delegate) { [delegate imageSharingAborted:self]; } @@ -81,36 +81,36 @@ - (void)downloadImageFrom:(NSURL*)url { - [LinphoneLogger log:LinphoneLoggerLog format:@"downloading [%@]", [url absoluteString]]; - + LOGI(@"downloading [%@]", [url absoluteString]); + NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; - + connection = [[NSURLConnection alloc] initWithRequest:request delegate: self]; } - (void)uploadImageTo:(NSURL*)url image:(UIImage*)image { - [LinphoneLogger log:LinphoneLoggerLog format:@"downloading [%@]", [url absoluteString]]; - + LOGI(@"downloading [%@]", [url absoluteString]); + // setting up the request object now NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:url]; [request setHTTPMethod:@"POST"]; - + /* add some header info now we always need a boundary when we post a file also we need to set the content type - + You might want to generate a random boundary.. this is just the same as my output from wireshark on a valid html post */ NSString *boundary = @"---------------------------14737809831466499882746641449"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; - + /* now lets create the body of the post */ @@ -122,7 +122,7 @@ [body appendData:[NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:body]; - + connection = [[NSURLConnection alloc] initWithRequest:(NSURLRequest *)request delegate:self]; } @@ -152,8 +152,8 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *) response; statusCode = httpResponse.statusCode; - [LinphoneLogger log:LinphoneLoggerLog format:@"File transfer status code [%i]", statusCode]; - + LOGI(@"File transfer status code [%i]", statusCode); + if (statusCode == 200 && !upload) { totalBytesExpectedToRead = (int)[response expectedContentLength]; } @@ -169,14 +169,14 @@ } if (upload) { NSString* imageRemoteUrl = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - [LinphoneLogger log:LinphoneLoggerLog format:@"File can be downloaded from [%@]", imageRemoteUrl]; + LOGI(@"File can be downloaded from [%@]", imageRemoteUrl); if(delegate) { [delegate imageSharingUploadDone:self url:[NSURL URLWithString:imageRemoteUrl]]; } [imageRemoteUrl release]; } else { UIImage* image = [UIImage imageWithData:data]; - [LinphoneLogger log:LinphoneLoggerLog format:@"File downloaded"]; + LOGI(@"File downloaded"); if(delegate) { [delegate imageSharingDownloadDone:self image:image]; } diff --git a/Classes/InCallTableViewController.m b/Classes/InCallTableViewController.m index cd47bfd43..6993a3cb0 100644 --- a/Classes/InCallTableViewController.m +++ b/Classes/InCallTableViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "InCallTableViewController.h" #import "UICallCell.h" @@ -60,7 +60,7 @@ enum TableSection { [self initInCallTableViewController]; } return self; -} +} - (void)dealloc { [super dealloc]; @@ -71,9 +71,9 @@ enum TableSection { - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; updateTime = [NSTimer scheduledTimerWithTimeInterval:1 - target:self - selector:@selector(update) - userInfo:nil + target:self + selector:@selector(update) + userInfo:nil repeats:YES]; } @@ -97,7 +97,7 @@ enum TableSection { + (int)callCount:(LinphoneCore*) lc { int count = 0; const MSList* calls = linphone_core_get_calls(lc); - + while (calls != 0) { if (![InCallTableViewController isInConference:((LinphoneCall*)calls->data)]) { count++; @@ -109,7 +109,7 @@ enum TableSection { + (LinphoneCall*)retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf{ const MSList* calls = linphone_core_get_calls([LinphoneManager getLc]); - + while (calls != 0) { if ([InCallTableViewController isInConference:(LinphoneCall*)calls->data] == conf) { if (index == 0) @@ -118,9 +118,9 @@ enum TableSection { } calls = calls->next; } - + if (calls == 0) { - [LinphoneLogger logc:LinphoneLoggerError format:"Cannot find call with index %d (in conf: %d)", index, conf]; + LOGE(@"Cannot find call with index %d (in conf: %d)", index, conf); return nil; } else { return (LinphoneCall*)calls->data; @@ -128,7 +128,7 @@ enum TableSection { } -#pragma mark - +#pragma mark - - (void)removeCallData:(LinphoneCall*) call { // Remove data associated with the call @@ -174,7 +174,7 @@ enum TableSection { for (int row = 0; row < [tableView numberOfRowsInSection:section]; row++) { NSIndexPath* cellPath = [NSIndexPath indexPathForRow:row inSection:section]; UICallCell* cell = (UICallCell*) [tableView cellForRowAtIndexPath:cellPath]; - [cell update]; + [cell update]; } } } @@ -216,14 +216,14 @@ enum TableSection { if (cell == nil) { cell = [[[UICallCell alloc] initWithIdentifier:kCellId] autorelease]; } - + bool inConference = indexPath.section == ConferenceSection; - + LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* currentCall = linphone_core_get_current_call(lc); LinphoneCall* call = [InCallTableViewController retrieveCallAtIndex:indexPath.row inConference:inConference]; [cell setData:[self addCallData:call]]; - + // Update cell if ([indexPath section] == CallSection && [indexPath row] == 0 && linphone_core_get_conference_size(lc) == 0) { [cell setFirstCell:true]; @@ -233,20 +233,20 @@ enum TableSection { [cell setCurrentCall:(currentCall == call)]; [cell setConferenceCell:inConference]; [cell update]; - + /*if (linphone_core_get_calls_nb(lc) > 1 || linphone_core_get_conference_size(lc) > 0) { tableView.scrollEnabled = true; } else { tableView.scrollEnabled = false; }*/ return cell; -} +} - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { int count = 0; - + LinphoneCore* lc = [LinphoneManager getLc]; - + if(section == CallSection) { count = [InCallTableViewController callCount:lc]; } else { @@ -273,7 +273,7 @@ enum TableSection { #pragma mark - UITableViewDelegate Functions -- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if(section == CallSection) { return [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; } else if(section == ConferenceSection) { @@ -291,11 +291,11 @@ enum TableSection { return [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; } -- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { return [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; } -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { LinphoneCore* lc = [LinphoneManager getLc]; if(section == CallSection) { return 0.000001f; // Hack UITableView = 0 @@ -307,7 +307,7 @@ enum TableSection { return 0.000001f; // Hack UITableView = 0 } -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { LinphoneCore* lc = [LinphoneManager getLc]; if(section == CallSection) { return 0.000001f; // Hack UITableView = 0 diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index fda5ce633..f87171408 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import #import @@ -67,7 +67,7 @@ const NSInteger SECURE_BUTTON_TAG=5; - (void)dealloc { [callTableController release]; [callTableView release]; - + [videoGroup release]; [videoView release]; [videoPreview release]; @@ -75,17 +75,17 @@ const NSInteger SECURE_BUTTON_TAG=5; [testVideoView release]; #endif [videoCameraSwitch release]; - + [videoWaitingForFirstImage release]; - + [videoZoomHandler release]; - + [[PhoneMainView instance].view removeGestureRecognizer:singleFingerTap]; [singleFingerTap release]; - + // Remove all observer [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [super dealloc]; } @@ -96,12 +96,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"InCall" - content:@"InCallViewController" - stateBar:@"UIStateBar" - stateBarEnabled:true - tabBar:@"UICallBar" - tabBarEnabled:true + compositeDescription = [[UICompositeViewDescription alloc] init:@"InCall" + content:@"InCallViewController" + stateBar:@"UIStateBar" + stateBarEnabled:true + tabBar:@"UICallBar" + tabBarEnabled:true fullscreen:false landscapeMode:true portraitMode:true]; @@ -115,7 +115,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - + [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = YES; @@ -130,14 +130,14 @@ static UICompositeViewDescription *compositeDescription = nil; [hideControlsTimer invalidate]; hideControlsTimer = nil; } - + if( hiddenVolume ) { [[PhoneMainView instance] setVolumeHidden:FALSE]; hiddenVolume = FALSE; } - + // Remove observer - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil]; } @@ -145,11 +145,11 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Set observer - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(callUpdateEvent:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(callUpdateEvent:) name:kLinphoneCallUpdate object:nil]; - + // Update on show LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0; @@ -158,14 +158,14 @@ static UICompositeViewDescription *compositeDescription = nil; // Set windows (warn memory leaks) linphone_core_set_native_video_window_id([LinphoneManager getLc], (unsigned long)videoView); linphone_core_set_native_preview_window_id([LinphoneManager getLc], (unsigned long)videoPreview); - + // Enable tap [singleFingerTap setEnabled:TRUE]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; - + [[UIApplication sharedApplication] setIdleTimerDisabled:false]; UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = NO; @@ -177,16 +177,16 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidLoad { [super viewDidLoad]; - + [singleFingerTap setNumberOfTapsRequired:1]; [singleFingerTap setCancelsTouchesInView: FALSE]; [[PhoneMainView instance].view addGestureRecognizer:singleFingerTap]; - + [videoZoomHandler setup:videoGroup]; videoGroup.alpha = 0; - + [videoCameraSwitch setPreview:videoPreview]; - + [callTableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4 [callTableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4 } @@ -213,16 +213,16 @@ static UICompositeViewDescription *compositeDescription = nil; } // Update table - [callTableView reloadData]; - + [callTableView reloadData]; + // Fake call update if(call == NULL) { return; } - switch (state) { - case LinphoneCallIncomingReceived: - case LinphoneCallOutgoingInit: + switch (state) { + case LinphoneCallIncomingReceived: + case LinphoneCallOutgoingInit: { if(linphone_core_get_calls_nb(lc) > 1) { [callTableController minimizeAll]; @@ -258,10 +258,10 @@ static UICompositeViewDescription *compositeDescription = nil; { const LinphoneCallParams* current = linphone_call_get_current_params(call); const LinphoneCallParams* remote = linphone_call_get_remote_params(call); - + /* remote wants to add video */ if (linphone_core_video_enabled(lc) && !linphone_call_params_video_enabled(current) && - linphone_call_params_video_enabled(remote) && + linphone_call_params_video_enabled(remote) && !linphone_core_get_video_policy(lc)->automatically_accept) { linphone_core_defer_call_update(lc, call); [self displayAskToEnableVideoCall:call]; @@ -288,7 +288,7 @@ static UICompositeViewDescription *compositeDescription = nil; default: break; } - + } - (void)showControls:(id)sender { @@ -296,7 +296,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hideControlsTimer invalidate]; hideControlsTimer = nil; } - + if([[[PhoneMainView instance] currentView] equal:[InCallViewController compositeViewDescription]] && videoShown) { // show controls [UIView beginAnimations:nil context:nil]; @@ -306,7 +306,7 @@ static UICompositeViewDescription *compositeDescription = nil; [callTableView setAlpha:1.0]; [videoCameraSwitch setAlpha:1.0]; [UIView commitAnimations]; - + // hide controls in 5 sec hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self @@ -321,15 +321,15 @@ static UICompositeViewDescription *compositeDescription = nil; [hideControlsTimer invalidate]; hideControlsTimer = nil; } - + if([[[PhoneMainView instance] currentView] equal:[InCallViewController compositeViewDescription]] && videoShown) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; [videoCameraSwitch setAlpha:0.0]; [callTableView setAlpha:0.0]; [UIView commitAnimations]; - - + + [[PhoneMainView instance] showTabBar: false]; [[PhoneMainView instance] showStateBar: false]; } @@ -351,19 +351,19 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)enableVideoDisplay:(BOOL)animation { if(videoShown && animation) return; - + videoShown = true; - + [videoZoomHandler resetZoom]; - + if(animation) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0]; } - + [videoGroup setAlpha:1.0]; [callTableView setAlpha:0.0]; - + UIEdgeInsets insets = {33, 0, 25, 0}; [callTableView setContentInset:insets]; [callTableView setScrollIndicatorInsets:insets]; @@ -372,31 +372,31 @@ static UICompositeViewDescription *compositeDescription = nil; if(animation) { [UIView commitAnimations]; } - + if(linphone_core_self_view_enabled([LinphoneManager getLc])) { [videoPreview setHidden:FALSE]; } else { [videoPreview setHidden:TRUE]; } - + if ([LinphoneManager instance].frontCamId != nil) { // only show camera switch button if we have more than 1 camera [videoCameraSwitch setHidden:FALSE]; } [videoCameraSwitch setAlpha:0.0]; - + [[PhoneMainView instance] fullScreen: true]; [[PhoneMainView instance] showTabBar: false]; [[PhoneMainView instance] showStateBar: false]; - + #ifdef TEST_VIDEO_VIEW_CHANGE [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(_debugChangeVideoView) userInfo:nil repeats:YES]; #endif // [self batteryLevelChanged:nil]; - + [videoWaitingForFirstImage setHidden: NO]; [videoWaitingForFirstImage startAnimating]; - + LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); //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))) { @@ -407,13 +407,13 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)disableVideoDisplay:(BOOL)animation { if(!videoShown && animation) return; - + videoShown = false; if(animation) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0]; } - + [videoGroup setAlpha:0.0]; [[PhoneMainView instance] showTabBar: true]; @@ -427,20 +427,20 @@ static UICompositeViewDescription *compositeDescription = nil; [callTableView setAlpha:1.0]; [videoCameraSwitch setHidden:TRUE]; - + if(animation) { [UIView commitAnimations]; } - + if (hideControlsTimer != nil) { [hideControlsTimer invalidate]; hideControlsTimer = nil; } - + [[PhoneMainView instance] fullScreen:false]; } -- (void)displayVideoCall:(BOOL)animated { +- (void)displayVideoCall:(BOOL)animated { [self enableVideoDisplay:animated]; } @@ -475,17 +475,17 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { - (void)displayAskToEnableVideoCall:(LinphoneCall*) call { if (linphone_core_get_video_policy([LinphoneManager getLc])->automatically_accept) return; - + const char* lUserNameChars = linphone_address_get_username(linphone_call_get_remote_address(call)); NSString* lUserName = lUserNameChars?[[[NSString alloc] initWithUTF8String:lUserNameChars] autorelease]:NSLocalizedString(@"Unknown",nil); - const char* lDisplayNameChars = linphone_address_get_display_name(linphone_call_get_remote_address(call)); + const char* lDisplayNameChars = linphone_address_get_display_name(linphone_call_get_remote_address(call)); NSString* lDisplayName = [lDisplayNameChars?[[NSString alloc] initWithUTF8String:lDisplayNameChars]:@"" autorelease]; - + NSString* title = [NSString stringWithFormat : NSLocalizedString(@"'%@' would like to enable video",nil), ([lDisplayName length] > 0)?lDisplayName:lUserName]; DTActionSheet *sheet = [[[DTActionSheet alloc] initWithTitle:title] autorelease]; NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(dismissVideoActionSheet:) userInfo:sheet repeats:NO]; [sheet addButtonWithTitle:NSLocalizedString(@"Accept", nil) block:^() { - [LinphoneLogger logc:LinphoneLoggerLog format:"User accept video proposal"]; + LOGI(@"User accept video proposal"); 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); @@ -493,7 +493,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { [timer invalidate]; }]; DTActionSheetBlock cancelBlock = ^() { - [LinphoneLogger logc:LinphoneLoggerLog format:"User declined video proposal"]; + LOGI(@"User declined video proposal"); LinphoneCallParams* paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy); linphone_call_params_destroy(paramsCopy); diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 2f9c9c371..b07aeacbd 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "PhoneMainView.h" #import "linphoneAppDelegate.h" @@ -49,7 +49,7 @@ } -#pragma mark - +#pragma mark - @@ -62,23 +62,23 @@ LOGI(@"%@", NSStringFromSelector(_cmd)); LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); - + if (call){ /* save call context */ LinphoneManager* instance = [LinphoneManager instance]; instance->currentCallContextBeforeGoingBackground.call = call; instance->currentCallContextBeforeGoingBackground.cameraIsEnabled = linphone_call_camera_enabled(call); - + const LinphoneCallParams* params = linphone_call_get_current_params(call); if (linphone_call_params_video_enabled(params)) { linphone_call_enable_camera(call, false); } } - + if (![[LinphoneManager instance] resignActive]) { } - + } - (void)applicationDidBecomeActive:(UIApplication *)application { @@ -90,12 +90,12 @@ [[PhoneMainView instance] updateStatusBar:nil]; } LinphoneManager* instance = [LinphoneManager instance]; - + [instance becomeActive]; - + LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); - + if (call){ if (call == instance->currentCallContextBeforeGoingBackground.call) { const LinphoneCallParams* params = linphone_call_get_current_params(call); @@ -115,23 +115,23 @@ } - (UIUserNotificationCategory*)getMessageNotificationCategory { - + UIMutableUserNotificationAction* reply = [[[UIMutableUserNotificationAction alloc] init] autorelease]; reply.identifier = @"reply"; reply.title = NSLocalizedString(@"Reply", nil); reply.activationMode = UIUserNotificationActivationModeForeground; reply.destructive = NO; reply.authenticationRequired = YES; - + UIMutableUserNotificationAction* mark_read = [[[UIMutableUserNotificationAction alloc] init] autorelease]; mark_read.identifier = @"mark_read"; mark_read.title = NSLocalizedString(@"Mark Read", nil); mark_read.activationMode = UIUserNotificationActivationModeBackground; mark_read.destructive = NO; mark_read.authenticationRequired = NO; - + NSArray* localRingActions = @[mark_read, reply]; - + UIMutableUserNotificationCategory* localRingNotifAction = [[[UIMutableUserNotificationCategory alloc] init] autorelease]; localRingNotifAction.identifier = @"incoming_msg"; [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextDefault]; @@ -147,17 +147,17 @@ answer.activationMode = UIUserNotificationActivationModeForeground; answer.destructive = NO; answer.authenticationRequired = YES; - + UIMutableUserNotificationAction* decline = [[[UIMutableUserNotificationAction alloc] init] autorelease]; decline.identifier = @"decline"; decline.title = NSLocalizedString(@"Decline", nil); decline.activationMode = UIUserNotificationActivationModeBackground; decline.destructive = YES; decline.authenticationRequired = NO; - - + + NSArray* localRingActions = @[decline, answer]; - + UIMutableUserNotificationCategory* localRingNotifAction = [[[UIMutableUserNotificationCategory alloc] init] autorelease]; localRingNotifAction.identifier = @"incoming_call"; [localRingNotifAction setActions:localRingActions forContext:UIUserNotificationActionContextDefault]; @@ -176,13 +176,13 @@ LinphoneManager* instance = [LinphoneManager instance]; BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"]; BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"]; - - + + if( !instance.isTesting ){ if( [app respondsToSelector:@selector(registerUserNotificationSettings:)] ){ /* iOS8 notifications can be actioned! Awesome: */ UIUserNotificationType notifTypes = UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert; - + NSSet* categories = [NSSet setWithObjects:[self getCallNotificationCategory], [self getMessageNotificationCategory], nil]; UIUserNotificationSettings* userSettings = [UIUserNotificationSettings settingsForTypes:notifTypes categories:categories]; [app registerUserNotificationSettings:userSettings]; @@ -194,7 +194,7 @@ } else { NSLog(@"No remote push for testing"); } - + if (state == UIApplicationStateBackground) { @@ -208,7 +208,7 @@ } bgStartId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ - [LinphoneLogger log:LinphoneLoggerWarning format:@"Background task for application launching expired."]; + LOGW(@"Background task for application launching expired."); [[UIApplication sharedApplication] endBackgroundTask:bgStartId]; }]; @@ -223,7 +223,7 @@ NSDictionary *remoteNotif =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if (remoteNotif){ - [LinphoneLogger log:LinphoneLoggerLog format:@"PushNotification from launch received."]; + LOGI(@"PushNotification from launch received."); [self processRemoteNotification:remoteNotif]; } if (bgStartId!=UIBackgroundTaskInvalid) [[UIApplication sharedApplication] endBackgroundTask:bgStartId]; @@ -274,7 +274,7 @@ - (void)processRemoteNotification:(NSDictionary*)userInfo{ NSDictionary *aps = [userInfo objectForKey:@"aps"]; - + if(aps != nil) { NSDictionary *alert = [aps objectForKey:@"alert"]; if(alert != nil) { @@ -292,7 +292,7 @@ if( callId != nil ){ [[LinphoneManager instance] addPushCallId:callId]; } else { - [LinphoneLogger log:LinphoneLoggerError format:@"PushNotification: does not have call-id yet, fix it !"]; + LOGE(@"PushNotification: does not have call-id yet, fix it !"); } if( [loc_key isEqualToString:@"IM_MSG"] ) { @@ -414,7 +414,7 @@ if( [[UIDevice currentDevice].systemVersion floatValue] >= 8){ LinphoneCore* lc = [LinphoneManager getLc]; - [LinphoneLogger log:LinphoneLoggerLog format:@"%@", NSStringFromSelector(_cmd)]; + LOGI(@"%@", NSStringFromSelector(_cmd)); if( [notification.category isEqualToString:@"incoming_call"]) { if( [identifier isEqualToString:@"answer"] ){ // use the standard handler diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 16c3289ee..0f438ce9f 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -67,8 +67,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); bool_t value = linphone_core_payload_type_enabled(lc,pt); [self setBool:value forKey: pref]; }else{ - [LinphoneLogger logc:LinphoneLoggerWarning format:"Codec %s/%i supported by core is not shown in iOS app config view.", - pt->mime_type,pt->clock_rate]; + LOGW(@"Codec %s/%i supported by core is not shown in iOS app config view.", + pt->mime_type,pt->clock_rate); } } } @@ -186,7 +186,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self transformCodecsToKeys: linphone_core_get_video_codecs(lc)]; [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; [self setString:linphone_core_get_adaptive_rate_algorithm(lc) forKey:@"adaptive_rate_algorithm_preference"]; - + [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; [self setInteger:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "voiceproc_preference", 1) forKey:@"voiceproc_preference"]; [self setInteger:lp_config_get_int(conf, "sound", "eq_active", 0) forKey:@"eq_active"]; @@ -316,7 +316,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); // will also update the sip_*_port section of the config if (linphone_core_set_sip_transports(lc, &transportValue)) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"]; + LOGE(@"cannot set transport"); } port_preference = linphone_core_get_sip_port(lc); @@ -326,7 +326,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); BOOL enable_ipv6 = [self boolForKey:@"use_ipv6"]; lp_config_set_int(conf, "sip", "use_ipv6", enable_ipv6); if( linphone_core_ipv6_enabled(lc) != enable_ipv6){ - [LinphoneLogger logc:LinphoneLoggerDebug format:"%@ IPV6", enable_ipv6?@"ENABLING":@"DISABLING"]; + LOGD(@"%@ IPV6", enable_ipv6?@"ENABLING":@"DISABLING"); linphone_core_enable_ipv6(lc, enable_ipv6); } @@ -689,7 +689,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); BOOL debugmode = [self boolForKey:@"debugenable_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "debugenable_preference", debugmode); [[LinphoneManager instance] setLogsEnabled:debugmode]; - + BOOL animations = [self boolForKey:@"animations_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "animations_preference", animations); @@ -731,7 +731,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } else if ([lTunnelPrefMode isEqualToString:@"auto"]) { mode = tunnel_auto; } else { - [LinphoneLogger logc:LinphoneLoggerError format:"Unexpected tunnel mode [%s]",[lTunnelPrefMode cStringUsingEncoding:[NSString defaultCStringEncoding]]]; + LOGE(@"Unexpected tunnel mode [%s]",[lTunnelPrefMode cStringUsingEncoding:[NSString defaultCStringEncoding]]); } } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 2fcd65cd3..ceb912e53 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -268,16 +268,16 @@ struct codec_name_pref_table codec_pref_table[]={ AudioSessionInitialize(NULL, NULL, NULL, NULL); OSStatus lStatus = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, self); if (lStatus) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot register route change handler [%ld]",lStatus]; + LOGE(@"cannot register route change handler [%ld]",lStatus); } _iapManager = [[InAppProductsManager alloc] init]; - + NSString *path = [[NSBundle mainBundle] pathForResource:@"msg" ofType:@"wav"]; self.messagePlayer = [[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:path] error:nil] autorelease]; sounds.vibrate = kSystemSoundID_Vibrate; - + logs = [[NSMutableArray alloc] init]; database = NULL; speakerEnabled = FALSE; @@ -312,7 +312,7 @@ struct codec_name_pref_table codec_pref_table[]={ OSStatus lStatus = AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, self); if (lStatus) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot un register route change handler [%ld]", lStatus]; + LOGE(@"cannot un register route change handler [%ld]", lStatus); } [[NSNotificationCenter defaultCenter] removeObserver:self forKeyPath:kLinphoneGlobalStateUpdate]; @@ -327,7 +327,7 @@ struct codec_name_pref_table codec_pref_table[]={ - (void)silentPushFailed:(NSTimer*)timer { if( silentPushCompletion ){ - [LinphoneLogger log:LinphoneLoggerLog format:@"silentPush failed, silentPushCompletion block: %p", silentPushCompletion ]; + LOGI(@"silentPush failed, silentPushCompletion block: %p", silentPushCompletion ); silentPushCompletion(UIBackgroundFetchResultNoData); silentPushCompletion = nil; } @@ -357,7 +357,7 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c if( sqlite3_open([newDbPath UTF8String], &newDb) != SQLITE_OK) { - [LinphoneLogger log:LinphoneLoggerError format:@"Can't open \"%@\" sqlite3 database.", newDbPath]; + LOGE(@"Can't open \"%@\" sqlite3 database.", newDbPath); return FALSE; } @@ -370,14 +370,14 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c } - [LinphoneLogger logc:LinphoneLoggerLog format:"Starting migration procedure"]; + LOGI(@"Starting migration procedure"); if( shouldMigrate ){ // attach old database to the new one: attach_stmt = sqlite3_mprintf("ATTACH DATABASE %Q AS oldchats", [oldDbPath UTF8String]); if( sqlite3_exec(newDb, attach_stmt, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"Can't attach old chat table, error[%s] ", errMsg]; + LOGE(@"Can't attach old chat table, error[%s] ", errMsg); sqlite3_free(errMsg); goto exit_dbmigration; } @@ -388,7 +388,7 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c "SELECT localContact,remoteContact,direction,message,time,read,state,'-1' FROM oldchats.chat"; if( sqlite3_exec(newDb, migration_statement, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"DB migration failed, error[%s] ", errMsg]; + LOGE(@"DB migration failed, error[%s] ", errMsg); sqlite3_free(errMsg); goto exit_dbmigration; } @@ -396,7 +396,7 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c // invert direction of old messages, because iOS was storing the direction flag incorrectly const char* invert_direction = "UPDATE history SET direction = NOT direction"; if( sqlite3_exec(newDb, invert_direction, NULL, NULL, &errMsg) != SQLITE_OK){ - [LinphoneLogger log: LinphoneLoggerError format:@"Inverting direction failed, error[%s]", errMsg]; + LOGE(@"Inverting direction failed, error[%s]", errMsg); sqlite3_free(errMsg); goto exit_dbmigration; } @@ -411,14 +411,14 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c char* from_conversion = sqlite3_mprintf("UPDATE history SET localContact = %Q WHERE localContact = ''", identity); if( sqlite3_exec(newDb, from_conversion, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"FROM conversion failed, error[%s] ", errMsg]; + LOGE(@"FROM conversion failed, error[%s] ", errMsg); sqlite3_free(errMsg); } sqlite3_free(from_conversion); char* to_conversion = sqlite3_mprintf("UPDATE history SET remoteContact = %Q WHERE remoteContact = ''", identity); if( sqlite3_exec(newDb, to_conversion, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"DB migration failed, error[%s] ", errMsg]; + LOGE(@"DB migration failed, error[%s] ", errMsg); sqlite3_free(errMsg); } sqlite3_free(to_conversion); @@ -432,14 +432,14 @@ static int check_should_migrate_images(void* data ,int argc,char** argv,char** c // move already stored images from the messages to the appdata JSON field const char* assetslib_migration = "UPDATE history SET appdata='{\"localimage\":\"'||message||'\"}' , message='' WHERE message LIKE 'assets-library%'"; if( sqlite3_exec(newDb, assetslib_migration, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"Assets-history migration for MESSAGE failed, error[%s] ", errMsg]; + LOGE(@"Assets-history migration for MESSAGE failed, error[%s] ", errMsg); sqlite3_free(errMsg); } // move already stored images from the url to the appdata JSON field const char* assetslib_migration_fromurl = "UPDATE history SET appdata='{\"localimage\":\"'||url||'\"}' , url='' WHERE url LIKE 'assets-library%'"; if( sqlite3_exec(newDb, assetslib_migration_fromurl, NULL, NULL, &errMsg) != SQLITE_OK ){ - [LinphoneLogger logc:LinphoneLoggerError format:"Assets-history migration for URL failed, error[%s] ", errMsg]; + LOGE(@"Assets-history migration for URL failed, error[%s] ", errMsg); sqlite3_free(errMsg); } @@ -454,10 +454,10 @@ exit_dbmigration: // in any case, we should remove the old chat db if( shouldMigrate && ![[NSFileManager defaultManager] removeItemAtPath:oldDbPath error:&error] ){ - [LinphoneLogger logc:LinphoneLoggerError format:"Could not remove old chat DB: %@", error]; + LOGE(@"Could not remove old chat DB: %@", error); } - [LinphoneLogger log:LinphoneLoggerLog format:@"Message storage migration finished: success = %@", migrated ? @"TRUE":@"FALSE"]; + LOGI(@"Message storage migration finished: success = %@", migrated ? @"TRUE":@"FALSE"); return migrated; } @@ -524,11 +524,11 @@ struct _entry_data { static void dump_entry(const char* entry, void*data) { struct _entry_data *d = (struct _entry_data*)data; const char* value = lp_config_get_string(d->conf, d->section, entry, ""); - [LinphoneLogger log:LinphoneLoggerLog format:@"%s=%s", entry, value]; + LOGI(@"%s=%s", entry, value); } static void dump_section(const char* section, void* data){ - [LinphoneLogger log:LinphoneLoggerLog format:@"[%s]", section ]; + LOGI(@"[%s]", section ); struct _entry_data d = {(const LpConfig*)data, section}; lp_config_for_each_entry((const LpConfig*)data, section, dump_entry, &d); } @@ -604,7 +604,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char - (void)localNotifContinue:(NSTimer*) timer { UILocalNotification* notif = [timer userInfo]; if (notif){ - [LinphoneLogger log:LinphoneLoggerLog format:@"cancelling/presenting local notif"]; + LOGI(@"cancelling/presenting local notif"); [[UIApplication sharedApplication] cancelLocalNotification:notif]; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; } @@ -623,7 +623,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char // we were woken up by a silent push. Call the completion handler with NEWDATA // so that the push is notified to the user - [LinphoneLogger log:LinphoneLoggerLog format:@"onCall - handler %p", silentPushCompletion]; + LOGI(@"onCall - handler %p", silentPushCompletion); silentPushCompletion(UIBackgroundFetchResultNewData); silentPushCompletion = nil; } @@ -665,7 +665,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char if ([lCTCallCenter currentCalls]!=nil) { char *tmp=linphone_call_get_remote_address_as_string(call); if (tmp) { - [LinphoneLogger logc:LinphoneLoggerLog format:"Mobile call ongoing... rejecting call from [%s]",tmp]; + LOGI(@"Mobile call ongoing... rejecting call from [%s]",tmp); ms_free(tmp); } linphone_core_decline_call(theLinphoneCore, call,LinphoneReasonBusy); @@ -705,7 +705,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char if (!incallBgTask){ incallBgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{ - [LinphoneLogger log:LinphoneLoggerWarning format:@"Call cannot ring any more, too late"]; + LOGW(@"Call cannot ring any more, too late"); [[UIApplication sharedApplication] endBackgroundTask:incallBgTask]; incallBgTask=0; }]; @@ -811,7 +811,7 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba } -(void)onGlobalStateChanged:(LinphoneGlobalState)state withMessage:(const char*)message { - [LinphoneLogger log:LinphoneLoggerLog format:@"onGlobalStateChanged: %d (message: %s)", state, message]; + LOGI(@"onGlobalStateChanged: %d (message: %s)", state, message); NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:state], @"state", @@ -839,7 +839,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon } -(void)onConfiguringStatusChanged:(LinphoneConfiguringState)status withMessage:(const char*)message { - [LinphoneLogger log:LinphoneLoggerLog format:@"onConfiguringStatusChanged: %d (message: %s)", status, message]; + LOGI(@"onConfiguringStatusChanged: %d (message: %s)", status, message); NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:status], @"state", @@ -865,7 +865,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon #pragma mark - Registration State Functions - (void)onRegister:(LinphoneCore *)lc cfg:(LinphoneProxyConfig*) cfg state:(LinphoneRegistrationState) state message:(const char*) message { - [LinphoneLogger logc:LinphoneLoggerLog format:"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message]; + LOGI(@"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message); // Post event NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: @@ -889,7 +889,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo // we were woken up by a silent push. Call the completion handler with NEWDATA // so that the push is notified to the user - [LinphoneLogger log:LinphoneLoggerLog format:@"onMessageReceived - handler %p", silentPushCompletion]; + LOGI(@"onMessageReceived - handler %p", silentPushCompletion); silentPushCompletion(UIBackgroundFetchResultNewData); silentPushCompletion = nil; } @@ -1046,7 +1046,7 @@ static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChat NSString *data = nil; CFDictionaryRef dict = CNCopyCurrentNetworkInfo((CFStringRef)@"en0"); if(dict) { - [LinphoneLogger log:LinphoneLoggerDebug format:@"AP Wifi: %@", dict]; + LOGI(@"AP Wifi: %@", dict); data = [NSString stringWithString:(NSString*) CFDictionaryGetValue(dict, @"SSID")]; CFRelease(dict); } @@ -1055,24 +1055,25 @@ static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChat } static void showNetworkFlags(SCNetworkReachabilityFlags flags){ - [LinphoneLogger logc:LinphoneLoggerLog format:"Network connection flags:"]; - if (flags==0) [LinphoneLogger logc:LinphoneLoggerLog format:"no flags."]; + LOGI(@"Network connection flags:"); + if (flags==0) + LOGI(@"no flags."); if (flags & kSCNetworkReachabilityFlagsTransientConnection) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsTransientConnection"]; + LOGI(@"kSCNetworkReachabilityFlagsTransientConnection"); if (flags & kSCNetworkReachabilityFlagsReachable) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsReachable"]; + LOGI(@"kSCNetworkReachabilityFlagsReachable"); if (flags & kSCNetworkReachabilityFlagsConnectionRequired) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionRequired"]; + LOGI(@"kSCNetworkReachabilityFlagsConnectionRequired"); if (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionOnTraffic"]; + LOGI(@"kSCNetworkReachabilityFlagsConnectionOnTraffic"); if (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsConnectionOnDemand"]; + LOGI(@"kSCNetworkReachabilityFlagsConnectionOnDemand"); if (flags & kSCNetworkReachabilityFlagsIsLocalAddress) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsLocalAddress"]; + LOGI(@"kSCNetworkReachabilityFlagsIsLocalAddress"); if (flags & kSCNetworkReachabilityFlagsIsDirect) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsDirect"]; + LOGI(@"kSCNetworkReachabilityFlagsIsDirect"); if (flags & kSCNetworkReachabilityFlagsIsWWAN) - [LinphoneLogger logc:LinphoneLoggerLog format:"kSCNetworkReachabilityFlagsIsWWAN"]; + LOGI(@"kSCNetworkReachabilityFlagsIsWWAN"); } static void networkReachabilityNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { @@ -1135,7 +1136,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } linphone_core_set_network_reachable(theLinphoneCore,true); linphone_core_iterate(theLinphoneCore); - [LinphoneLogger logc:LinphoneLoggerLog format:"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")]; + LOGI(@"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")); } lLinphoneMgr.connectivity=newConnectivity; switch (lLinphoneMgr.tunnelMode) { @@ -1165,7 +1166,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach zeroAddress.sin_family = AF_INET; if (proxyReachability) { - [LinphoneLogger logc:LinphoneLoggerLog format:"Cancelling old network reachability"]; + LOGI(@"Cancelling old network reachability"); SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); CFRelease(proxyReachability); proxyReachability = nil; @@ -1190,14 +1191,14 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach proxyReachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)&zeroAddress); if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack, ctx)){ - [LinphoneLogger logc:LinphoneLoggerError format:"Cannot register reachability cb: %s", SCErrorString(SCError())]; + LOGE(@"Cannot register reachability cb: %s", SCErrorString(SCError())); return; } if(!SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)){ - [LinphoneLogger logc:LinphoneLoggerError format:"Cannot register schedule reachability cb: %s", SCErrorString(SCError())]; + LOGE(@"Cannot register schedule reachability cb: %s", SCErrorString(SCError())); return; } - + // this check is to know network connectivity right now without waiting for a change. Don'nt remove it unless you have good reason. Jehan SCNetworkReachabilityFlags flags; if (SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { @@ -1343,7 +1344,7 @@ static LinphoneCoreVTable linphonec_vtable = { NSString* path = [LinphoneManager bundleFile:@"nowebcamCIF.jpg"]; if (path) { const char* imagePath = [path cStringUsingEncoding:[NSString defaultCStringEncoding]]; - [LinphoneLogger logc:LinphoneLoggerLog format:"Using '%s' as source image for no webcam", imagePath]; + LOGI(@"Using '%s' as source image for no webcam", imagePath); linphone_core_set_static_picture(theLinphoneCore, imagePath); } @@ -1366,12 +1367,12 @@ static LinphoneCoreVTable linphonec_vtable = { PayloadType *pt=linphone_core_find_payload_type(theLinphoneCore,"SILK",24000,-1); if (pt) { linphone_core_enable_payload_type(theLinphoneCore,pt,FALSE); - [LinphoneLogger logc:LinphoneLoggerWarning format:"SILK/24000 and video disabled on old iPhone 3G"]; + LOGW(@"SILK/24000 and video disabled on old iPhone 3G"); } linphone_core_enable_video(theLinphoneCore, FALSE, FALSE); } - [LinphoneLogger logc:LinphoneLoggerWarning format:"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]]]; + LOGW(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]]); // Post event @@ -1390,7 +1391,7 @@ static BOOL libStarted = FALSE; - (void)startLibLinphone { if ( libStarted ) { - [LinphoneLogger logc:LinphoneLoggerError format:"Liblinphone is already initialized!"]; + LOGE(@"Liblinphone is already initialized!"); return; } @@ -1432,10 +1433,10 @@ static BOOL libStarted = FALSE; - (void)createLinphoneCore { if (theLinphoneCore != nil) { - [LinphoneLogger logc:LinphoneLoggerLog format:"linphonecore is already created"]; + LOGI(@"linphonecore is already created"); return; } - [LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"]; + LOGI(@"Create linphonecore"); connectivity=none; @@ -1473,7 +1474,7 @@ static BOOL libStarted = FALSE; const char* lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; linphone_core_set_root_ca(theLinphoneCore, lRootCa); linphone_core_set_user_certificates_path(theLinphoneCore,[[LinphoneManager cacheDirectory] UTF8String]); - + /* The core will call the linphone_iphone_configuring_status_changed callback when the remote provisioning is loaded (or skipped). Wait for this to finish the code configuration */ @@ -1499,7 +1500,7 @@ static BOOL libStarted = FALSE; [[NSNotificationCenter defaultCenter] removeObserver:self]; if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization - [LinphoneLogger logc:LinphoneLoggerLog format:"Destroy linphonecore"]; + LOGI(@"Destroy linphonecore"); linphone_core_destroy(theLinphoneCore); theLinphoneCore = nil; ms_exit(); // Uninitialize mediastreamer2 @@ -1599,11 +1600,11 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) - (void) startCallPausedLongRunningTask { pausedCallBgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{ - [LinphoneLogger log:LinphoneLoggerWarning format:@"Call cannot be paused any more, too late"]; + LOGW(@"Call cannot be paused any more, too late"); [[UIApplication sharedApplication] endBackgroundTask:pausedCallBgTask]; }]; - [LinphoneLogger log:LinphoneLoggerLog format:@"Long running task started, remaining [%g s] because at least one call is paused" - ,[[UIApplication sharedApplication] backgroundTimeRemaining]]; + LOGI(@"Long running task started, remaining [%g s] because at least one call is paused" + ,[[UIApplication sharedApplication] backgroundTimeRemaining]); } - (BOOL)enterBackgroundMode { LinphoneProxyConfig* proxyCfg; @@ -1624,13 +1625,13 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) //register keepalive if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ handler:^{ - [LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler"]; + LOGW(@"keepalive handler"); if (mLastKeepAliveDate) [mLastKeepAliveDate release]; mLastKeepAliveDate=[NSDate date]; [mLastKeepAliveDate retain]; if (theLinphoneCore == nil) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"It seems that Linphone BG mode was deactivated, just skipping"]; + LOGW(@"It seems that Linphone BG mode was deactivated, just skipping"); return; } //kick up network cnx, just in case @@ -1640,9 +1641,9 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) ]) { - [LinphoneLogger logc:LinphoneLoggerLog format:"keepalive handler succesfully registered"]; + LOGI(@"keepalive handler succesfully registered"); } else { - [LinphoneLogger logc:LinphoneLoggerLog format:"keepalive handler cannot be registered"]; + LOGI(@"keepalive handler cannot be registered"); } shouldEnterBgMode=TRUE; } @@ -1666,11 +1667,11 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) } linphone_core_stop_dtmf_stream(theLinphoneCore); - [LinphoneLogger logc:LinphoneLoggerLog format:"Entering [%s] bg mode",shouldEnterBgMode?"normal":"lite"]; + LOGI(@"Entering [%s] bg mode",shouldEnterBgMode?"normal":"lite"); if (!shouldEnterBgMode ) { if([[LinphoneManager instance] lpConfigBoolForKey:@"pushnotification_preference"]) { - [LinphoneLogger logc:LinphoneLoggerLog format:"Keeping lc core to handle push"]; + LOGI(@"Keeping lc core to handle push"); /*destroy voip socket if any and reset connectivity mode*/ connectivity=none; linphone_core_set_network_reachable(theLinphoneCore, FALSE); @@ -1705,7 +1706,7 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) NSDate *current=[NSDate date]; if ([current timeIntervalSinceDate:mLastKeepAliveDate]>700){ NSString *datestr=[mLastKeepAliveDate description]; - [LinphoneLogger logc:LinphoneLoggerWarning format:"keepalive handler was called for the last time at %@",datestr]; + LOGW(@"keepalive handler was called for the last time at %@",datestr); } } @@ -1713,14 +1714,14 @@ static int comp_call_state_paused (const LinphoneCall* call, const void* param) - (void)beginInterruption { LinphoneCall* c = linphone_core_get_current_call(theLinphoneCore); - [LinphoneLogger logc:LinphoneLoggerLog format:"Sound interruption detected!"]; + LOGI(@"Sound interruption detected!"); if (c && linphone_call_get_state(c) == LinphoneCallStreamsRunning) { linphone_core_pause_call(theLinphoneCore, c); } } - (void)endInterruption { - [LinphoneLogger logc:LinphoneLoggerLog format:"Sound interruption ended!"]; + LOGI(@"Sound interruption ended!"); } - (void)refreshRegisters{ @@ -1774,7 +1775,7 @@ static void audioRouteChangeListenerCallback ( OSStatus lStatus = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &lNewRouteSize, &lNewRoute); if (!lStatus && lNewRouteSize > 0) { NSString *route = (NSString *) lNewRoute; - [LinphoneLogger logc:LinphoneLoggerLog format:"Current audio route is [%s]", [route cStringUsingEncoding:[NSString defaultCStringEncoding]]]; + LOGI(@"Current audio route is [%s]", [route cStringUsingEncoding:[NSString defaultCStringEncoding]]); speakerEnabled = [route isEqualToString: @"Speaker"] || [route isEqualToString: @"SpeakerAndMicrophone"]; @@ -1836,7 +1837,7 @@ static void audioRouteChangeListenerCallback ( if([self lpConfigBoolForKey:@"edge_opt_preference"]) { bool low_bandwidth = self.network == network_2g; if(low_bandwidth) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Low bandwidth mode"]; + LOGI(@"Low bandwidth mode"); } linphone_call_params_enable_low_bandwidth(lcallParams, low_bandwidth); } @@ -1858,7 +1859,7 @@ static void audioRouteChangeListenerCallback ( CTCallCenter* callCenter = [[CTCallCenter alloc] init]; if ([callCenter currentCalls]!=nil) { - [LinphoneLogger logc:LinphoneLoggerError format:"GSM call in progress, cancelling outgoing SIP call request"]; + LOGE(@"GSM call in progress, cancelling outgoing SIP call request"); UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot make call",nil) message:NSLocalizedString(@"Please terminate GSM call",nil) delegate:nil @@ -1878,7 +1879,7 @@ static void audioRouteChangeListenerCallback ( if([self lpConfigBoolForKey:@"edge_opt_preference"]) { bool low_bandwidth = self.network == network_2g; if(low_bandwidth) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Low bandwidth mode"]; + LOGI(@"Low bandwidth mode"); } linphone_call_params_enable_low_bandwidth(lcallParams, low_bandwidth); } @@ -1929,10 +1930,10 @@ static void audioRouteChangeListenerCallback ( if (call) { // The LinphoneCallAppData object should be set on call creation with callback // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash - // We are NOT responsible for creating the AppData. + // We are NOT responsible for creating the AppData. LinphoneCallAppData* data=(LinphoneCallAppData*)linphone_call_get_user_pointer(call); if (data==nil) - [LinphoneLogger log:LinphoneLoggerError format:@"New call instanciated but app data was not set. Expect it to crash."]; + LOGE(@"New call instanciated but app data was not set. Expect it to crash."); /* will be used later to notify user if video was not activated because of the linphone core*/ data->videoRequested = linphone_call_params_video_enabled(lcallParams); } @@ -2037,21 +2038,21 @@ static void audioRouteChangeListenerCallback ( if(override) { [fileManager removeItemAtPath:dst error:&error]; if(error != nil) { - [LinphoneLogger log:LinphoneLoggerError format:@"Can't remove \"%@\": %@", dst, [error localizedDescription]]; + LOGE(@"Can't remove \"%@\": %@", dst, [error localizedDescription]); return FALSE; } } else { - [LinphoneLogger log:LinphoneLoggerWarning format:@"\"%@\" already exists", dst]; + LOGW(@"\"%@\" already exists", dst); return FALSE; } } if ([fileManager fileExistsAtPath:src] == NO) { - [LinphoneLogger log:LinphoneLoggerError format:@"Can't find \"%@\": %@", src, [error localizedDescription]]; + LOGE(@"Can't find \"%@\": %@", src, [error localizedDescription]); return FALSE; } [fileManager copyItemAtPath:src toPath:dst error:&error]; if(error != nil) { - [LinphoneLogger log:LinphoneLoggerError format:@"Can't copy \"%@\" to \"%@\": %@", src, dst, [error localizedDescription]]; + LOGE(@"Can't copy \"%@\" to \"%@\": %@", src, dst, [error localizedDescription]); return FALSE; } return TRUE; @@ -2180,7 +2181,7 @@ static void audioRouteChangeListenerCallback ( -(void) removeCTCallCenterCb { if (mCallCenter != nil) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Removing CT call center listener [%p]",mCallCenter]; + LOGI(@"Removing CT call center listener [%p]",mCallCenter); mCallCenter.callEventHandler=NULL; [mCallCenter release]; } @@ -2191,7 +2192,7 @@ static void audioRouteChangeListenerCallback ( [self removeCTCallCenterCb]; mCallCenter = [[CTCallCenter alloc] init]; - [LinphoneLogger log:LinphoneLoggerLog format:@"Adding CT call center listener [%p]",mCallCenter]; + LOGI(@"Adding CT call center listener [%p]",mCallCenter); mCallCenter.callEventHandler = ^(CTCall* call) { // post on main thread [self performSelectorOnMainThread:@selector(handleGSMCallInteration:) @@ -2207,11 +2208,11 @@ static void audioRouteChangeListenerCallback ( LinphoneCall* call = linphone_core_get_current_call(theLinphoneCore); if ([ct currentCalls]!=nil) { if (call) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Pausing SIP call because GSM call"]; + LOGI(@"Pausing SIP call because GSM call"); linphone_core_pause_call(theLinphoneCore, call); [self startCallPausedLongRunningTask]; } else if (linphone_core_is_in_conference(theLinphoneCore)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Leaving conference call because GSM call"]; + LOGI(@"Leaving conference call because GSM call"); linphone_core_leave_conference(theLinphoneCore); [self startCallPausedLongRunningTask]; } diff --git a/Classes/LinphoneUI/UIBluetoothButton.m b/Classes/LinphoneUI/UIBluetoothButton.m index 6c3ee43f3..b5c3d35a5 100644 --- a/Classes/LinphoneUI/UIBluetoothButton.m +++ b/Classes/LinphoneUI/UIBluetoothButton.m @@ -25,7 +25,7 @@ @implementation UIBluetoothButton #define check_auresult(au,method) \ -if (au!=0) [LinphoneLogger logc:LinphoneLoggerError format:"UIBluetoothButton error for %s: ret=%ld",method,au] +if (au!=0) LOGE(@"UIBluetoothButton error for %s: ret=%ld",method,au) - (void)onOn { //redirect audio to bluetooth diff --git a/Classes/LinphoneUI/UICallCell.m b/Classes/LinphoneUI/UICallCell.m index 894cf1a27..25f9145e2 100644 --- a/Classes/LinphoneUI/UICallCell.m +++ b/Classes/LinphoneUI/UICallCell.m @@ -44,7 +44,7 @@ - (void)update { if(call == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"]; + LOGW(@"Cannot update call cell: null call or data"); return; } const LinphoneAddress* addr = linphone_call_get_remote_address(call); @@ -377,7 +377,7 @@ - (void)update { if(data == nil || data->call == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"]; + LOGW(@"Cannot update call cell: null call or data"); return; } LinphoneCall *call = data->call; @@ -442,7 +442,7 @@ - (void)updateStats { if(data == nil || data->call == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"]; + LOGW(@"Cannot update call cell: null call or data"); return; } LinphoneCall *call = data->call; @@ -500,7 +500,7 @@ - (void)updateDetailsView { if(data == nil || data->call == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"]; + LOGW(@"Cannot update call cell: null call or data"); return; } if(data->view == UICallCellOtherView_Avatar && avatarView.isHidden) { diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index cc5bcab87..a3709596f 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -79,7 +79,7 @@ } } if (newCamId){ - [LinphoneLogger logc:LinphoneLoggerLog format:"Switching from [%s] to [%s]", currentCamId, 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]); if(call != NULL) { diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 5fcf753ad..23fe84382 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -4,16 +4,16 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -39,9 +39,9 @@ NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"UIChatCell" owner:self options:nil]; - + if ([arrayOfViews count] >= 1) { - + [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; } [chatContentLabel setAdjustsFontSizeToFitWidth:TRUE]; // Auto shrink: IB lack! @@ -69,7 +69,7 @@ } -#pragma mark - +#pragma mark - - (NSString *)accessibilityValue { return [NSString stringWithFormat:@"%@ - %@ (%ld)", addressLabel.text, chatContentLabel.text, (long)[unreadMessageLabel.text integerValue]]; @@ -80,7 +80,7 @@ NSString *displayName = nil; UIImage *image = nil; if(chatRoom == nil) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat cell: null chat"]; + LOGW(@"Cannot update chat cell: null chat"); return; } const LinphoneAddress* linphoneAddress = linphone_chat_room_get_peer_address(chatRoom); @@ -90,13 +90,13 @@ char *tmp = linphone_address_as_string_uri_only(linphoneAddress); NSString *normalizedSipAddress = [NSString stringWithUTF8String:tmp]; ms_free(tmp); - + ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress]; if(contact != nil) { displayName = [FastAddressBook getContactDisplayName:contact]; image = [FastAddressBook getContactImage:contact thumbnail:true]; } - + // Display name if(displayName == nil) { const char* username = linphone_address_get_username(linphoneAddress); @@ -156,7 +156,7 @@ if(editing) { [deleteButton setAlpha:1.0f]; } else { - [deleteButton setAlpha:0.0f]; + [deleteButton setAlpha:0.0f]; } if(animated) { [UIView commitAnimations]; @@ -168,7 +168,7 @@ - (IBAction)onDeleteClick: (id) event { if(chatRoom != NULL) { - UIView *view = [self superview]; + UIView *view = [self superview]; // Find TableViewCell while( view != nil && ![view isKindOfClass:[UITableView class]]) view = [view superview]; if(view != nil) { diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 2ffa9a7e2..f877557ad 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UIChatRoomCell.h" #import "UILinphone.h" @@ -68,7 +68,7 @@ static UIFont *CELL_FONT = nil; [self addSubview:innerView]; [deleteButton setAlpha:0.0f]; - + // shift message box, otherwise it will collide with the bubble CGRect messageCoords = [messageText frame]; messageCoords.origin.x += 2; @@ -93,16 +93,16 @@ static UIFont *CELL_FONT = nil; [downloadButton release]; [imageTapGestureRecognizer release]; [resendTapGestureRecognizer release]; - + [super dealloc]; } -#pragma mark - +#pragma mark - - (void)setChatMessage:(LinphoneChatMessage *)message { self->chat = message; [self update]; - + } + (NSString*)decodeTextMessage:(const char*)text { @@ -119,7 +119,7 @@ static UIFont *CELL_FONT = nil; - (void)update { if(chat == nil) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room cell: null chat"]; + LOGW(@"Cannot update chat room cell: null chat"); return; } const char* url = linphone_chat_message_get_external_body_url(chat); @@ -155,9 +155,9 @@ static UIFont *CELL_FONT = nil; } }); } failureBlock:^(NSError *error) { - [LinphoneLogger log:LinphoneLoggerError format:@"Can't read image"]; + LOGE(@"Can't read image"); }]; - + [messageImageView setHidden:FALSE]; [downloadButton setHidden:TRUE]; } else { @@ -182,10 +182,10 @@ static UIFont *CELL_FONT = nil; [messageImageView setImage:nil]; [messageImageView setHidden:TRUE]; - + [downloadButton setHidden:TRUE]; } - + // Date NSDate* message_date = [NSDate dateWithTimeIntervalSince1970:linphone_chat_message_get_time(chat)]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; @@ -220,13 +220,13 @@ static UIFont *CELL_FONT = nil; [dateLabel setAttributedText:resend_text]; [resend_text release]; } - + if( outgoing){ [messageText setAccessibilityLabel:@"Outgoing message"]; } else { [messageText setAccessibilityLabel:@"Incoming message"]; } - + } - (void)setEditing:(BOOL)editing { @@ -241,7 +241,7 @@ static UIFont *CELL_FONT = nil; if(editing) { [deleteButton setAlpha:1.0f]; } else { - [deleteButton setAlpha:0.0f]; + [deleteButton setAlpha:0.0f]; } if(animated) { [UIView commitAnimations]; @@ -330,7 +330,7 @@ static UIFont *CELL_FONT = nil; - (IBAction)onDeleteClick:(id)event { if(chat != NULL) { - UIView *view = [self superview]; + UIView *view = [self superview]; // Find TableViewCell while(view != nil && ![view isKindOfClass:[UITableView class]]) view = [view superview]; if(view != nil) { diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index 0cdafc3b1..da3230d31 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UICompositeViewController.h" @@ -52,8 +52,8 @@ return [self.name compare:description.name] == NSOrderedSame; } -- (id)init:(NSString *)aname content:(NSString *)acontent stateBar:(NSString*)astateBar - stateBarEnabled:(BOOL) astateBarEnabled +- (id)init:(NSString *)aname content:(NSString *)acontent stateBar:(NSString*)astateBar + stateBarEnabled:(BOOL) astateBarEnabled tabBar:(NSString*)atabBar tabBarEnabled:(BOOL) atabBarEnabled fullscreen:(BOOL) afullscreen @@ -69,7 +69,7 @@ self.landscapeMode = alandscapeMode; self.portraitMode = aportraitMode; self.darkBackground = false; - + return self; } @@ -131,22 +131,22 @@ [self initUICompositeViewController]; } return self; -} +} - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [self.stateBarViewController release]; [self.tabBarViewController release]; [self.contentViewController release]; - + [contentView release]; [stateBarView release]; [tabBarView release]; [viewControllerCache release]; [viewTransition release]; [currentViewDescription release]; - + [super dealloc]; } @@ -190,7 +190,7 @@ } - (void)viewDidLoad { - /* Force landscape view to match portrait view, because portrait view inherits + /* Force landscape view to match portrait view, because portrait view inherits the device screen size at load */ [self updateViewsFramesAccordingToLaunchOrientation]; [super viewDidLoad]; @@ -201,7 +201,7 @@ [self.contentViewController viewWillAppear:animated]; [self.tabBarViewController viewWillAppear:animated]; [self.stateBarViewController viewWillAppear:animated]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification @@ -221,9 +221,9 @@ [self.contentViewController viewWillDisappear:animated]; [self.tabBarViewController viewWillDisappear:animated]; [self.stateBarViewController viewWillDisappear:animated]; - + [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; - + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; @@ -340,7 +340,7 @@ } } if(remove) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Free cached view: %@", key]; + LOGI(@"Free cached view: %@", key); [viewControllerCache removeObjectForKey:key]; } } @@ -420,7 +420,7 @@ if(description != nil) { oldViewDescription = currentViewDescription; currentViewDescription = [description copy]; - + // Animate only with a previous screen if(oldViewDescription != nil && viewTransition != nil) { [contentView.layer removeAnimationForKey:@"transition"]; @@ -454,7 +454,7 @@ self.stateBarViewController = newStateBarViewController; self.contentViewController = newContentViewController; self.tabBarViewController = newTabBarViewController; - + // Update rotation UIInterfaceOrientation correctOrientation = [self getCorrectInterfaceOrientation:(UIDeviceOrientation)[UIApplication sharedApplication].statusBarOrientation]; if(currentOrientation != correctOrientation) { @@ -487,11 +487,11 @@ } else { oldViewDescription = (currentViewDescription != nil)? [currentViewDescription copy]: nil; } - + if(currentViewDescription == nil) { return; } - + if(tabBar != nil) { if(currentViewDescription.tabBarEnabled != [tabBar boolValue]) { currentViewDescription.tabBarEnabled = [tabBar boolValue]; @@ -499,7 +499,7 @@ tabBar = nil; // No change = No Update } } - + if(stateBar != nil) { if(currentViewDescription.stateBarEnabled != [stateBar boolValue]) { currentViewDescription.stateBarEnabled = [stateBar boolValue]; @@ -507,7 +507,7 @@ stateBar = nil; // No change = No Update } } - + if(fullscreen != nil) { if(currentViewDescription.fullscreen != [fullscreen boolValue]) { currentViewDescription.fullscreen = [fullscreen boolValue]; @@ -518,23 +518,23 @@ } else { [[UIApplication sharedApplication] setStatusBarHidden:currentViewDescription.fullscreen withAnimation:UIStatusBarAnimationNone]; } - + // Start animation if(tabBar != nil || stateBar != nil || fullscreen != nil) { [UIView beginAnimations:@"resize" context:nil]; [UIView setAnimationDuration:0.35]; [UIView setAnimationBeginsFromCurrentState:TRUE]; } - + CGRect contentFrame = contentView.frame; CGRect viewFrame = [self.view frame]; - + // Resize StateBar CGRect stateBarFrame = stateBarView.frame; int origin = IPHONE_STATUSBAR_HEIGHT; if(currentViewDescription.fullscreen) origin = 0; - + if(self.stateBarViewController != nil && currentViewDescription.stateBarEnabled) { contentFrame.origin.y = origin + stateBarFrame.size.height; stateBarFrame.origin.y = origin; @@ -542,7 +542,7 @@ contentFrame.origin.y = origin; stateBarFrame.origin.y = origin - stateBarFrame.size.height; } - + // Resize TabBar CGRect tabFrame = tabBarView.frame; if(self.tabBarViewController != nil && currentViewDescription.tabBarEnabled) { @@ -567,12 +567,12 @@ contentFrame.size.height = viewFrame.size.height - contentFrame.origin.y; tabFrame.origin.y = viewFrame.size.height; } - + if(currentViewDescription.fullscreen) { contentFrame.origin.y = origin; contentFrame.size.height = viewFrame.size.height - contentFrame.origin.y; } - + // Set frames [contentView setFrame: contentFrame]; [self.contentViewController.view setFrame: [contentView bounds]]; @@ -584,12 +584,12 @@ frame = [self.stateBarViewController.view frame]; frame.size.width = [stateBarView bounds].size.width; [self.stateBarViewController.view setFrame:frame]; - + // Commit animation if(tabBar != nil || stateBar != nil || fullscreen != nil) { [UIView commitAnimations]; } - + // Change view if(description != nil) { [UICompositeViewController addSubView: self.contentViewController view:contentView]; @@ -600,7 +600,7 @@ [UICompositeViewController addSubView: self.stateBarViewController view:stateBarView]; } } - + // Dealloc old view description if(oldViewDescription != nil) { [oldViewDescription release]; diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index 5f3c595de..ad0945609 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UIContactCell.h" #import "Utils.h" @@ -36,7 +36,7 @@ NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"UIContactCell" owner:self options:nil]; - + if ([arrayOfViews count] >= 1) { [self.contentView addSubview:[arrayOfViews objectAtIndex:0] ]; } @@ -48,7 +48,7 @@ [firstNameLabel release]; [lastNameLabel release]; [avatarImage release]; - + [super dealloc]; } @@ -60,7 +60,7 @@ [self update]; } -#pragma mark - +#pragma mark - - (void)touchUp:(id) sender { [self setHighlighted:true animated:true]; @@ -76,10 +76,10 @@ - (void)update { if(contact == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update contact cell: null contact"]; + LOGW(@"Cannot update contact cell: null contact"); return; } - + CFStringRef lFirstName = ABRecordCopyValue(contact, kABPersonFirstNameProperty); CFStringRef lLocalizedFirstName = (lFirstName != nil)?ABAddressBookCopyLocalizedLabel(lFirstName):nil; CFStringRef lLastName = ABRecordCopyValue(contact, kABPersonLastNameProperty); @@ -92,17 +92,17 @@ } else [firstNameLabel setText: @""]; - + if(lLocalizedLastName != nil){ [lastNameLabel setText: (NSString *)lLocalizedLastName]; } else [lastNameLabel setText: @""]; - + if(lLocalizedFirstName == nil && lLocalizedLastName == nil) { [firstNameLabel setText: (NSString *)lLocalizedOrganization]; } - + if(lLocalizedOrganization != nil) CFRelease(lLocalizedOrganization); if(lOrganization != nil) @@ -124,7 +124,7 @@ // CGRect firstNameFrame = [firstNameLabel frame]; CGRect lastNameFrame = [lastNameLabel frame]; - + // Compute firstName size CGSize firstNameSize = [[firstNameLabel text] sizeWithFont:[firstNameLabel font]]; CGSize lastNameSize = [[lastNameLabel text] sizeWithFont:[lastNameLabel font]]; @@ -134,10 +134,10 @@ firstNameSize.width *= limit/sum; lastNameSize.width *= limit/sum; } - + firstNameFrame.size.width = firstNameSize.width; lastNameFrame.size.width = lastNameSize.width; - + // Compute lastName size & position lastNameFrame.origin.x = firstNameFrame.origin.x + firstNameFrame.size.width; if(firstNameFrame.size.width) @@ -158,7 +158,7 @@ [firstNameLabel setTextColor:[UIColor whiteColor]]; } else { [lastNameLabel setTextColor:[UIColor blackColor]]; - [firstNameLabel setTextColor:[UIColor blackColor]]; + [firstNameLabel setTextColor:[UIColor blackColor]]; } } diff --git a/Classes/LinphoneUI/UIContactDetailsHeader.m b/Classes/LinphoneUI/UIContactDetailsHeader.m index 376006b15..3d9d9b331 100644 --- a/Classes/LinphoneUI/UIContactDetailsHeader.m +++ b/Classes/LinphoneUI/UIContactDetailsHeader.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UIContactDetailsHeader.h" #import "Utils.h" @@ -78,9 +78,9 @@ [normalView release]; [editView release]; [tableView release]; - + [propertyList release]; - + [super dealloc]; } @@ -119,10 +119,10 @@ - (void)update { if(contact == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update contact details header: null contact"]; + LOGW(@"Cannot update contact details header: null contact"); return; } - + // Avatar image { UIImage *image = [FastAddressBook getContactImage:contact thumbnail:false]; @@ -131,12 +131,12 @@ } [avatarImage setImage:image]; } - + // Contact label { [addressLabel setText:[FastAddressBook getContactDisplayName:contact]]; } - + [tableView reloadData]; } @@ -154,7 +154,7 @@ if(!editing) { [LinphoneUtils findAndResignFirstResponder:[self tableView]]; [self update]; - } + } if(animated) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; @@ -164,7 +164,7 @@ [normalView setAlpha:0.0f]; } else { [editView setAlpha:0.0f]; - [normalView setAlpha:1.0f]; + [normalView setAlpha:1.0f]; } if(animated) { [UIView commitAnimations]; @@ -203,7 +203,7 @@ - (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kCellId = @"ContactDetailsHeaderCell"; UIEditableTableViewCell *cell = [atableView dequeueReusableCellWithIdentifier:kCellId]; - if (cell == nil) { + if (cell == nil) { cell = [[[UIEditableTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kCellId] autorelease]; [cell.detailTextField setAutocapitalizationType:UITextAutocapitalizationTypeWords]; [cell.detailTextField setAutocorrectionType:UITextAutocorrectionTypeNo]; @@ -236,7 +236,7 @@ } } [cell.detailTextField setDelegate:self]; - + return cell; } @@ -257,16 +257,16 @@ } if(controller != nil) { controller.sourceType = type; - + // Displays a control that allows the user to choose picture or // movie capture, if both are available: controller.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage]; - + // Hides the controls for moving & scaling pictures, or for // trimming movies. To instead show the controls, use YES. controller.allowsEditing = NO; controller.imagePickerDelegate = self; - + if([LinphoneManager runningOnIpad]) { [controller.popoverController presentPopoverFromRect:[avatarImage frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:FALSE]; } @@ -287,7 +287,7 @@ [sheet addDestructiveButtonWithTitle:NSLocalizedString(@"Remove", nil) block:^(){ NSError* error = NULL; if(!ABPersonRemoveImageData(contact, (CFErrorRef*)error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't remove entry: %@", [error localizedDescription]]; + LOGI(@"Can't remove entry: %@", [error localizedDescription]); } [self update]; }]; @@ -316,7 +316,7 @@ FastAddressBook* fab = [LinphoneManager instance].fastAddressBook; NSError* error = NULL; if(!ABPersonRemoveImageData(contact, (CFErrorRef*)error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't remove entry: %@", [error localizedDescription]]; + LOGI(@"Can't remove entry: %@", [error localizedDescription]); } NSData *dataRef = UIImageJPEGRepresentation(image, 0.9f); CFDataRef cfdata = CFDataCreate(NULL,[dataRef bytes], [dataRef length]); @@ -324,13 +324,13 @@ [fab saveAddressBook]; if(!ABPersonSetImageData(contact, cfdata, (CFErrorRef*)error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; + LOGI(@"Can't add entry: %@", [error localizedDescription]); } else { [fab saveAddressBook]; } CFRelease(cfdata); - + [self update]; } @@ -345,7 +345,7 @@ #pragma mark - UITextFieldDelegate Functions - (BOOL)textFieldShouldReturn:(UITextField *)textField { - [textField resignFirstResponder]; + [textField resignFirstResponder]; return YES; } @@ -358,10 +358,10 @@ } - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { - UIView *view = [textField superview]; + UIView *view = [textField superview]; // Find TableViewCell while(view != nil && ![view isKindOfClass:[UIEditableTableViewCell class]]) view = [view superview]; - + if(view != nil) { UIEditableTableViewCell *cell = (UIEditableTableViewCell*)view; NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; @@ -370,10 +370,10 @@ NSError* error = NULL; ABRecordSetValue(contact, property, [textField text], (CFErrorRef*)&error); if (error != NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Error when saving property %i in contact %p: Fail(%@)", property, contact, [error localizedDescription]]; - } + LOGE(@"Error when saving property %i in contact %p: Fail(%@)", property, contact, [error localizedDescription]); + } } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Not valid UIEditableTableViewCell"]; + LOGW(@"Not valid UIEditableTableViewCell"); } if(contactDetailsDelegate != nil) { //add a mini delay to have the text updated BEFORE notifying the selector diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index 2f9b9d82d..fbda68674 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UIHistoryCell.h" #import "LinphoneManager.h" @@ -37,11 +37,11 @@ NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"UIHistoryCell" owner:self options:nil]; - + if ([arrayOfViews count] >= 1) { [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; } - + self->callLog = NULL; } return self; @@ -52,7 +52,7 @@ [deleteButton release]; [addressLabel release]; [imageView release]; - + [super dealloc]; } @@ -79,7 +79,7 @@ - (IBAction)onDelete:(id)event { if(callLog != NULL) { - UIView *view = [self superview]; + UIView *view = [self superview]; // Find TableViewCell while(view != nil && ![view isKindOfClass:[UITableView class]]) view = [view superview]; if(view != nil) { @@ -91,7 +91,7 @@ } -#pragma mark - +#pragma mark - - (NSString *)accessibilityValue { // TODO: localize? @@ -108,12 +108,12 @@ - (void)update { if(callLog == NULL) { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update history cell: null callLog"]; + LOGW(@"Cannot update history cell: null callLog"); return; } - + // Set up the cell... - LinphoneAddress* addr; + LinphoneAddress* addr; UIImage *image; if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) { if (linphone_call_log_get_status(callLog) != LinphoneCallMissed) { @@ -126,11 +126,11 @@ image = [UIImage imageNamed:@"call_status_outgoing.png"]; addr = linphone_call_log_get_to(callLog); } - + NSString* address = nil; if(addr != NULL) { BOOL useLinphoneAddress = true; - // contact name + // contact name char* lAddress = linphone_address_as_string_uri_only(addr); if(lAddress) { NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]]; @@ -144,9 +144,9 @@ if(useLinphoneAddress) { const char* lDisplayName = linphone_address_get_display_name(addr); const char* lUserName = linphone_address_get_username(addr); - if (lDisplayName) + if (lDisplayName) address = [NSString stringWithUTF8String:lDisplayName]; - else if(lUserName) + else if(lUserName) address = [NSString stringWithUTF8String:lUserName]; } } @@ -169,10 +169,10 @@ } if(editing) { [deleteButton setAlpha:1.0f]; - [detailsButton setAlpha:0.0f]; + [detailsButton setAlpha:0.0f]; } else { [detailsButton setAlpha:1.0f]; - [deleteButton setAlpha:0.0f]; + [deleteButton setAlpha:0.0f]; } if(animated) { [UIView commitAnimations]; diff --git a/Classes/LinphoneUI/UILinphone.m b/Classes/LinphoneUI/UILinphone.m index edc2d5b51..c069f9f8a 100644 --- a/Classes/LinphoneUI/UILinphone.m +++ b/Classes/LinphoneUI/UILinphone.m @@ -28,12 +28,12 @@ - (UIColor *)lumColor:(float)mult { float hsbH, hsbS, hsbB; float rgbaR, rgbaG, rgbaB, rgbaA; - + // Get RGB CGColorRef cgColor = [self CGColor]; CGColorSpaceRef cgColorSpace = CGColorGetColorSpace(cgColor); if(CGColorSpaceGetModel(cgColorSpace) != kCGColorSpaceModelRGB) { - [LinphoneLogger log:LinphoneLoggerWarning format:@"Can't convert not RGB color"]; + LOGW(@"Can't convert not RGB color"); return self; } else { const CGFloat *colors = CGColorGetComponents(cgColor); @@ -42,26 +42,26 @@ rgbaB = colors[2]; rgbaA = CGColorGetAlpha(cgColor); } - + RGB2HSL(rgbaR, rgbaG, rgbaB, &hsbH, &hsbS, &hsbB); - + hsbB = MIN(MAX(hsbB * mult, 0.0), 1.0); - + HSL2RGB(hsbH, hsbS, hsbB, &rgbaR, &rgbaG, &rgbaB); - + return [UIColor colorWithRed:rgbaR green:rgbaG blue:rgbaB alpha:rgbaA]; } - (UIColor *)adjustHue:(float)hm saturation:(float)sm brightness:(float)bm alpha:(float)am { float hsbH, hsbS, hsbB; float rgbaR, rgbaG, rgbaB, rgbaA; - - + + // Get RGB CGColorRef cgColor = [self CGColor]; CGColorSpaceRef cgColorSpace = CGColorGetColorSpace(cgColor); if(CGColorSpaceGetModel(cgColorSpace) != kCGColorSpaceModelRGB) { - [LinphoneLogger log:LinphoneLoggerWarning format:@"Can't convert not RGB color"]; + LOGW(@"Can't convert not RGB color"); return self; } else { const CGFloat *colors = CGColorGetComponents(cgColor); @@ -70,16 +70,16 @@ rgbaB = colors[2]; rgbaA = CGColorGetAlpha(cgColor); } - + RGB2HSL(rgbaR, rgbaG, rgbaB, &hsbH, &hsbS, &hsbB); - + hsbH = MIN(MAX(hsbH + hm, 0.0), 1.0); hsbS = MIN(MAX(hsbS + sm, 0.0), 1.0); hsbB = MIN(MAX(hsbB + bm, 0.0), 1.0); rgbaA = MIN(MAX(rgbaA + am, 0.0), 1.0); - + HSL2RGB(hsbH, hsbS, hsbB, &rgbaR, &rgbaG, &rgbaB); - + return [UIColor colorWithRed:rgbaR green:rgbaG blue:rgbaB alpha:rgbaA]; } @@ -114,12 +114,12 @@ kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Little); CGColorSpaceRelease(colorSpace); if (!context) return nil; - + CGRect rect = (CGRect){CGPointZero,{CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)}}; CGContextDrawImage(context, rect, imageRef); CGImageRef decompressedImageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); - + UIImage *decompressedImage = [[UIImage alloc] initWithCGImage:decompressedImageRef scale:image.scale orientation:image.imageOrientation]; CGImageRelease(decompressedImageRef); return [decompressedImage autorelease]; diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m index adf20f954..88bb64875 100644 --- a/Classes/LinphoneUI/UIPauseButton.m +++ b/Classes/LinphoneUI/UIPauseButton.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "UIPauseButton.h" #import "LinphoneManager.h" @@ -46,7 +46,7 @@ [self initUIPauseButton]; } return self; -} +} - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -68,7 +68,7 @@ + (int)notInConferenceCallCount: (LinphoneCore*) lc { int count = 0; const MSList* calls = linphone_core_get_calls(lc); - + while (calls != 0) { if (![UIPauseButton isInConference: (LinphoneCall*)calls->data]) { count++; @@ -88,7 +88,7 @@ } -#pragma mark - +#pragma mark - - (void)setType:(UIPauseButtonType) atype call:(LinphoneCall*)acall { type = atype; @@ -105,14 +105,14 @@ if (call != nil) { linphone_core_pause_call([LinphoneManager getLc], call); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; + LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } case UIPauseButtonType_Conference: { linphone_core_leave_conference([LinphoneManager getLc]); - + // Fake event [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self]; break; @@ -123,7 +123,7 @@ if (currentCall != nil) { linphone_core_pause_call([LinphoneManager getLc], currentCall); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; + LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } @@ -137,7 +137,7 @@ if (call != nil) { linphone_core_resume_call([LinphoneManager getLc], call); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; + LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } @@ -154,7 +154,7 @@ if (currentCall != nil) { linphone_core_resume_call([LinphoneManager getLc], currentCall); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle pause buttton, because no current call"]; + LOGW(@"Cannot toggle pause buttton, because no current call"); } break; } diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m index 2fd073c60..9e21f3997 100644 --- a/Classes/LinphoneUI/UISpeakerButton.m +++ b/Classes/LinphoneUI/UISpeakerButton.m @@ -44,7 +44,7 @@ static void audioRouteChangeListenerCallback ( AudioSessionInitialize(NULL, NULL, NULL, NULL); OSStatus lStatus = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, self); if (lStatus) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot register route change handler [%ld]",lStatus]; + LOGE(@"cannot register route change handler [%ld]",lStatus); } } @@ -75,7 +75,7 @@ static void audioRouteChangeListenerCallback ( - (void)dealloc { OSStatus lStatus = AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, self); if (lStatus) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot un register route change handler [%ld]", lStatus]; + LOGE(@"cannot un register route change handler [%ld]", lStatus); } [super dealloc]; } diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index 80c36f97a..02e553283 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -167,13 +167,13 @@ int messagesUnreadCount; } const char* body = linphone_content_get_buffer(content); if ((body = strstr(body, "voice-message: ")) == NULL) { - [LinphoneLogger log:LinphoneLoggerWarning format:@"Received new NOTIFY from voice mail but could not find 'voice-message' in BODY. Ignoring it."]; + LOGW(@"Received new NOTIFY from voice mail but could not find 'voice-message' in BODY. Ignoring it."); return; } sscanf(body, "voice-message: %d", &messagesUnreadCount); - [LinphoneLogger log:LinphoneLoggerLog format:@"Received new NOTIFY from voice mail: there is/are now %d message(s) unread", messagesUnreadCount]; + 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); diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index 1edd7f0b3..0a7bd358c 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -72,7 +72,7 @@ linphone_core_update_call(lc, call, call_params); linphone_call_params_destroy(call_params); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button, because no current call"]; + LOGW(@"Cannot toggle video button, because no current call"); } } @@ -92,7 +92,7 @@ linphone_core_update_call(lc, call, call_params); linphone_call_params_destroy(call_params); } else { - [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot toggle video button, because no current call"]; + LOGW(@"Cannot toggle video button, because no current call"); } } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index e1ad68ec9..b8004a291 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import #import @@ -145,7 +145,7 @@ static RootViewManager* rootViewManagerInstance = nil; - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [mainViewController release]; [inhibitedEvents release]; @@ -169,16 +169,16 @@ static RootViewManager* rootViewManagerInstance = nil; [super viewWillAppear:animated]; // Set observers - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(callUpdate:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(callUpdate:) name:kLinphoneCallUpdate object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(registrationUpdate:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(registrationUpdate:) name:kLinphoneRegistrationUpdate object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(textReceived:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(textReceived:) name:kLinphoneTextReceived object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -187,7 +187,7 @@ static RootViewManager* rootViewManagerInstance = nil; object:nil]; [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(batteryLevelChanged:) + selector:@selector(batteryLevelChanged:) name:UIDeviceBatteryLevelDidChangeNotification object:nil]; @@ -197,10 +197,10 @@ static RootViewManager* rootViewManagerInstance = nil; [super viewWillDisappear:animated]; // Remove observers - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self + [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self @@ -210,10 +210,10 @@ static RootViewManager* rootViewManagerInstance = nil; name:kLinphoneConfiguringStateUpdate object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self - name:UIDeviceBatteryLevelDidChangeNotification + name:UIDeviceBatteryLevelDidChangeNotification object:nil]; [[UIDevice currentDevice] setBatteryMonitoringEnabled:NO]; - + } -(void)viewDidAppear:(BOOL)animated { @@ -270,7 +270,7 @@ static RootViewManager* rootViewManagerInstance = nil; #pragma mark - Event Functions -- (void)textReceived:(NSNotification*)notif { +- (void)textReceived:(NSNotification*)notif { LinphoneAddress* from = [[notif.userInfo objectForKey:@"from_address"] pointerValue]; NSString* callID = [notif.userInfo objectForKey:@"call-id"]; if(from != nil) { @@ -316,22 +316,22 @@ static RootViewManager* rootViewManagerInstance = nil; LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue]; LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue]; NSString *message = [notif.userInfo objectForKey: @"message"]; - + bool canHideInCallView = (linphone_core_get_calls([LinphoneManager getLc]) == NULL); - + // Don't handle call state during incoming call view if([[self currentView] equal:[IncomingCallViewController compositeViewDescription]] && state != LinphoneCallError && state != LinphoneCallEnd) { return; } - - switch (state) { - case LinphoneCallIncomingReceived: + + switch (state) { + case LinphoneCallIncomingReceived: case LinphoneCallIncomingEarlyMedia: { [self displayIncomingCall:call]; break; } - case LinphoneCallOutgoingInit: + case LinphoneCallOutgoingInit: case LinphoneCallPausedByRemote: case LinphoneCallConnected: case LinphoneCallStreamsRunning: @@ -343,7 +343,7 @@ static RootViewManager* rootViewManagerInstance = nil; { const LinphoneCallParams* current = linphone_call_get_current_params(call); const LinphoneCallParams* remote = linphone_call_get_remote_params(call); - + if (linphone_call_params_video_enabled(current) && !linphone_call_params_video_enabled(remote)) { [self changeCurrentView:[InCallViewController compositeViewDescription]]; } @@ -353,7 +353,7 @@ static RootViewManager* rootViewManagerInstance = nil; { [self displayCallError:call message: message]; } - case LinphoneCallEnd: + case LinphoneCallEnd: { if (canHideInCallView) { // Go to dialer view @@ -374,7 +374,7 @@ static RootViewManager* rootViewManagerInstance = nil; } -#pragma mark - +#pragma mark - - (void)orientationUpdate:(UIInterfaceOrientation)orientation { int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]); @@ -451,7 +451,7 @@ static RootViewManager* rootViewManagerInstance = nil; [trans setDuration:0.35]; [trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [trans setSubtype:transition]; - + return trans; } @@ -463,13 +463,13 @@ static RootViewManager* rootViewManagerInstance = nil; [trans setDuration:0.35]; [trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [trans setSubtype:transition]; - + return trans; } + (CATransition*)getTransition:(UICompositeViewDescription *)old new:(UICompositeViewDescription *)new { bool left = false; - + if([old equal:[ChatViewController compositeViewDescription]]) { if([new equal:[ContactsViewController compositeViewDescription]] || [new equal:[DialerViewController compositeViewDescription]] || @@ -492,7 +492,7 @@ static RootViewManager* rootViewManagerInstance = nil; if([new equal:[HistoryViewController compositeViewDescription]]) { left = true; } - } + } if(left) { return [PhoneMainView getBackwardTransition]; @@ -558,7 +558,7 @@ static RootViewManager* rootViewManagerInstance = nil; } - (UIViewController*)_changeCurrentView:(UICompositeViewDescription*)view transition:(CATransition*)transition force:(BOOL)force { - [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Change current view to %@", [view name]]; + LOGI(@"PhoneMainView: Change current view to %@", [view name]); PhoneMainView* vc = [[RootViewManager instance] setViewControllerForDescription:view]; @@ -576,10 +576,10 @@ static RootViewManager* rootViewManagerInstance = nil; } //[[RootViewManager instance] setViewControllerForDescription:view]; - + NSDictionary* mdict = [NSMutableDictionary dictionaryWithObject:vc->currentView forKey:@"view"]; [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict]; - + return [vc->mainViewController getCurrentViewController]; } @@ -601,13 +601,13 @@ static RootViewManager* rootViewManagerInstance = nil; } - (UIViewController*)popCurrentView { - [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Pop view"]; + LOGI(@"PhoneMainView: Pop view"); NSMutableArray* viewStack = [RootViewManager instance].viewDescriptionStack; if([viewStack count] > 1) { [viewStack removeLastObject]; [self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition] force:TRUE]; return [mainViewController getCurrentViewController]; - } + } return nil; } @@ -616,16 +616,16 @@ static RootViewManager* rootViewManagerInstance = nil; NSString* lUserName = lUserNameChars?[[[NSString alloc] initWithUTF8String:lUserNameChars] autorelease]:NSLocalizedString(@"Unknown",nil); NSString* lMessage; NSString* lTitle; - + //get default proxy - LinphoneProxyConfig* proxyCfg; + LinphoneProxyConfig* proxyCfg; linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg); 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.", nil); } else { lMessage = [NSString stringWithFormat : NSLocalizedString(@"Cannot call %@", nil), lUserName]; } - + if (linphone_call_get_reason(call) == LinphoneReasonNotFound) { lMessage = [NSString stringWithFormat : NSLocalizedString(@"'%@' not registered", nil), lUserName]; } else { @@ -635,9 +635,9 @@ static RootViewManager* rootViewManagerInstance = nil; } lTitle = NSLocalizedString(@"Call failed",nil); UIAlertView* error = [[UIAlertView alloc] initWithTitle:lTitle - message:lMessage - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Dismiss",nil) + message:lMessage + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Dismiss",nil) otherButtonTitles:nil]; [error show]; [error release]; @@ -703,15 +703,15 @@ static RootViewManager* rootViewManagerInstance = nil; - (void)batteryLevelChanged:(NSNotification*)notif { float level = [UIDevice currentDevice].batteryLevel; UIDeviceBatteryState state = [UIDevice currentDevice].batteryState; - [LinphoneLogger log:LinphoneLoggerDebug format:@"Battery state:%d level:%.2f", state, level]; - + LOGD(@"Battery state:%d level:%.2f", state, level); + LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { LinphoneCallAppData* callData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); if(callData != nil) { if (state == UIDeviceBatteryStateUnplugged) { if (level <= 0.2f && !callData->batteryWarningShown) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Battery warning"]; + LOGI(@"Battery warning"); DTActionSheet *sheet = [[[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"Battery is running low. Stop video ?",nil)] autorelease]; [sheet addCancelButtonWithTitle:NSLocalizedString(@"Continue video", nil) block:nil]; [sheet addDestructiveButtonWithTitle:NSLocalizedString(@"Stop video", nil) block:^() { @@ -745,4 +745,4 @@ static RootViewManager* rootViewManagerInstance = nil; linphone_core_terminate_call([LinphoneManager getLc], call); } -@end \ No newline at end of file +@end diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index d200f59e3..5e058c26a 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "SettingsViewController.h" #import "LinphoneManager.h" @@ -67,7 +67,7 @@ - (void)dealloc { [_key release], _key = nil; - + [super dealloc]; } @@ -113,7 +113,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; - + // Background View UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease]; cell.selectedBackgroundView = selectedBackgroundView; @@ -155,7 +155,7 @@ - (void)toggledValue:(id)sender { IASKSwitchEx *toggle = [[(IASKSwitchEx*)sender retain] autorelease]; IASKSpecifier *spec = [_settingsReader specifierForKey:[toggle key]]; - + if ([toggle isOn]) { if ([spec trueValue] != nil) { [self.settingsStore setObject:[spec trueValue] forKey:[toggle key]]; @@ -183,16 +183,16 @@ - (void)initIASKAppSettingsViewControllerEx { [self.view setBackgroundColor:[UIColor clearColor]]; - + // Force kIASKSpecifierValuesViewControllerIndex static int kIASKSpecifierValuesViewControllerIndex = 0; _viewList = [[NSMutableArray alloc] init]; [_viewList addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"IASKSpecifierValuesView", @"ViewName",nil]]; [_viewList addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"IASKAppSettingsView", @"ViewName",nil]]; - + NSMutableDictionary *newItemDict = [NSMutableDictionary dictionaryWithCapacity:3]; [newItemDict addEntriesFromDictionary: [_viewList objectAtIndex:kIASKSpecifierValuesViewControllerIndex]]; // copy the title and explain strings - + IASKSpecifierValuesViewController *targetViewController = [[IASKSpecifierValuesViewControllerEx alloc] init]; // add the new view controller to the dictionary and then to the 'viewList' array [newItemDict setObject:targetViewController forKey:@"viewController"]; @@ -212,7 +212,7 @@ } [specifiers replaceObjectAtIndex:j withObject:sp]; } - + [dataSource replaceObjectAtIndex:i withObject:specifiers]; } [r setDataSource:dataSource]; @@ -222,7 +222,7 @@ - (void)viewDidLoad { [super viewDidLoad]; - + [self.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4 [self.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4 } @@ -237,8 +237,8 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - - + + UIEdgeInsets inset = {0, 0, 10, 0}; UIScrollView *scrollView = self.tableView; [scrollView setContentInset:inset]; @@ -247,7 +247,7 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - + UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"About", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(onAboutClick:)]; self.navigationItem.rightBarButtonItem = buttonItem; [buttonItem release]; @@ -255,7 +255,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; - + if([cell isKindOfClass:[IASKPSTextFieldSpecifierViewCell class]]) { UITextField *field = ((IASKPSTextFieldSpecifierViewCell*)cell).textField; [field setTextColor:LINPHONE_MAIN_COLOR]; @@ -266,7 +266,7 @@ } else { cell.detailTextLabel.textColor = LINPHONE_MAIN_COLOR; } - + // Background View UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease]; cell.selectedBackgroundView = selectedBackgroundView; @@ -284,7 +284,7 @@ #pragma mark - UINavigationBarEx Class @interface UINavigationBarEx: UINavigationBar { - + } @end @@ -413,12 +413,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"Settings" - content:@"SettingsViewController" - stateBar:nil - stateBarEnabled:false - tabBar: @"UIMainBar" - tabBarEnabled:true + compositeDescription = [[UICompositeViewDescription alloc] init:@"Settings" + content:@"SettingsViewController" + stateBar:nil + stateBarEnabled:false + tabBar: @"UIMainBar" + tabBarEnabled:true fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; @@ -431,16 +431,16 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidLoad { [super viewDidLoad]; - + settingsStore = [[LinphoneCoreSettingsStore alloc] init]; - + settingsController.showDoneButton = FALSE; settingsController.delegate = self; settingsController.showCreditsFooter = FALSE; settingsController.settingsStore = settingsStore; - + [navigationController.view setBackgroundColor:[UIColor clearColor]]; - + navigationController.view.frame = self.view.frame; [navigationController pushViewController:settingsController animated:FALSE]; [self.view addSubview: navigationController.view]; @@ -450,24 +450,24 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewWillDisappear:animated]; [settingsController dismiss:self]; // Set observer - [[NSNotificationCenter defaultCenter] removeObserver:self - name:kIASKAppSettingChanged + [[NSNotificationCenter defaultCenter] removeObserver:self + name:kIASKAppSettingChanged object:nil]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + [settingsStore transformLinphoneCoreToKeys]; // Sync settings with linphone core settings settingsController.hiddenKeys = [self findHiddenKeys]; - [settingsController.tableView reloadData]; - + [settingsController.tableView reloadData]; + // Set observer - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(appSettingChanged:) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appSettingChanged:) name:kIASKAppSettingChanged object:nil]; - + } @@ -594,7 +594,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (NSSet*)findHiddenKeys { LinphoneManager* lm = [LinphoneManager instance]; NSMutableSet *hiddenKeys = [NSMutableSet set]; - + #ifndef DEBUG [hiddenKeys addObject:@"release_button"]; [hiddenKeys addObject:@"clear_cache_button"]; @@ -608,25 +608,25 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"playback_gain_preference"]; [hiddenKeys addObject:@"microphone_gain_preference"]; - + [hiddenKeys addObject:@"network_limit_group"]; [hiddenKeys addObject:@"upload_bandwidth_preference"]; [hiddenKeys addObject:@"download_bandwidth_preference"]; - + [hiddenKeys addObject:@"incoming_call_timeout_preference"]; [hiddenKeys addObject:@"in_call_timeout_preference"]; - + [hiddenKeys addObject:@"wifi_only_preference"]; - + [hiddenKeys addObject:@"quit_button"]; // Hide for the moment [hiddenKeys addObject:@"about_button"]; // Hide for the moment - + if (!linphone_core_video_supported([LinphoneManager getLc])) [hiddenKeys addObject:@"video_menu"]; - + if (![LinphoneManager isNotIphone3G]) [hiddenKeys addObject:@"silk_24k_preference"]; - + UIDevice* device = [UIDevice currentDevice]; if (![device respondsToSelector:@selector(isMultitaskingSupported)] || ![device isMultitaskingSupported]) { [hiddenKeys addObject:@"backgroundmode_preference"]; @@ -636,18 +636,18 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"start_at_boot_preference"]; } } - + [hiddenKeys addObject:@"enable_first_login_view_preference"]; - + #ifndef VIDEO_ENABLED [hiddenKeys addObject:@"enable_video_preference"]; #endif //VIDEO_ENABLED - + if (!linphone_core_video_enabled([LinphoneManager getLc])) { [hiddenKeys addObject:@"video_menu"]; } - - + + [hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]]; BOOL random_port = [lm lpConfigBoolForKey:@"random_port_preference"]; @@ -662,14 +662,14 @@ static UICompositeViewDescription *compositeDescription = nil; if(![lm lpConfigBoolForKey:@"debugenable_preference"]) { [hiddenKeys addObject:@"console_button"]; } - + if(![LinphoneManager runningOnIpad]) { [hiddenKeys addObject:@"preview_preference"]; } if([lm lpConfigBoolForKey:@"hide_run_assistant_preference"]) { [hiddenKeys addObject:@"wizard_button"]; } - + if (!linphone_core_tunnel_available()){ [hiddenKeys addObject:@"tunnel_menu"]; } @@ -750,7 +750,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else if ([key isEqual:@"send_logs_button"]) { char * filepath = linphone_core_compress_log_collection(lc); if (filepath == NULL) { - [LinphoneLogger log:LinphoneLoggerError format:@"Cannot sent logs: file is NULL"]; + LOGE(@"Cannot sent logs: file is NULL"); return; } @@ -767,7 +767,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else if ([filename hasSuffix:@".gz"]) { mimeType = @"application/gzip"; } else { - [LinphoneLogger log:LinphoneLoggerError format:@"Unknown extension type: %@, cancelling email", filename]; + LOGE(@"Unknown extension type: %@, cancelling email", filename); return; } [self emailAttachment:[NSData dataWithContentsOfFile:[NSString stringWithUTF8String:filepath]] mimeType:mimeType name:filename]; @@ -788,7 +788,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)emailAttachment: (NSData*)attachment mimeType:(NSString*)type name:(NSString*)attachmentName { if (attachmentName == nil || type == nil || attachmentName == nil) { - [LinphoneLogger log:LinphoneLoggerError format:@"Trying to email attachment but mandatory field is missing"]; + LOGE(@"Trying to email attachment but mandatory field is missing"); return; } @@ -827,9 +827,9 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { if (error != nil) { - [LinphoneLogger log:LinphoneLoggerWarning format:@"Error while sending mail: %@", error]; + LOGW(@"Error while sending mail: %@", error); } else { - [LinphoneLogger log:LinphoneLoggerLog format:@"Mail completed with status: %d", result]; + LOGI(@"Mail completed with status: %d", result); } [self dismissViewControllerAnimated:true completion:nil]; } diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 612b0b8c4..042839cd1 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -77,7 +77,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } if (retImage != nil && retImage.size.width != retImage.size.height) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Image is not square : cropping it."]; + LOGI(@"Image is not square : cropping it."); return [self squareImageCrop:retImage]; } } @@ -107,7 +107,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } + (NSString*)normalizeSipURI:(NSString*)address { - // replace all whitespaces (non-breakable, utf8 nbsp etc.) by the "classical" whitespace + // replace all whitespaces (non-breakable, utf8 nbsp etc.) by the "classical" whitespace address = [[address componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString:@" "]; NSString *normalizedSipAddress = nil; LinphoneAddress* linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], [address UTF8String]); @@ -185,7 +185,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf [self loadData]; }); } else { - [LinphoneLogger log:LinphoneLoggerError format:@"Create AddressBook: Fail(%@)", [error localizedDescription]]; + LOGE(@"Create AddressBook: Fail(%@)", [error localizedDescription]); } } diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 0edac128a..8e210c001 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -38,8 +38,7 @@ typedef enum _LinphoneLoggerSeverity { @interface LinphoneLogger : NSObject { } -+ (void)log:(LinphoneLoggerSeverity) severity format:(NSString *)format,...; -+ (void)logc:(LinphoneLoggerSeverity) severity format:(const char *)format,...; ++ (void)log:(LinphoneLoggerSeverity)severity file:(const char*)file line:(int)line format:(NSString *)format,...; @end @@ -62,7 +61,7 @@ typedef enum _LinphoneLoggerSeverity { @end -#define LOGV(level, ...) [LinphoneLogger log:level format:__VA_ARGS__] +#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__] #define LOGI(...) LOGV(LinphoneLoggerLog, __VA_ARGS__) #define LOGD(...) LOGV(LinphoneLoggerDebug, __VA_ARGS__) #define LOGW(...) LOGV(LinphoneLoggerWarning, __VA_ARGS__) diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 8cdde9661..b15ee923f 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -24,36 +24,32 @@ @implementation LinphoneLogger -+ (void)logv:(LinphoneLoggerSeverity)severity format:(NSString*)format args:(va_list)args{ ++ (void)logv:(LinphoneLoggerSeverity)severity file:(const char*)file line:(int)line format:(NSString*)format args:(va_list)args{ NSString *str = [[NSString alloc] initWithFormat:format arguments:args]; - [self logc:severity format:[str UTF8String]]; + OrtpLogLevel ortp_severity; + int filesize = 20; + if (severity <= LinphoneLoggerDebug) { + ortp_severity = ORTP_DEBUG; + } else if(severity <= LinphoneLoggerLog) { + ortp_severity = ORTP_MESSAGE; + } else if(severity <= LinphoneLoggerWarning) { + ortp_severity = ORTP_WARNING; + } else if(severity <= LinphoneLoggerError) { + ortp_severity = ORTP_ERROR; + } else { + ortp_severity = ORTP_FATAL; + } + ortp_log(ortp_severity, "%*s:%3d - %s", filesize, file+MAX((int)strlen(file)-filesize,0), line, [str UTF8String]); [str release]; } -+ (void)log:(LinphoneLoggerSeverity) severity format:(NSString *)format,... { ++ (void)log:(LinphoneLoggerSeverity) severity file:(const char*)file line:(int)line format:(NSString *)format,... { va_list args; va_start (args, format); - [LinphoneLogger logv:severity format:format args:args]; + [LinphoneLogger logv:severity file:file line:line format:format args:args]; va_end (args); } -+ (void)logc:(LinphoneLoggerSeverity) severity format:(const char *)format,... { - va_list args; - va_start (args, format); - if(severity <= LinphoneLoggerDebug) { - ortp_logv(ORTP_DEBUG, format, args); - } else if(severity <= LinphoneLoggerLog) { - ortp_logv(ORTP_MESSAGE, format, args); - } else if(severity <= LinphoneLoggerWarning) { - ortp_logv(ORTP_WARNING, format, args); - } else if(severity <= LinphoneLoggerError) { - ortp_logv(ORTP_ERROR, format, args); - } else if(severity <= LinphoneLoggerFatal) { - ortp_logv(ORTP_FATAL, format, args); - } - va_end (args); -} - @end @implementation LinphoneUtils diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index 69110d042..3e355576c 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -4,18 +4,18 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #import "WizardViewController.h" #import "LinphoneManager.h" @@ -83,18 +83,18 @@ typedef enum _ViewElement { - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [contentView release]; - + [welcomeView release]; [choiceView release]; [createAccountView release]; [connectAccountView release]; [externalAccountView release]; [validateAccountView release]; - + [waitView release]; - + [backButton release]; [startButton release]; [createAccountButton release]; @@ -102,11 +102,11 @@ typedef enum _ViewElement { [externalAccountButton release]; [choiceViewLogoImageView release]; - + [historyViews release]; - + [viewTapGestureRecognizer release]; - + [remoteProvisioningButton release]; [provisionedAccountView release]; [provisionedUsername release]; @@ -123,12 +123,12 @@ static UICompositeViewDescription *compositeDescription = nil; + (UICompositeViewDescription *)compositeViewDescription { if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"Wizard" - content:@"WizardViewController" - stateBar:nil - stateBarEnabled:false - tabBar:nil - tabBarEnabled:false + compositeDescription = [[UICompositeViewDescription alloc] init:@"Wizard" + content:@"WizardViewController" + stateBar:nil + stateBarEnabled:false + tabBar:nil + tabBarEnabled:false fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; @@ -142,7 +142,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationUpdateEvent:) name:kLinphoneRegistrationUpdate @@ -182,11 +182,11 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidLoad { [super viewDidLoad]; - + [viewTapGestureRecognizer setCancelsTouchesInView:FALSE]; [viewTapGestureRecognizer setDelegate:self]; [contentView addGestureRecognizer:viewTapGestureRecognizer]; - + if([LinphoneManager runningOnIpad]) { [LinphoneUtils adjustFontSize:welcomeView mult:2.22f]; [LinphoneUtils adjustFontSize:choiceView mult:2.22f]; @@ -226,7 +226,7 @@ static UICompositeViewDescription *compositeDescription = nil; const LinphoneAuthInfo *auth = linphone_core_find_auth_info(lc, NULL, linphone_address_get_username(addr), linphone_proxy_config_get_domain(current_conf)); linphone_address_destroy(addr); if( auth ){ - [LinphoneLogger log:LinphoneLoggerLog format:@"A proxy config was set up with the remote provisioning, skip wizard"]; + LOGI(@"A proxy config was set up with the remote provisioning, skip wizard"); [self onCancelClick:nil]; } } @@ -271,14 +271,14 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)reset { [self clearProxyConfig]; [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; - + LinphoneCore *lc = [LinphoneManager getLc]; LCSipTransports transportValue={5060,5060,-1,-1}; if (linphone_core_set_sip_transports(lc, &transportValue)) { - [LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"]; + LOGE(@"cannot set transport"); } - + [[LinphoneManager instance] lpConfigSetString:@"" forKey:@"sharing_server_preference"]; [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"ice_preference"]; [[LinphoneManager instance] lpConfigSetString:@"" forKey:@"stun_preference"]; @@ -336,7 +336,7 @@ static UICompositeViewDescription *compositeDescription = nil; [startButton setHidden:true]; [backButton setHidden:false]; } - + if (view == validateAccountView) { [backButton setEnabled:FALSE]; } else if (view == choiceView) { @@ -384,7 +384,7 @@ static UICompositeViewDescription *compositeDescription = nil; view = connectAccountView; } } - + // Animation if(animation && [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) { CATransition* trans = [CATransition animation]; @@ -398,14 +398,14 @@ static UICompositeViewDescription *compositeDescription = nil; } [contentView.layer addAnimation:trans forKey:@"Transition"]; } - + // Stack current view if(currentView != nil) { if(!back) [historyViews addObject:currentView]; [currentView removeFromSuperview]; } - + // Set current view currentView = view; [contentView insertSubview:view atIndex:0]; @@ -531,44 +531,44 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Linphone XMLRPC - (void)checkUserExist:(NSString*)username { - [LinphoneLogger log:LinphoneLoggerLog format:@"XMLRPC check_account %@", username]; - + LOGI(@"XMLRPC check_account %@", username); + NSURL *URL = [NSURL URLWithString:[[LinphoneManager instance] lpConfigStringForKey:@"service_url" forSection:@"wizard"]]; XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL: URL]; [request setMethod: @"check_account" withParameters:[NSArray arrayWithObjects:username, nil]]; - + XMLRPCConnectionManager *manager = [XMLRPCConnectionManager sharedManager]; [manager spawnConnectionWithXMLRPCRequest: request delegate: self]; - + [request release]; [waitView setHidden:false]; } - (void)createAccount:(NSString*)identity password:(NSString*)password email:(NSString*)email { NSString *useragent = [LinphoneManager getUserAgent]; - [LinphoneLogger log:LinphoneLoggerLog format:@"XMLRPC create_account_with_useragent %@ %@ %@ %@", identity, password, email, useragent]; - + LOGI(@"XMLRPC create_account_with_useragent %@ %@ %@ %@", identity, password, email, useragent); + NSURL *URL = [NSURL URLWithString: [[LinphoneManager instance] lpConfigStringForKey:@"service_url" forSection:@"wizard"]]; XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL: URL]; [request setMethod: @"create_account_with_useragent" withParameters:[NSArray arrayWithObjects:identity, password, email, useragent, nil]]; - + XMLRPCConnectionManager *manager = [XMLRPCConnectionManager sharedManager]; [manager spawnConnectionWithXMLRPCRequest: request delegate: self]; - + [request release]; [waitView setHidden:false]; } - (void)checkAccountValidation:(NSString*)identity { - [LinphoneLogger log:LinphoneLoggerLog format:@"XMLRPC check_account_validated %@", identity]; - + LOGI(@"XMLRPC check_account_validated %@", identity); + NSURL *URL = [NSURL URLWithString: [[LinphoneManager instance] lpConfigStringForKey:@"service_url" forSection:@"wizard"]]; XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL: URL]; [request setMethod: @"check_account_validated" withParameters:[NSArray arrayWithObjects:identity, nil]]; - + XMLRPCConnectionManager *manager = [XMLRPCConnectionManager sharedManager]; [manager spawnConnectionWithXMLRPCRequest: request delegate: self]; - + [request release]; [waitView setHidden:false]; } @@ -792,19 +792,19 @@ static UICompositeViewDescription *compositeDescription = nil; NSInteger username_length = [[LinphoneManager instance] lpConfigIntForKey:@"username_length" forSection:@"wizard"]; NSInteger password_length = [[LinphoneManager instance] lpConfigIntForKey:@"password_length" forSection:@"wizard"]; - + if ([username length] < username_length) { [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"The username is too short (minimum %d characters).\n", nil), username_length]]; } - + if ([password length] < password_length) { [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"The password is too short (minimum %d characters).\n", nil), password_length]]; } - + if (![password2 isEqualToString:password]) { [errors appendString:NSLocalizedString(@"The passwords are different.\n", nil)]; } - + NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", @".+@.+\\.[A-Za-z]{2}[A-Za-z]*"]; if(![emailTest evaluateWithObject:email]) { [errors appendString:NSLocalizedString(@"The email is invalid.\n", nil)]; @@ -865,14 +865,14 @@ static UICompositeViewDescription *compositeDescription = nil; if( [url rangeOfString:@"://"].location == NSNotFound ) url = [NSString stringWithFormat:@"http://%@", url]; - [LinphoneLogger log:LinphoneLoggerLog format:@"Should use remote provisioning URL %@", url]; + LOGI(@"Should use remote provisioning URL %@", url); linphone_core_set_provisioning_uri([LinphoneManager getLc], [url UTF8String]); [waitView setHidden:false]; [[LinphoneManager instance] resetLinphoneCore]; } } else { - [LinphoneLogger log:LinphoneLoggerLog format:@"Canceled remote provisioning"]; + LOGI(@"Canceled remote provisioning"); } } @@ -929,13 +929,13 @@ static UICompositeViewDescription *compositeDescription = nil; [UIView setAnimationDuration:duration]; [UIView setAnimationCurve:curve]; [UIView setAnimationBeginsFromCurrentState:TRUE]; - + // Move view UIEdgeInsets inset = {0, 0, 0, 0}; [contentView setContentInset:inset]; [contentView setScrollIndicatorInsets:inset]; [contentView setShowsVerticalScrollIndicator:FALSE]; - + [UIView commitAnimations]; } @@ -948,14 +948,14 @@ static UICompositeViewDescription *compositeDescription = nil; [UIView setAnimationDuration:duration]; [UIView setAnimationCurve:curve]; [UIView setAnimationBeginsFromCurrentState:TRUE]; - + if(([[UIDevice currentDevice].systemVersion floatValue] < 8) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) { int width = endFrame.size.height; endFrame.size.height = endFrame.size.width; endFrame.size.width = width; } - + // Change inset { UIEdgeInsets inset = {0,0,0,0}; @@ -965,7 +965,7 @@ static UICompositeViewDescription *compositeDescription = nil; CGPoint gPos = [contentView convertPoint:pos toView:[UIApplication sharedApplication].keyWindow.rootViewController.view]; // Bypass IOS bug on landscape mode inset.bottom = -(rect.size.height - gPos.y - endFrame.size.height); if(inset.bottom < 0) inset.bottom = 0; - + [contentView setContentInset:inset]; [contentView setScrollIndicatorInsets:inset]; CGRect fieldFrame = activeTextField.frame; @@ -980,7 +980,7 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - XMLRPCConnectionDelegate Functions - (void)request:(XMLRPCRequest *)request didReceiveResponse:(XMLRPCResponse *)response { - [LinphoneLogger log:LinphoneLoggerLog format:@"XMLRPC %@: %@", [request method], [response body]]; + LOGI(@"XMLRPC %@: %@", [request method], [response body]); [waitView setHidden:true]; if ([response isFault]) { NSString *errorString = [NSString stringWithFormat:NSLocalizedString(@"Communication issue (%@)", nil), [response faultString]]; @@ -1059,11 +1059,11 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)request:(XMLRPCRequest *)request didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { - + } - (void)request:(XMLRPCRequest *)request didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { - + } #pragma mark - TPMultiLayoutViewController Functions