/// <summary> /// Loads the ConnectionConfiguration of the given XMPPAccount from the db. /// </summary> /// <param name="account">The XMPPAccount you want to load the ConnectionConfiguration for.</param> public void loadAccountConnectionConfiguration(XMPPAccount account) { // Load general options: ConnectionOptionsTable optionsTable = getConnectionOptionsTable(account.getBareJid()); if (optionsTable != null) { optionsTable.toConnectionConfiguration(account.connectionConfiguration); } // Load ignored certificate errors: IList <IgnoredCertificateErrorTable> ignoredCertificates = getIgnoredCertificateErrorTables(account.getBareJid()); if (ignoredCertificates != null) { foreach (IgnoredCertificateErrorTable i in ignoredCertificates) { account.connectionConfiguration.IGNORED_CERTIFICATE_ERRORS.Add(i.certificateError); } } }
/// <summary> /// Saves the ConnectionConfiguration for the given XMPPAccount in the DB. /// </summary> /// <param name="account">The XMPPAccount containing the ConnectionConfiguration you want to save to the db.</param> public void saveAccountConnectionConfiguration(XMPPAccount account) { // Save general options: ConnectionOptionsTable optionsTable = new ConnectionOptionsTable(account.connectionConfiguration) { accountId = account.getBareJid() }; dB.InsertOrReplace(optionsTable); // Save ignored certificate errors: dB.Execute("DELETE FROM " + DBTableConsts.IGNORED_CERTIFICATE_ERROR_TABLE + " WHERE accountId = ?;", account.getBareJid()); foreach (ChainValidationResult i in account.connectionConfiguration.IGNORED_CERTIFICATE_ERRORS) { dB.InsertOrReplace(new IgnoredCertificateErrorTable() { accountId = account.getBareJid(), certificateError = i, id = IgnoredCertificateErrorTable.generateId(account.getBareJid(), i) }); } }