Commit c2cf086b authored by Ming Rui Zhang's avatar Ming Rui Zhang

newaccountmodel: make account files to be cleared for account deletion

1. Close db when removing an account
2. Clear SIP account folder

Change-Id: I1b8b26b5841528eb5a7315faed023051193277c3
parent c849dce0
......@@ -320,6 +320,13 @@ NewAccountModel::exportOnRing(const QString& accountId, const QString& password)
void
NewAccountModel::removeAccount(const QString& accountId) const
{
auto account = pimpl_->accounts.find(accountId);
if (account == pimpl_->accounts.end()) {
return;
}
// Close db here for its removal
account->second.second->close();
ConfigurationManager::instance().removeAccount(accountId);
}
......@@ -764,6 +771,11 @@ NewAccountModelPimpl::removeFromAccounts(const QString& accountId)
return;
}
auto& accountInfo = account->second.first;
if (accountInfo.profileInfo.type == profile::Type::SIP) {
auto accountDir = QDir(authority::storage::getPath() + accountId);
accountDir.removeRecursively();
}
/* Inform client about account removal. Do *not* free account structures
before we are sure that the client stopped using it, otherwise we might
get into use-after-free troubles. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment