Skip to content
Snippets Groups Projects
Unverified Commit 30a7dd45 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

newaccountmodel: improve some signals emission

+ Fix SIP account creation
+ Update status when necessary

Note: SIP status signals are not perfect. See #393

Change-Id: Idde847af4bceaec55fd59145c9f68712b3e46edc
parent da09c939
No related branches found
No related tags found
No related merge requests found
...@@ -373,6 +373,12 @@ NewAccountModelPimpl::updateAccounts() ...@@ -373,6 +373,12 @@ NewAccountModelPimpl::updateAccounts()
if (accountInfo == accounts.end()) { if (accountInfo == accounts.end()) {
qDebug("detected new account %s", id.toStdString().c_str()); qDebug("detected new account %s", id.toStdString().c_str());
addToAccounts(id.toStdString()); addToAccounts(id.toStdString());
if (accountInfo->second.profileInfo.type == profile::Type::SIP) {
// NOTE: At this point, a SIP account is ready, but not a Ring
// account. Indeed, the keys are not generated at this point.
// See slotAccountStatusChanged for more details.
emit linked.accountAdded(id.toStdString());
}
} }
} }
} }
...@@ -389,10 +395,19 @@ NewAccountModelPimpl::slotAccountStatusChanged(const std::string& accountID, con ...@@ -389,10 +395,19 @@ NewAccountModelPimpl::slotAccountStatusChanged(const std::string& accountID, con
auto& accountInfo = it->second; auto& accountInfo = it->second;
if (status == api::account::Status::REGISTERED && accountInfo.profileInfo.uri.empty()) { if (accountInfo.profileInfo.type != profile::Type::SIP) {
if (status != api::account::Status::INITIALIZING
&& accountInfo.status == api::account::Status::INITIALIZING) {
// Detect when a new account is generated (keys are ready). During
// the generation, a Ring account got the "INITIALIZING" status.
// When keys are generated, the status will change.
accounts.erase(accountID); accounts.erase(accountID);
addToAccounts(accountID); addToAccounts(accountID);
emit linked.accountAdded(accountID); emit linked.accountAdded(accountID);
} else if (!accountInfo.profileInfo.uri.empty()) {
accountInfo.status = status;
emit linked.accountStatusChanged(accountID);
}
} else { } else {
accountInfo.status = status; accountInfo.status = status;
emit linked.accountStatusChanged(accountID); emit linked.accountStatusChanged(accountID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment