Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 1 | /* |
Sébastien Blin | 029ffa8 | 2019-01-02 17:43:48 -0500 | [diff] [blame] | 2 | * Copyright (C) 2015-2019 Savoir-faire Linux Inc. |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 3 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 4 | * Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | #define OUTGOING_TLS_SERVER_TAG 0 |
| 21 | #define NEGOTIATION_TIMOUT_TAG 1 |
| 22 | #define REGISTRATION_TAG 2 |
| 23 | #define LOCALPORT_TAG 3 |
| 24 | #define CUSTOM_PORT_TAG 4 |
| 25 | #define CUSTOM_ADDRESS_TAG 5 |
| 26 | #define MINAUDIO_TAG 6 |
| 27 | #define MAXAUDIO_TAG 7 |
| 28 | #define MINVIDEO_TAG 8 |
| 29 | #define MAXVIDEO_TAG 9 |
| 30 | |
| 31 | #import "AccAdvancedSipVC.h" |
| 32 | |
| 33 | //LRC |
| 34 | #import <api/lrc.h> |
| 35 | #import <api/newaccountmodel.h> |
| 36 | |
| 37 | @interface AccAdvancedSipVC () { |
| 38 | __unsafe_unretained IBOutlet NSButton *encryptMediaButton; |
| 39 | __unsafe_unretained IBOutlet NSButton *enableSDESButton; |
| 40 | __unsafe_unretained IBOutlet NSButton *fallbackEncryptionFailureButton; |
| 41 | __unsafe_unretained IBOutlet NSButton *encryptNegotiationButton; |
| 42 | __unsafe_unretained IBOutlet NSButton *checkIncomingCertificatesButton; |
| 43 | __unsafe_unretained IBOutlet NSButton *checkAnswerCertificatesButton; |
| 44 | __unsafe_unretained IBOutlet NSButton *requereIncomingCertificateButton; |
| 45 | __unsafe_unretained IBOutlet NSPopUpButton *tlsProtocolsList; |
| 46 | __unsafe_unretained IBOutlet NSTextField *outgoingTlsServerNameField; |
| 47 | __unsafe_unretained IBOutlet NSStepper *negotiationTimeoutStepper; |
| 48 | __unsafe_unretained IBOutlet NSTextField *negotiationTimeoutField; |
| 49 | __unsafe_unretained IBOutlet NSStepper *registrationTimeoutStepper; |
| 50 | __unsafe_unretained IBOutlet NSTextField *registrationTimeoutField; |
| 51 | __unsafe_unretained IBOutlet NSStepper *networkStepper; |
| 52 | __unsafe_unretained IBOutlet NSTextField *networkField; |
| 53 | __unsafe_unretained IBOutlet NSTextField *customAddressField; |
| 54 | __unsafe_unretained IBOutlet NSButton *useCustomAddressButton; |
| 55 | __unsafe_unretained IBOutlet NSStepper *customPortStepper; |
| 56 | __unsafe_unretained IBOutlet NSTextField *customPortField; |
| 57 | __unsafe_unretained IBOutlet NSStepper *minAudioPortStepper; |
| 58 | __unsafe_unretained IBOutlet NSStepper *maxAudioPortStepper; |
| 59 | __unsafe_unretained IBOutlet NSStepper *minVideoPortStepper; |
| 60 | __unsafe_unretained IBOutlet NSStepper *maxVideoPortStepper; |
| 61 | __unsafe_unretained IBOutlet NSTextField *minAudioRTPRange; |
| 62 | __unsafe_unretained IBOutlet NSTextField *maxAudioRTPRange; |
| 63 | __unsafe_unretained IBOutlet NSTextField *minVideoRTPRange; |
| 64 | __unsafe_unretained IBOutlet NSTextField *maxVideoRTPRange; |
| 65 | } |
| 66 | |
| 67 | @end |
| 68 | |
| 69 | @implementation AccAdvancedSipVC |
| 70 | |
| 71 | NSString *TLS_PROTOCOL_DEFAULT = @"Default"; |
| 72 | NSString *TLS_PROTOCOL_TLSv1 = @"TLSv1"; |
| 73 | NSString *TLS_PROTOCOL_TLSv1_1 = @"TLSv1_1"; |
| 74 | NSString *TLS_PROTOCOL_TLSv1_2 = @"TLSv1_2"; |
| 75 | |
| 76 | @synthesize privateKeyPaswordField; |
| 77 | @synthesize selectCACertificateButton, selectUserCertificateButton, selectPrivateKeyButton; |
| 78 | |
| 79 | - (void)awakeFromNib |
| 80 | { |
| 81 | [super awakeFromNib]; |
| 82 | [negotiationTimeoutStepper setTag:NEGOTIATION_TIMOUT_TAG]; |
| 83 | [negotiationTimeoutField setTag:NEGOTIATION_TIMOUT_TAG]; |
| 84 | [registrationTimeoutStepper setTag:REGISTRATION_TAG]; |
| 85 | [registrationTimeoutField setTag:REGISTRATION_TAG]; |
| 86 | [networkStepper setTag:LOCALPORT_TAG]; |
| 87 | [networkField setTag:LOCALPORT_TAG]; |
| 88 | [customAddressField setTag: CUSTOM_ADDRESS_TAG]; |
| 89 | [outgoingTlsServerNameField setTag: OUTGOING_TLS_SERVER_TAG]; |
| 90 | [customPortStepper setTag: CUSTOM_PORT_TAG]; |
| 91 | [customPortField setTag: CUSTOM_PORT_TAG]; |
| 92 | [minAudioPortStepper setTag:MINAUDIO_TAG]; |
| 93 | [maxAudioPortStepper setTag:MAXAUDIO_TAG]; |
| 94 | [minVideoPortStepper setTag:MINVIDEO_TAG]; |
| 95 | [maxVideoPortStepper setTag:MAXVIDEO_TAG]; |
| 96 | [minAudioRTPRange setTag:MINAUDIO_TAG]; |
| 97 | [maxAudioRTPRange setTag:MAXAUDIO_TAG]; |
| 98 | [minVideoRTPRange setTag:MINVIDEO_TAG]; |
| 99 | [maxVideoRTPRange setTag:MAXVIDEO_TAG]; |
Kateryna Kostiuk | 3164fb0 | 2018-08-28 17:51:43 -0400 | [diff] [blame] | 100 | [[self view] setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewHeightSizable]; |
| 101 | |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | -(void)viewDidLoad { |
| 105 | [super viewDidLoad]; |
| 106 | NSMenu *tlsMethods = [[NSMenu alloc] initWithTitle:@""]; |
| 107 | [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_DEFAULT action:nil keyEquivalent:@""]]; |
| 108 | [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1 action:nil keyEquivalent:@""]]; |
| 109 | [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1_1 action:nil keyEquivalent:@""]]; |
| 110 | [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1_2 action:nil keyEquivalent:@""]]; |
| 111 | tlsProtocolsList.menu = tlsMethods; |
| 112 | [self updateView]; |
| 113 | } |
| 114 | |
Kateryna Kostiuk | c867eb9 | 2020-03-08 13:15:17 -0400 | [diff] [blame] | 115 | - (void) setSelectedAccount:(const QString&) account { |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 116 | [super setSelectedAccount: account]; |
| 117 | [self updateView]; |
| 118 | } |
| 119 | |
| 120 | - (void) updateView { |
| 121 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 122 | [encryptMediaButton setState: accountProperties.SRTP.enable]; |
| 123 | [enableSDESButton setState: accountProperties.SRTP.keyExchange == lrc::api::account::KeyExchangeProtocol::SDES ? NSControlStateValueOn : NSControlStateValueOff]; |
| 124 | [fallbackEncryptionFailureButton setState: accountProperties.SRTP.rtpFallback]; |
| 125 | [encryptNegotiationButton setState: accountProperties.TLS.enable]; |
| 126 | [selectCACertificateButton setEnabled: accountProperties.TLS.enable]; |
| 127 | [selectUserCertificateButton setEnabled: accountProperties.TLS.enable]; |
| 128 | [selectPrivateKeyButton setEnabled: accountProperties.TLS.enable]; |
| 129 | [privateKeyPaswordField setEnabled: accountProperties.TLS.enable]; |
| 130 | [checkIncomingCertificatesButton setState: accountProperties.TLS.verifyServer]; |
| 131 | [checkAnswerCertificatesButton setState: accountProperties.TLS.verifyClient]; |
| 132 | [requereIncomingCertificateButton setState: accountProperties.TLS.requireClientCertificate]; |
| 133 | switch (accountProperties.TLS.method) { |
| 134 | case lrc::api::account::TlsMethod::DEFAULT: |
| 135 | [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_DEFAULT]; |
| 136 | break; |
| 137 | case lrc::api::account::TlsMethod::TLSv1: |
| 138 | [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1]; |
| 139 | break; |
| 140 | case lrc::api::account::TlsMethod::TLSv1_1: |
| 141 | [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1_1]; |
| 142 | break; |
| 143 | case lrc::api::account::TlsMethod::TLSv1_2: |
| 144 | [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1_2]; |
| 145 | break; |
| 146 | |
| 147 | default: |
| 148 | break; |
| 149 | } |
| 150 | [negotiationTimeoutStepper setIntegerValue: accountProperties.TLS.negotiationTimeoutSec]; |
| 151 | [negotiationTimeoutField setIntegerValue: accountProperties.TLS.negotiationTimeoutSec]; |
| 152 | [registrationTimeoutStepper setIntegerValue: accountProperties.Registration.expire]; |
| 153 | [registrationTimeoutField setIntegerValue: accountProperties.Registration.expire]; |
| 154 | [networkStepper setIntegerValue: accountProperties.localPort]; |
| 155 | [networkField setIntegerValue: accountProperties.localPort]; |
| 156 | [customAddressField setEnabled:!accountProperties.publishedSameAsLocal]; |
| 157 | [customPortField setEnabled:!accountProperties.publishedSameAsLocal]; |
| 158 | [customPortStepper setEnabled:!accountProperties.publishedSameAsLocal]; |
| 159 | [useCustomAddressButton setState:!accountProperties.publishedSameAsLocal]; |
| 160 | [customPortStepper setIntegerValue: accountProperties.publishedPort]; |
| 161 | [customPortField setIntegerValue: accountProperties.publishedPort]; |
Kateryna Kostiuk | c867eb9 | 2020-03-08 13:15:17 -0400 | [diff] [blame] | 162 | [customAddressField setStringValue: accountProperties.publishedAddress.toNSString()]; |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 163 | [minAudioPortStepper setIntegerValue: accountProperties.Audio.audioPortMin]; |
| 164 | [minAudioRTPRange setIntegerValue: accountProperties.Audio.audioPortMin]; |
| 165 | [maxAudioPortStepper setIntegerValue: accountProperties.Audio.audioPortMax]; |
| 166 | [maxAudioRTPRange setIntegerValue: accountProperties.Audio.audioPortMax]; |
| 167 | [minVideoPortStepper setIntegerValue: accountProperties.Video.videoPortMin]; |
| 168 | [minVideoRTPRange setIntegerValue: accountProperties.Video.videoPortMin]; |
Kateryna Kostiuk | 512db88 | 2018-11-28 09:36:53 -0500 | [diff] [blame] | 169 | [maxVideoPortStepper setIntegerValue: accountProperties.Video.videoPortMax]; |
| 170 | [maxVideoRTPRange setIntegerValue: accountProperties.Video.videoPortMax]; |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | #pragma mark - Actions |
| 174 | |
| 175 | - (IBAction)toggleEnableSDES:(id)sender { |
| 176 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 177 | lrc::api::account::KeyExchangeProtocol newState = [sender state] == NSControlStateValueOn ? lrc::api::account::KeyExchangeProtocol::SDES : lrc::api::account::KeyExchangeProtocol::NONE; |
| 178 | if(accountProperties.SRTP.keyExchange != newState) { |
| 179 | accountProperties.SRTP.keyExchange = newState; |
| 180 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 181 | } |
| 182 | } |
| 183 | - (IBAction)toggleEncryptMedia:(id)sender { |
| 184 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 185 | if(accountProperties.SRTP.enable!= [sender state]) { |
| 186 | accountProperties.SRTP.enable = [sender state]; |
| 187 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 188 | } |
| 189 | } |
| 190 | - (IBAction)toggleFallbackEncryptionFailure:(id)sender { |
| 191 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 192 | if(accountProperties.SRTP.rtpFallback != [sender state]) { |
| 193 | accountProperties.SRTP.rtpFallback = [sender state]; |
| 194 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 195 | } |
| 196 | } |
| 197 | - (IBAction)toggleEncryptNegotiation:(id)sender { |
| 198 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 199 | if(accountProperties.TLS.enable != [sender state]) { |
| 200 | accountProperties.TLS.enable = [sender state]; |
| 201 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 202 | [selectCACertificateButton setEnabled: [sender state]]; |
| 203 | [selectUserCertificateButton setEnabled: [sender state]]; |
| 204 | [selectPrivateKeyButton setEnabled: [sender state]]; |
| 205 | [privateKeyPaswordField setEnabled: [sender state]]; |
| 206 | } |
| 207 | } |
| 208 | - (IBAction)toggleVerifyServerCertificate:(id)sender { |
| 209 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 210 | if(accountProperties.TLS.verifyServer != [sender state]) { |
| 211 | accountProperties.TLS.verifyServer = [sender state]; |
| 212 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 213 | } |
| 214 | } |
| 215 | - (IBAction)toggleVerifyClientCertificate:(id)sender { |
| 216 | lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 217 | if(accountProperties.TLS.verifyClient != [sender state]) { |
| 218 | accountProperties.TLS.verifyClient = [sender state]; |
| 219 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 220 | } |
| 221 | } |
| 222 | - (IBAction)toggleCertForIncomingConnection:(id)sender { |
| 223 | lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 224 | if(accountProperties.TLS.requireClientCertificate != [sender state]) { |
| 225 | accountProperties.TLS.requireClientCertificate = [sender state]; |
| 226 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | - (IBAction)enableCustomAddress:(id)sender { |
| 231 | lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 232 | if(accountProperties.publishedSameAsLocal != ![sender state]) { |
| 233 | accountProperties.publishedSameAsLocal = ![sender state]; |
| 234 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 235 | [customAddressField setEnabled:[sender state]]; |
| 236 | [customPortField setEnabled:[sender state]]; |
| 237 | [customPortStepper setEnabled:[sender state]]; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | - (IBAction)chooseTlsProtocol:(id)sender { |
| 242 | int index = [sender indexOfSelectedItem]; |
| 243 | if(index < 0) { |
| 244 | return; |
| 245 | } |
| 246 | NSString *title = [[tlsProtocolsList.menu itemAtIndex:index] title]; |
| 247 | lrc::api::account::TlsMethod method; |
| 248 | |
| 249 | if(title == TLS_PROTOCOL_DEFAULT) { |
| 250 | method = lrc::api::account::TlsMethod::DEFAULT; |
| 251 | } else if(title == TLS_PROTOCOL_TLSv1) { |
| 252 | method = lrc::api::account::TlsMethod::TLSv1; |
| 253 | } else if(title == TLS_PROTOCOL_TLSv1_1) { |
| 254 | method = lrc::api::account::TlsMethod::TLSv1_1; |
| 255 | } else if(title == TLS_PROTOCOL_TLSv1_2) { |
| 256 | method = lrc::api::account::TlsMethod::TLSv1_2; |
| 257 | } else { |
| 258 | return; |
| 259 | } |
| 260 | auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 261 | if(accountProperties.TLS.method != method) { |
| 262 | accountProperties.TLS.method = method; |
| 263 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | - (IBAction) valueDidChange: (id) sender |
| 268 | { |
| 269 | lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID); |
| 270 | |
| 271 | switch ([sender tag]) { |
| 272 | case OUTGOING_TLS_SERVER_TAG: |
Kateryna Kostiuk | c867eb9 | 2020-03-08 13:15:17 -0400 | [diff] [blame] | 273 | if(accountProperties.TLS.serverName != QString::fromNSString([sender stringValue])) { |
| 274 | accountProperties.TLS.serverName = QString::fromNSString([sender stringValue]); |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 275 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 276 | } |
| 277 | return; |
| 278 | case NEGOTIATION_TIMOUT_TAG: |
| 279 | if(accountProperties.TLS.negotiationTimeoutSec != [[sender stringValue] integerValue]) { |
| 280 | accountProperties.TLS.negotiationTimeoutSec = [[sender stringValue] integerValue]; |
| 281 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 282 | [negotiationTimeoutStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 283 | [negotiationTimeoutField setIntegerValue: [[sender stringValue] integerValue]]; |
| 284 | } |
| 285 | return; |
| 286 | case REGISTRATION_TAG: |
| 287 | if(accountProperties.Registration.expire != [[sender stringValue] integerValue]) { |
| 288 | accountProperties.Registration.expire = [[sender stringValue] integerValue]; |
| 289 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 290 | [registrationTimeoutStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 291 | [registrationTimeoutField setIntegerValue: [[sender stringValue] integerValue]]; |
| 292 | } |
| 293 | return; |
| 294 | case LOCALPORT_TAG: |
| 295 | if(accountProperties.localPort != [[sender stringValue] integerValue]) { |
| 296 | accountProperties.localPort = [[sender stringValue] integerValue]; |
| 297 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 298 | [networkStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 299 | [networkField setIntegerValue: [[sender stringValue] integerValue]]; |
| 300 | } |
| 301 | return; |
| 302 | case CUSTOM_ADDRESS_TAG: |
Kateryna Kostiuk | c867eb9 | 2020-03-08 13:15:17 -0400 | [diff] [blame] | 303 | if(accountProperties.publishedAddress != QString::fromNSString([sender stringValue])) { |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 304 | NSString *name = [sender stringValue]; |
Kateryna Kostiuk | c867eb9 | 2020-03-08 13:15:17 -0400 | [diff] [blame] | 305 | accountProperties.publishedAddress = QString::fromNSString([sender stringValue]); |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 306 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 307 | } |
| 308 | return; |
| 309 | case CUSTOM_PORT_TAG: |
| 310 | if(accountProperties.publishedPort != [[sender stringValue] integerValue]) { |
| 311 | accountProperties.publishedPort = [[sender stringValue] integerValue]; |
| 312 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 313 | [customPortStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 314 | [customPortField setIntegerValue: [[sender stringValue] integerValue]]; |
| 315 | } |
| 316 | return; |
| 317 | case MINAUDIO_TAG: |
| 318 | if(accountProperties.Audio.audioPortMin != [[sender stringValue] integerValue]) { |
| 319 | accountProperties.Audio.audioPortMin = [[sender stringValue] integerValue]; |
| 320 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 321 | [minAudioPortStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 322 | [minAudioRTPRange setIntegerValue: [[sender stringValue] integerValue]]; |
| 323 | } |
| 324 | return; |
| 325 | case MAXAUDIO_TAG: |
| 326 | if(accountProperties.Audio.audioPortMax != [[sender stringValue] integerValue]) { |
| 327 | accountProperties.Audio.audioPortMax = [[sender stringValue] integerValue]; |
| 328 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 329 | [maxAudioPortStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 330 | [maxAudioRTPRange setIntegerValue: [[sender stringValue] integerValue]]; |
| 331 | } |
| 332 | return; |
| 333 | case MINVIDEO_TAG: |
| 334 | if(accountProperties.Video.videoPortMin != [[sender stringValue] integerValue]) { |
| 335 | accountProperties.Video.videoPortMin = [[sender stringValue] integerValue]; |
| 336 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 337 | [minVideoPortStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 338 | [minVideoRTPRange setIntegerValue: [[sender stringValue] integerValue]]; |
| 339 | } |
| 340 | return; |
| 341 | case MAXVIDEO_TAG: |
| 342 | if(accountProperties.Video.videoPortMax != [[sender stringValue] integerValue]) { |
| 343 | accountProperties.Video.videoPortMax = [[sender stringValue] integerValue]; |
| 344 | self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties); |
| 345 | [maxVideoPortStepper setIntegerValue: [[sender stringValue] integerValue]]; |
| 346 | [maxVideoRTPRange setIntegerValue: [[sender stringValue] integerValue]]; |
| 347 | } |
| 348 | return; |
| 349 | default: |
| 350 | break; |
| 351 | } |
| 352 | [super valueDidChange:sender]; |
| 353 | } |
| 354 | |
| 355 | #pragma mark - NSTextFieldDelegate methods |
| 356 | |
Kateryna Kostiuk | 034eab3 | 2020-11-17 14:59:41 -0500 | [diff] [blame] | 357 | -(void)controlTextDidEndEditing:(NSNotification *)notif |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 358 | { |
| 359 | NSTextField *textField = [notif object]; |
Kateryna Kostiuk | 1f8c125 | 2018-07-30 18:18:57 -0400 | [diff] [blame] | 360 | [self valueDidChange:textField]; |
| 361 | } |
| 362 | |
| 363 | @end |