LRESULT PublicHubsFrame::onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if(!checkNick()) return 0; TCHAR buf[256]; if(ctrlHubs.GetSelectedCount() >= 1) { int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntryPtr e; ctrlHubs.GetItemText(i, COLUMN_NAME, buf, 256); e->setName(Text::fromT(buf)); ctrlHubs.GetItemText(i, COLUMN_DESCRIPTION, buf, 256); e->setDescription(Text::fromT(buf)); ctrlHubs.GetItemText(i, COLUMN_SERVER, buf, 256); e->setServerStr(Text::fromT(buf)); e->setShareProfile(ShareManager::getInstance()->getShareProfile(SETTING(DEFAULT_SP))); FavoriteManager::getInstance()->addFavorite(e); } } return 0; }
void FavoriteHubsFrame::openSelected() { if (!checkNick()) return; int i = -1; while ((i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntry r; r.setName(entry->getName()); r.setDescription(entry->getDescription()); r.setUsers("*"); r.setShared("*"); r.setServer(entry->getServer()); FavoriteManager::getInstance()->addRecent(r); HubFrame::openWindow(true, entry->getServer(), entry->getName(), entry->getRawOne(), entry->getRawTwo(), entry->getRawThree(), entry->getRawFour(), entry->getRawFive(), entry->getWindowPosX(), entry->getWindowPosY(), entry->getWindowSizeX(), entry->getWindowSizeY(), entry->getWindowType(), entry->getChatUserSplit(), entry->getUserListState(), entry->getSuppressChatAndPM()); } return; }
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; }
LRESULT PublicHubsFrame::onEnter(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& /*bHandled*/) { if(!checkNick()) return 0; int item = ctrlHubs.GetNextItem(-1, LVNI_FOCUSED); connectHub(item, SETTING(DEFAULT_SP)); return 0; }
LRESULT PublicHubsFrame::onDoubleClickHublist(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { if(!checkNick()) return 0; NMITEMACTIVATE* item = (NMITEMACTIVATE*) pnmh; connectHub(item->iItem, SETTING(DEFAULT_SP)); return 0; }
LRESULT PublicHubsFrame::onClickedConnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if(!checkNick()) return 0; int i = -1; while((i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { connectHub(i, SETTING(DEFAULT_SP)); } return 0; }
LRESULT PublicHubsFrame::onEnter(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& /*bHandled*/) { if (!checkNick()) return 0; int item = m_ctrlHubs.GetNextItem(-1, LVNI_FOCUSED); if (item != -1) openHub(item); return 0; }
void FavoriteHubsFrame::openSelected() { if(!checkNick()) return; int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); HubFrame::openWindow(Text::toT(entry->getServer())); } return; }
void Client::reloadSettings(bool updateNick) { const FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); string ClientId; if (::strncmp(getHubUrl().c_str(),"adc://", 6) == 0 || ::strncmp(getHubUrl().c_str(),"adcs://", 6) == 0) ClientId = fullADCVersionString; else ClientId = fullVersionString; if(hub) { if(updateNick) { setCurrentNick(checkNick(hub->getNick(true))); } if(!hub->getUserDescription().empty()) { setCurrentDescription(hub->getUserDescription()); } else { setCurrentDescription(SETTING(DESCRIPTION)); } if(!hub->getPassword().empty()) setPassword(hub->getPassword()); if (hub->getOverrideId() && strlen(hub->getClientId().c_str()) > 1) ClientId = hub->getClientId(); if (!hub->getExternalIP().empty()) externalIP = hub->getExternalIP(); if (!hub->getEncoding().empty()){ setEncoding(hub->getEncoding()); } if (hub->getUseInternetIP() && !SETTING(INTERNETIP).empty()){ externalIP = SETTING(INTERNETIP); } } else { if(updateNick) { setCurrentNick(checkNick(SETTING(NICK))); } setCurrentDescription(SETTING(DESCRIPTION)); } setClientId(ClientId); }
LRESULT PublicHubsFrame::onDoubleClickHublist(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { if (!checkNick()) return 0; NMITEMACTIVATE* item = (NMITEMACTIVATE*) pnmh; if (item->iItem != -1) openHub(item->iItem); return 0; }
void Client::reloadSettings(bool updateNick) { FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); if(hub) { if(updateNick) { setCurrentNick(checkNick(hub->getNick(true))); } if(!hub->getUserDescription().empty()) { setCurrentDescription(hub->getUserDescription()); } else { setCurrentDescription(SETTING(DESCRIPTION)); } if(!hub->getPassword().empty()) setPassword(hub->getPassword()); } else { if(updateNick) { setCurrentNick(checkNick(SETTING(NICK))); } setCurrentDescription(SETTING(DESCRIPTION)); } }
LRESULT PublicHubsFrame::onClickedConnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if(!checkNick()) return 0; if(ctrlHubs.GetSelectedCount() == 1) { TCHAR buf[256]; int i = ctrlHubs.GetNextItem(-1, LVNI_SELECTED); ctrlHubs.GetItemText(i, COLUMN_SERVER, buf, 256); HubFrame::openWindow(buf); } return 0; }
LRESULT PublicHubsFrame::onEnter(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& /*bHandled*/) { if(!checkNick()) return 0; int item = ctrlHubs.GetNextItem(-1, LVNI_FOCUSED); if(item != -1) { TCHAR buf[256]; ctrlHubs.GetItemText(item, COLUMN_SERVER, buf, 256); HubFrame::openWindow(buf); } return 0; }
LRESULT PublicHubsFrame::onDoubleClickHublist(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { if(!checkNick()) return 0; NMITEMACTIVATE* item = (NMITEMACTIVATE*) pnmh; if(item->iItem != -1) { TCHAR buf[256]; ctrlHubs.GetItemText(item->iItem, COLUMN_SERVER, buf, 256); HubFrame::openWindow(buf); } return 0; }
void FavoriteHubsFrame::openSelected() { if(!checkNick()) return; int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntryPtr r = new RecentHubEntry(entry->getServer()); r->setName(entry->getName()); r->setDescription(entry->getDescription()); ClientManager::getInstance()->createClient(r); // no multithreading because of disorder! } return; }
LRESULT PublicHubsFrame::onClickedConnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if (!checkNick()) return 0; if (m_ctrlHubs.GetSelectedCount() >= 100) // maximum hubs per one connection { if (MessageBox(CTSTRING(PUBLIC_HUBS_WARNING), _T(" "), MB_ICONWARNING | MB_YESNO) == IDNO) return 0; } int i = -1; while ((i = m_ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) openHub(i); return 0; }
void *processConnection(threadOptions *options) { char buf[2048]; char type[128]; int len; int sd = options->sd; free((void *)options); struct timeval tv; tv.tv_sec = 30; tv.tv_usec = 0; setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof tv); len = recv(sd,buf,sizeof(buf),MSG_NOSIGNAL); if(len == -1) { //timeout sendError(sd,"The search has timedout"); return NULL; } makeStringSafe((char *)&buf, sizeof(buf)); if(!find_param(0, buf, type,sizeof(type))) { sendError(sd,"Error recieving request"); return NULL; } //TODO: pmatch(product matching), others(showing buddies),otherslist(wait until GPCM is implemented) if(stricmp(type,"valid") == 0) { checkEmailValid(sd,buf); } else if(stricmp(type,"nicks") == 0) { sendNicks(sd,buf); } else if(stricmp(type,"check") == 0) { checkNick(sd,buf); } else if(stricmp(type,"newuser") == 0) { newUser(sd,buf); } else if(stricmp(type,"search") == 0) { searchUsers(sd,buf); } else if(stricmp(type,"others") == 0) { sendReverseBuddies(sd,buf); } else if(stricmp(type,"otherslist") == 0) { sendReverseBuddies(sd,buf); } else if(stricmp(type,"uniquesearch") == 0) { //nameinator } else if(stricmp(type,"profilelist") == 0) { //nameinator }else { sendError(sd,"Error recieving request"); return NULL; } close(sd); return NULL; }
void FavoriteHubsFrame::openSelected() { if(!checkNick()) return; int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntry r; r.setName(entry->getName()); r.setDescription(entry->getDescription()); r.setUsers("*"); r.setShared("*"); r.setServer(entry->getServer()); FavoriteManager::getInstance()->addRecent(r); HubFrame::openWindow(Text::toT(entry->getServer()) , entry->getChatUserSplit(), entry->getUserListState()); } return; }
LRESULT PublicHubsFrame::onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if(!checkNick()) return 0; TCHAR buf[256]; if(ctrlHubs.GetSelectedCount() == 1) { int i = ctrlHubs.GetNextItem(-1, LVNI_SELECTED); FavoriteHubEntry e; ctrlHubs.GetItemText(i, COLUMN_NAME, buf, 256); e.setName(Text::fromT(buf)); ctrlHubs.GetItemText(i, COLUMN_DESCRIPTION, buf, 256); e.setDescription(Text::fromT(buf)); ctrlHubs.GetItemText(i, COLUMN_SERVER, buf, 256); e.setServer(Text::fromT(buf)); FavoriteManager::getInstance()->addFavorite(e); } return 0; }
LRESULT PublicHubsFrame::onConnectWith(UINT /*uMsg*/, WPARAM /*wParam*/, HWND /*lParam*/, BOOL& /*bHandled*/) { if(!checkNick()) return 0; int item = ctrlHubs.GetNextItem(-1, LVNI_FOCUSED); if(item != -1) { TCHAR buf[256]; ctrlHubs.GetItemText(item, COLUMN_SERVER, buf, 256); ConnectDlg dlg(true); dlg.title = TSTRING(CONNECT_WITH_PROFILE); dlg.address = buf; if(dlg.DoModal(m_hWnd) == IDOK) { connectHub(item, dlg.curProfile); } } return 0; }
LRESULT PublicHubsFrame::onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if (!checkNick()) return 0; int i = -1; while ((i = m_ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry e; e.setName(m_ctrlHubs.ExGetItemText(i, COLUMN_NAME)); e.setDescription(m_ctrlHubs.ExGetItemText(i, COLUMN_DESCRIPTION)); e.setServer(Util::formatDchubUrl(m_ctrlHubs.ExGetItemText(i, COLUMN_SERVER))); // if (!client->getPassword().empty()) // ToDo: Use SETTINGS Nick and Password // { // e.setNick(client->getMyNick()); // e.setPassword(client->getPassword()); // } FavoriteManager::getInstance()->addFavorite(e); } return 0; }
void NmdcHub::myInfo() { checkstate(); dcdebug("MyInfo %s...\n", getNick().c_str()); lastCounts = counts; string tmp1 = ";**\x1fU9"; string tmp2 = "+L9"; string tmp3 = "+G9"; string tmp4 = "+R9"; string tmp5 = "+N9"; string::size_type i; for(i = 0; i < 6; i++) { tmp1[i]++; } for(i = 0; i < 3; i++) { tmp2[i]++; tmp3[i]++; tmp4[i]++; tmp5[i]++; } char modeChar = '?'; if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_ACTIVE) modeChar = 'A'; else if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_PASSIVE) modeChar = 'P'; else if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_SOCKS5) modeChar = '5'; string uMin = (SETTING(MIN_UPLOAD_SPEED) == 0) ? Util::emptyString : tmp5 + Util::toString(SETTING(MIN_UPLOAD_SPEED)); string minf = "$MyINFO $ALL " + toNmdc(checkNick(getNick())) + " " + toNmdc(Util::validateMessage(getDescription(), false)) + tmp1 + VERSIONSTRING + tmp2 + modeChar + tmp3 + getCounts() + tmp4 + Util::toString(SETTING(SLOTS)) + uMin + ">$ $" + SETTING(CONNECTION) + "\x01$" + toNmdc(Util::validateMessage(SETTING(EMAIL), false)) + '$' + ShareManager::getInstance()->getShareSizeString() + "$|"; if(minf != lastMyInfo) { send(minf); lastMyInfo = minf; } }
void PublicHubsFrame::connectHub(int pos, ProfileToken shareProfile) { if (pos == -1) return; if(!checkNick()) return; TCHAR buf[256]; ctrlHubs.GetItemText(pos, COLUMN_SERVER, buf, 256); RecentHubEntryPtr r = new RecentHubEntry(Text::fromT(buf)); ctrlHubs.GetItemText(pos, COLUMN_NAME, buf, 256); r->setName(Text::fromT(buf)); ctrlHubs.GetItemText(pos, COLUMN_DESCRIPTION, buf, 256); r->setDescription(Text::fromT(buf)); ctrlHubs.GetItemText(pos, COLUMN_USERS, buf, 256); r->setUsers(Text::fromT(buf)); ctrlHubs.GetItemText(pos, COLUMN_SHARED, buf, 256); r->setShared(Text::fromT(buf)); FavoriteManager::getInstance()->addRecent(r); WinUtil::connectHub(r, shareProfile); }
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; }