Skip to content
Snippets Groups Projects
Commit c35d24e9 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Restore adding account - ticket #1172

parent 7d3c309f
Branches
Tags
No related merge requests found
......@@ -2159,7 +2159,7 @@ ManagerImpl::getAccountList()
// Otherelse, load the custom one
// ie according to the saved order
else {
for (i=0; i<account_order.size (); i++) {
// This account has not been loaded, so we ignore it
if ( (iter=_accountMap.find (account_order[i])) != _accountMap.end() )
......@@ -2171,6 +2171,8 @@ ManagerImpl::getAccountList()
}
}
}
}
return v;
......@@ -2269,11 +2271,17 @@ ManagerImpl::addAccount(const std::map< std::string, std::string >& details)
{
/** @todo Deal with both the _accountMap and the Configuration */
std::string accountType = (*details.find(CONFIG_ACCOUNT_TYPE)).second;
std::string accountType, account_list;
Account* newAccount;
std::stringstream accountID;
AccountID newAccountID;
accountID << "Account:" << time(NULL);
AccountID newAccountID = accountID.str();
newAccountID = accountID.str();
// Get the type
accountType = (*details.find(CONFIG_ACCOUNT_TYPE)).second;
/** @todo Verify the uniqueness, in case a program adds accounts, two in a row. */
if (accountType == "SIP") {
......@@ -2289,6 +2297,16 @@ ManagerImpl::addAccount(const std::map< std::string, std::string >& details)
_accountMap[newAccountID] = newAccount;
setAccountDetails(accountID.str(), details);
// Add the newly created account in the account order list
account_list = getConfigString (PREFERENCES, CONFIG_ACCOUNTS_ORDER);
if (account_list != "")
{
newAccountID += "/";
// Prepend the new account
account_list.insert (0, newAccountID);
setConfig (PREFERENCES, CONFIG_ACCOUNTS_ORDER, account_list);
}
saveConfig();
if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment