Commit 31e7b950 authored by Emmanuel Milou's avatar Emmanuel Milou

Merge branch 'master' into log4c

parents f66b2982 6f1dc0a2
......@@ -279,7 +279,7 @@ gchar * account_list_get_ordered_list (void) {
for( i=0; i<account_list_get_size(); i++ )
{
order = g_strconcat (account_list_get_nth (i)->accountID, "/", NULL);
order = g_strconcat (order, account_list_get_nth (i)->accountID, "/", NULL);
}
return order;
}
......@@ -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();
......
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