diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 6ec1bfe74..ba467f7fe 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -122,8 +122,22 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); linphone_address_destroy(parsed); } { - [self setInteger: linphone_core_get_audio_port(lc) forKey:@"audio_port_preference"]; - [self setInteger: linphone_core_get_video_port(lc) forKey:@"video_port_preference"]; + { + int minPort, maxPort; + linphone_core_get_audio_port_range(lc, &minPort, &maxPort); + if(minPort != maxPort) + [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"audio_port_preference"]; + else + [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"audio_port_preference"]; + } + { + int minPort, maxPort; + linphone_core_get_video_port_range(lc, &minPort, &maxPort); + if(minPort != maxPort) + [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"video_port_preference"]; + else + [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"video_port_preference"]; + } } { [self setInteger: linphone_core_get_upload_bandwidth(lc) forKey:@"upload_bandwidth_preference"]; @@ -396,6 +410,47 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [[[LinphoneManager instance] fastAddressBook] reload]; } ++ (int)validPort:(int)port { + if(port < 0) { + return 0; + } + if(port > 65535) { + return 65535; + } + return port; +} + ++ (BOOL)parsePortRange:(NSString*)text minPort:(int*)minPort maxPort:(int*)maxPort { + NSError* error = nil; + *minPort = -1; + *maxPort = -1; + NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"([0-9]+)(([^0-9]+)([0-9]+))?" options:0 error:&error]; + if(error != NULL) + return FALSE; + NSArray* matches = [regex matchesInString:text options:0 range:NSMakeRange(0, [text length])]; + if([matches count] == 1) { + NSTextCheckingResult *match = [matches objectAtIndex:0]; + NSLog(@"%d", [match numberOfRanges]); + bool range = [match rangeAtIndex:2].length > 0; + if(!range) { + NSRange rangeMinPort = [match rangeAtIndex:1]; + *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; + *maxPort = *minPort; + return TRUE; + } else { + NSRange rangeMinPort = [match rangeAtIndex:1]; + *minPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMinPort] integerValue]]; + NSRange rangeMaxPort = [match rangeAtIndex:4]; + *maxPort = [LinphoneCoreSettingsStore validPort:[[text substringWithRange:rangeMaxPort] integerValue]]; + if(*minPort > *maxPort) { + *minPort = *maxPort; + } + return TRUE; + } + } + return FALSE; +} + - (BOOL)synchronize { if (![LinphoneManager isLcReady]) return YES; LinphoneCore *lc=[LinphoneManager getLc]; @@ -485,10 +540,18 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); // Audio & Video Port - int audio_port_preference = [self integerForKey:@"audio_port_preference"]; - linphone_core_set_audio_port(lc, audio_port_preference); - int video_port_preference = [self integerForKey:@"video_port_preference"]; - linphone_core_set_video_port(lc, video_port_preference); + { + NSString *audio_port_preference = [self stringForKey:@"audio_port_preference"]; + int minPort, maxPort; + [LinphoneCoreSettingsStore parsePortRange:audio_port_preference minPort:&minPort maxPort:&maxPort]; + linphone_core_set_audio_port_range(lc, minPort, maxPort); + } + { + NSString *video_port_preference = [self stringForKey:@"video_port_preference"]; + int minPort, maxPort; + [LinphoneCoreSettingsStore parsePortRange:video_port_preference minPort:&minPort maxPort:&maxPort]; + linphone_core_set_video_port_range(lc, minPort, maxPort); + } int upload_bandwidth = [self integerForKey:@"upload_bandwidth_preference"]; linphone_core_set_upload_bandwidth(lc, upload_bandwidth); diff --git a/Classes/LinphoneUI/fr.lproj/UICallBar.xib b/Classes/LinphoneUI/fr.lproj/UICallBar.xib index 04797317e..166865260 100644 --- a/Classes/LinphoneUI/fr.lproj/UICallBar.xib +++ b/Classes/LinphoneUI/fr.lproj/UICallBar.xib @@ -540,7 +540,7 @@ 293 - + 292 {{-44, -8}, {44, 90}} @@ -550,12 +550,12 @@ 100 NO IBCocoaTouchFramework - + NSImage callbar_left_padding.png - + 292 {{320, -8}, {44, 90}} @@ -565,7 +565,7 @@ 101 NO IBCocoaTouchFramework - + NSImage callbar_right_padding.png @@ -879,7 +879,7 @@ 264 {{215, 67}, {105, 68}} - + _NS:9 NO 27 @@ -914,7 +914,7 @@ {{0, 325}, {320, 135}} - + _NS:9 18 @@ -1292,7 +1292,7 @@ 293 - + 292 {{-44, -8}, {44, 90}} @@ -1302,9 +1302,9 @@ 100 NO IBCocoaTouchFramework - + - + 292 {{480, -8}, {44, 90}} @@ -1314,7 +1314,7 @@ 101 NO IBCocoaTouchFramework - + @@ -1622,7 +1622,7 @@ 264 {{415, 0}, {65, 82}} - + _NS:9 NO 27 @@ -1654,7 +1654,7 @@ {{0, 238}, {480, 82}} - + _NS:9 18 @@ -2085,8 +2085,8 @@ - - + + buttons @@ -2413,8 +2413,8 @@ - - + + buttons @@ -2493,25 +2493,25 @@ 143 - + leftPadding 144 - + rightPadding 145 - + rightPadding 146 - + leftPadding diff --git a/Settings/InAppSettings.bundle/Network.plist b/Settings/InAppSettings.bundle/Network.plist index 410c308e7..864b5acc3 100644 --- a/Settings/InAppSettings.bundle/Network.plist +++ b/Settings/InAppSettings.bundle/Network.plist @@ -68,11 +68,11 @@ Key audio_port_preference Title - Audio Port + Audio Port(s) Type PSTextFieldSpecifier KeyboardType - NumberPad + NumbersAndPunctuation DefaultValue 7076 IASKTextAlignment @@ -82,11 +82,11 @@ Key video_port_preference Title - Video Port + Video Port(s) Type PSTextFieldSpecifier KeyboardType - NumberPad + NumbersAndPunctuation DefaultValue 9078 IASKTextAlignment diff --git a/Settings/InAppSettings.bundle/en.lproj/Network.strings b/Settings/InAppSettings.bundle/en.lproj/Network.strings index 0af66238b..a2aa822d3 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Network.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Network.strings @@ -13,11 +13,11 @@ /* Port */ "Port" = "Port"; -/* Audio Port */ -"Audio Port" = "Audio Port"; +/* Audio Port(s) */ +"Audio Port(s)" = "Audio Port(s)"; -/* Video Port */ -"Video Port" = "Video Port"; +/* Video Port(s) */ +"Video Port(s)" = "Video Port(s)"; /* Transport */ "Transport" = "Transport"; diff --git a/Settings/InAppSettings.bundle/fr.lproj/Network.strings b/Settings/InAppSettings.bundle/fr.lproj/Network.strings index 8235ab319..105b01f75 100644 --- a/Settings/InAppSettings.bundle/fr.lproj/Network.strings +++ b/Settings/InAppSettings.bundle/fr.lproj/Network.strings @@ -13,11 +13,11 @@ /* Port */ "Port" = "Port"; -/* Audio Port */ -"Audio Port" = "Port Audio"; +/* Audio Port(s) */ +"Audio Port(s)" = "Port(s) Audio"; -/* Video Port */ -"Video Port" = "Port Vidéo"; +/* Video Port(s) */ +"Video Port(s)" = "Port(s) Vidéo"; /* Transport */ "Transport" = "Transport"; diff --git a/linphone.ldb/Contents.plist b/linphone.ldb/Contents.plist index f3a73709f..72d19e91f 100644 --- a/linphone.ldb/Contents.plist +++ b/linphone.ldb/Contents.plist @@ -7504,17 +7504,17 @@ backup - 11 + 12 class BLWrapperHandle name - LinphoneUI/UICallBar/11/UICallBar.xib + LinphoneUI/UICallBar/12/UICallBar.xib change date - 2012-11-09T09:15:46Z + 2012-11-13T08:39:33Z changed values class @@ -7524,7 +7524,7 @@ flags 0 hash - 18fba1eaf5f411c2e245f79b882aa7b1 + 6ce20b228103dd1de3d5c07ecc8cc68a name UICallBar.xib @@ -8626,9 +8626,9 @@ versions en - 11 + 12 fr - 11 + 12 @@ -17452,7 +17452,7 @@ Raison: %2$s change date - 2012-11-06T09:36:36Z + 2012-11-13T09:28:24Z changed values class @@ -17462,7 +17462,7 @@ Raison: %2$s flags 0 hash - bb988b6e05b6fdd4c767f75b9d73b087 + 7220a3af4b5567ce1842c8a01759b1c9 name Network.strings @@ -17601,19 +17601,19 @@ Raison: %2$s class BLStringKeyObject comment - Audio Port + Audio Port(s) errors flags 0 key - Audio Port + Audio Port(s) localizations en - Audio Port + Audio Port(s) fr - Port Audio + Port(s) Audio snapshots @@ -17626,19 +17626,19 @@ Raison: %2$s class BLStringKeyObject comment - Video Port + Video Port(s) errors flags 0 key - Video Port + Video Port(s) localizations en - Video Port + Video Port(s) fr - Port Vidéo + Port(s) Vidéo snapshots @@ -18030,6 +18030,56 @@ Raison: %2$s snapshots + + change date + 2001-01-01T00:00:00Z + changed values + + class + BLStringKeyObject + comment + Audio Port + errors + + flags + 0 + key + Audio Port + localizations + + en + Audio Port + fr + Port Audio + + snapshots + + + + change date + 2001-01-01T00:00:00Z + changed values + + class + BLStringKeyObject + comment + Video Port + errors + + flags + 0 + key + Video Port + localizations + + en + Video Port + fr + Port Vidéo + + snapshots + + plist file diff --git a/linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings b/linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings index 0af66238b..a2aa822d3 100644 --- a/linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings +++ b/linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings @@ -13,11 +13,11 @@ /* Port */ "Port" = "Port"; -/* Audio Port */ -"Audio Port" = "Audio Port"; +/* Audio Port(s) */ +"Audio Port(s)" = "Audio Port(s)"; -/* Video Port */ -"Video Port" = "Video Port"; +/* Video Port(s) */ +"Video Port(s)" = "Video Port(s)"; /* Transport */ "Transport" = "Transport"; diff --git a/linphone.ldb/Resources/LinphoneUI/UICallBar/11/UICallBar.xib b/linphone.ldb/Resources/LinphoneUI/UICallBar/12/UICallBar.xib similarity index 99% rename from linphone.ldb/Resources/LinphoneUI/UICallBar/11/UICallBar.xib rename to linphone.ldb/Resources/LinphoneUI/UICallBar/12/UICallBar.xib index 343b085af..3398db0d7 100644 --- a/linphone.ldb/Resources/LinphoneUI/UICallBar/11/UICallBar.xib +++ b/linphone.ldb/Resources/LinphoneUI/UICallBar/12/UICallBar.xib @@ -558,7 +558,7 @@ 293 - + 292 {{-44, -8}, {44, 90}} @@ -569,12 +569,12 @@ 100 NO IBCocoaTouchFramework - + NSImage callbar_left_padding.png - + 292 {{320, -8}, {44, 90}} @@ -585,7 +585,7 @@ 101 NO IBCocoaTouchFramework - + NSImage callbar_right_padding.png @@ -909,7 +909,7 @@ {{215, 67}, {105, 68}} - + _NS:9 NO 27 @@ -945,7 +945,7 @@ {{0, 325}, {320, 135}} - + _NS:9 18 @@ -1343,7 +1343,7 @@ 293 - + 292 {{-44, -8}, {44, 90}} @@ -1354,9 +1354,9 @@ 100 NO IBCocoaTouchFramework - + - + 292 {{480, -8}, {44, 90}} @@ -1367,7 +1367,7 @@ 101 NO IBCocoaTouchFramework - + @@ -1685,7 +1685,7 @@ {{415, 0}, {65, 82}} - + _NS:9 NO 27 @@ -1718,7 +1718,7 @@ {{0, 238}, {480, 82}} - + _NS:9 18 @@ -2151,8 +2151,8 @@ - - + + buttons @@ -2479,8 +2479,8 @@ - - + + buttons @@ -2559,25 +2559,25 @@ 143 - + leftPadding 144 - + rightPadding 145 - + rightPadding 146 - + leftPadding