ThisAddIn.cs
branchsync
changeset 2686 f2e370d69120
parent 2667 1a7d192f0d56
child 2689 7cd444e4eaa0
equal deleted inserted replaced
2685:3f254ed0e797 2686:f2e370d69120
   421                         account = accounts[i];
   421                         account = accounts[i];
   422 
   422 
   423                         if (string.IsNullOrWhiteSpace(account.SmtpAddress) == false)
   423                         if (string.IsNullOrWhiteSpace(account.SmtpAddress) == false)
   424                         {
   424                         {
   425                             // Check if it is already in the list
   425                             // Check if it is already in the list
   426                             var accountSettings = this._Settings.GetAccountSettings(account.SmtpAddress);
   426                             if (this._Settings.GetAccountSettings(account.SmtpAddress) is PEPSettings.PEPAccountSettings accountSettings)
   427                             if (accountSettings == null)
       
   428                             {
       
   429                                 // Create pEp settings for the new account
       
   430                                 account.CreatePEPSettings();
       
   431                                 accountAdded = true;
       
   432                             }
       
   433                             else
       
   434                             {
   427                             {
   435                                 // Check for properties that might have not been set correctly due to errors
   428                                 // Check for properties that might have not been set correctly due to errors
   436                                 // UserName
   429                                 // UserName
   437                                 if (string.IsNullOrEmpty(accountSettings.UserName))
   430                                 if (string.IsNullOrEmpty(accountSettings.UserName))
   438                                 {
   431                                 {
   443                                     catch (Exception ex)
   436                                     catch (Exception ex)
   444                                     {
   437                                     {
   445                                         Log.Error("SyncAccountsList: Error adding user name. " + ex.ToString());
   438                                         Log.Error("SyncAccountsList: Error adding user name. " + ex.ToString());
   446                                     }
   439                                     }
   447                                 }
   440                                 }
       
   441                             }
       
   442                             else
       
   443                             {
       
   444                                 // Create pEp settings for the new account
       
   445                                 account.CreatePEPSettings();
       
   446                                 accountAdded = true;
   448                             }
   447                             }
   449                         }
   448                         }
   450                         else
   449                         else
   451                         {
   450                         {
   452                             Log.Warning("SyncAccountsList: Invalid Smtp address detected, skipping account.");
   451                             Log.Warning("SyncAccountsList: Invalid Smtp address detected, skipping account.");