void Client::reloadSettings(bool updateNick) { /// @todo update the nick in ADC hubs? string prevNick; if(!updateNick) prevNick = get(Nick); auto fav = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); *static_cast<HubSettings*>(this) = SettingsManager::getInstance()->getHubSettings(); bool isAdcHub = AirUtil::isAdcHub(hubUrl); if(fav) { FavoriteManager::getInstance()->mergeHubSettings(fav, *this); if(!fav->getPassword().empty()) setPassword(fav->getPassword()); setStealth(!isAdcHub ? fav->getStealth() : false); setFavNoPM(fav->getFavNoPM()); favToken = fav->getToken(); } else { setStealth(false); setFavNoPM(false); setPassword(Util::emptyString); } searchQueue.minInterval = get(HubSettings::SearchInterval) * 1000; //convert from seconds if (updateNick) checkNick(get(Nick)); else get(Nick) = prevNick; }
const FavoriteHubEntry* Client::reloadSettings(bool updateNick) { #ifdef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION string speedDescription; #endif // [!] FlylinkDC mimicry function const FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); if (hub && hub->getOverrideId()) // mimicry tag { m_clientName = hub->getClientName(); m_clientVersion = hub->getClientVersion(); } #ifdef IRAINMAN_ENABLE_STEALTH_MODE else if (hub && hub->getStealth()) // stealth DC++ { m_clientName = "++"; m_clientVersion = DCVERSIONSTRING; } #endif else // FlylinkDC native { #ifdef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION if (BOOLSETTING(ADD_TO_DESCRIPTION)) { if (BOOLSETTING(ADD_DESCRIPTION_SLOTS)) speedDescription += '[' + Util::toString(UploadManager::getInstance()->getFreeSlots()) + ']'; if (BOOLSETTING(ADD_DESCRIPTION_LIMIT) && BOOLSETTING(THROTTLE_ENABLE) && ThrottleManager::getInstance()->getUploadLimitInKBytes() != 0) speedDescription += "[L:" + Util::toString(ThrottleManager::getInstance()->getUploadLimitInKBytes()) + "KB]"; } #endif m_clientName = APPNAME; m_clientVersion = A_SHORT_VERSIONSTRING; if (CompatibilityManager::isWine()) { m_clientVersion += "-wine"; } } // [~] FlylinkDC mimicry function if (hub) { if (updateNick) { string l_nick = hub->getNick(true); checkNick(l_nick); setCurrentNick(l_nick); } if (!hub->getUserDescription().empty()) { setCurrentDescription( #ifdef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION speedDescription + #endif hub->getUserDescription()); } else { setCurrentDescription( #ifdef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION speedDescription + #endif SETTING(DESCRIPTION)); } if (!hub->getEmail().empty()) { setCurrentEmail(hub->getEmail()); } else { setCurrentEmail(SETTING(EMAIL)); } if (!hub->getPassword().empty()) { setPassword(hub->getPassword()); } #ifdef IRAINMAN_ENABLE_STEALTH_MODE setStealth(hub->getStealth()); #endif //[+]FlylinkDC #ifdef IRAINMAN_INCLUDE_HIDE_SHARE_MOD setHideShare(hub->getHideShare()); #endif setFavIp(hub->getIP()); if (!hub->getEncoding().empty()) { setEncoding(hub->getEncoding()); } if (hub->getSearchInterval() < 2) // [!]FlylinkDC changed 10 to 2 { setSearchInterval(SETTING(MINIMUM_SEARCH_INTERVAL) * 1000); } else { setSearchInterval(hub->getSearchInterval() * 1000); } // [+] IRainman fix. m_opChat = hub->getOpChat(); m_exclChecks = hub->getExclChecks(); // [~] IRainman fix. } else { if (updateNick) { string l_nick = SETTING(NICK); checkNick(l_nick); setCurrentNick(l_nick); } setCurrentDescription( #ifdef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION speedDescription + #endif SETTING(DESCRIPTION)); setCurrentEmail(SETTING(EMAIL)); #ifdef IRAINMAN_ENABLE_STEALTH_MODE setStealth(false); #endif #ifdef IRAINMAN_INCLUDE_HIDE_SHARE_MOD setHideShare(false); #endif setFavIp(Util::emptyString); setSearchInterval(SETTING(MINIMUM_SEARCH_INTERVAL) * 1000); // [+] IRainman fix. m_opChat.clear(); m_exclChecks = false; // [~] IRainman fix. } /* [-] IRainman mimicry function // !SMT!-S for (string::size_type i = 0; i < ClientId.length(); i++) if (ClientId[i] == '<' || ClientId[i] == '>' || ClientId[i] == ',' || ClientId[i] == '$' || ClientId[i] == '|') { ClientId = ClientId.substr(0, i); break; } */ // [~] IRainman mimicry function return hub; }