fix: creation SIP account
Change-Id: I90a5c57ebfa67011ab75843e0803956713f3058c
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
diff --git a/src/AddSIPAccountVC.mm b/src/AddSIPAccountVC.mm
index 44dc18f..f3d355e 100644
--- a/src/AddSIPAccountVC.mm
+++ b/src/AddSIPAccountVC.mm
@@ -71,7 +71,7 @@
- (IBAction)cancel:(id)sender
{
- [self.delegate close];
+ [self.delegate didCreateAccountWithSuccess: NO];
}
- (IBAction)addAccount:(id)sender
@@ -82,9 +82,6 @@
accountCreated = QObject::connect(self.accountModel,
&lrc::api::NewAccountModel::accountAdded,
[self] (const std::string& accountID) {
- if(accountID.compare(accountToCreate) != 0) {
- return;
- }
if([photoView image]) {
NSImage *avatarImage = [photoView image];
auto imageToBytes = QByteArray::fromNSData([avatarImage TIFFRepresentation]).toBase64();
@@ -98,14 +95,11 @@
if(![passwordField.stringValue isEqualToString:@""]) {
accountProperties.password = [passwordField.stringValue UTF8String];
}
- if(![userNameField.stringValue isEqualToString:@""]) {
- accountProperties.username = [userNameField.stringValue UTF8String];
- }
self.accountModel->setAccountConfig(accountID, accountProperties);
QObject::disconnect(accountCreated);
- [self.delegate close];
+ [self.delegate didCreateAccountWithSuccess: YES];
});
- accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [@"SIP" UTF8String]);
+ accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [displayName UTF8String], "", "", "", [userNameField.stringValue UTF8String]);
timeoutTimer = [NSTimer scheduledTimerWithTimeInterval:5
target:self
@@ -115,7 +109,7 @@
-(void) addingAccountTimeout {
QObject::disconnect(accountCreated);
- [self.delegate close];
+ [self.delegate didCreateAccountWithSuccess: YES];
}