Skip to content
Snippets Groups Projects
Commit c10827e1 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

while -> for (make the code smaller)

parent 34e0564a
Branches
Tags
No related merge requests found
......@@ -91,14 +91,10 @@ void Account::setActiveCodecs (const std::vector <std::string> &list)
// list contains the ordered payload of active codecs picked by the user for this account
// we used the CodecOrder vector to save the order.
int i=0;
int payload;
size_t size = list.size();
while ( (unsigned int) i < size) {
payload = std::atoi (list[i].data());
size_t i, size = list.size();
for (i = 0; i < size; i++) {
int payload = std::atoi (list[i].data());
_codecOrder.push_back ( (AudioCodecType) payload);
i++;
}
// update the codec string according to new codec selection
......
......@@ -182,58 +182,31 @@ pjsip_regc *getSipRegcFromID (const std::string& id UNUSED)
void ManagerImpl::unregisterCurSIPAccounts()
{
Account *current;
AccountMap::iterator iter = _accountMap.begin();
while (iter != _accountMap.end()) {
current = iter->second;
if (current) {
if (current->isEnabled() && current->getType() == "sip") {
AccountMap::iterator iter;
for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
Account *current = iter->second;
if (current && current->isEnabled() && current->getType() == "sip")
current->unregisterVoIPLink();
}
}
iter++;
}
}
void ManagerImpl::registerCurSIPAccounts (void)
{
Account *current;
AccountMap::iterator iter = _accountMap.begin();
while (iter != _accountMap.end()) {
current = iter->second;
if (current) {
if (current->isEnabled() && current->getType() == "sip") {
//current->setVoIPLink(link);
AccountMap::iterator iter;
for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
Account *current = iter->second;
if (current && current->isEnabled() && current->getType() == "sip")
current->registerVoIPLink();
}
}
current = NULL;
iter++;
}
}
void
ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable)
{
// Update the active field
Account* acc = getAccount (accountID);
if (enable == 1)
acc->setEnabled (true);
else
acc->setEnabled (false);
acc->setEnabled (!!enable);
acc->loadConfig();
Manager::instance().saveConfig();
......@@ -248,6 +221,4 @@ ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable)
_debug ("Send unregister for account %s\n" , accountID.c_str());
acc->unregisterVoIPLink();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment