void CListBoxCtrl::NewStrings(const SC_StringArray& newStrings) { ClearEntries(); AddBasicEntry(newStrings); ResetStrings(); ResetSelection(); }
void fsaFile::cleanup() { ClearEntries(); if(_pDir != NULL) { delete _pDir; _pDir = NULL; } }
bool fsaFile::CopyEntries(fsaFile &From) { int nSave = From.rewindDirEntries(); ClearEntries(); int n = From.dirEntryCount(); fsaDirEntry *pEntry; bool bRtn = true; for(int i = 0; bRtn && (i < n); i++) { pEntry = From.nextDirEntry(); bRtn = CopyAddDirEntry(*pEntry); } From.setDirEntry(nSave); return bRtn; }
bool WebResourcesManager::LoadDetectionConfigurations(const wxArrayString& baseUrls, ProgressHandler* handler ) { ClearEntries(); bool AnyValid = false; for ( size_t i=0; i<baseUrls.Count(); i++ ) { wxString listUrl = baseUrls[i]; wxString baseUrl; if ( listUrl.Last() == _T('/') ) { baseUrl = listUrl; } else { baseUrl = listUrl.BeforeLast(_T('/')); if ( baseUrl.IsEmpty() ) { baseUrl = listUrl; } baseUrl += _T('/'); } std::vector< char > arr; if ( !DoDownload( listUrl, handler, arr ) ) continue; TiXmlDocument doc; if ( doc.Parse( &arr[0], 0, TIXML_DEFAULT_ENCODING ) ) { if ( doc.RootElement() ) { if ( !strcmp(doc.RootElement()->Value(),"libfinderlist") ) { TiXmlElement* root = doc.RootElement(); for ( TiXmlElement* lib = root->FirstChildElement("library"); lib; lib = lib->NextSiblingElement("library") ) { wxString ShortCode = wxString( lib->Attribute("short_code"), wxConvUTF8 ); wxString FileName = wxString( lib->Attribute("file_name"), wxConvUTF8 ); wxString DigiSign = wxString( lib->Attribute("sign"), wxConvUTF8 ); if ( !ShortCode.IsEmpty() && !FileName.IsEmpty() ) { DetectConfigurationEntry* entry = new DetectConfigurationEntry; entry->m_Url = baseUrl + FileName; entry->m_Sign = DigiSign; entry->m_Next = m_Entries[ ShortCode ]; m_Entries[ ShortCode ] = entry; AnyValid = true; continue; } } continue; } } } if ( handler ) handler->Error( _("Invalid data in libraries list in: ") + listUrl, handler->idDownloadList ); } if ( handler ) handler->JobFinished( handler->idDownloadList ); return AnyValid; }
WebResourcesManager::~WebResourcesManager() { ClearEntries(); }
/** Fill our conf vector with data */ void ReadConf() { ClearEntries(); ConfigTagList dnsbls = ServerInstance->Config->ConfTags("dnsbl"); for(ConfigIter i = dnsbls.first; i != dnsbls.second; ++i) { ConfigTag* tag = i->second; DNSBLConfEntry *e = new DNSBLConfEntry(); e->name = tag->getString("name"); e->ident = tag->getString("ident"); e->host = tag->getString("host"); e->reason = tag->getString("reason"); e->domain = tag->getString("domain"); if (tag->getString("type") == "bitmask") { e->type = DNSBLConfEntry::A_BITMASK; e->bitmask = tag->getInt("bitmask"); } else { memset(e->records, 0, sizeof(e->records)); e->type = DNSBLConfEntry::A_RECORD; irc::portparser portrange(tag->getString("records"), false); long item = -1; while ((item = portrange.GetToken())) e->records[item] = 1; } e->banaction = str2banaction(tag->getString("action")); e->duration = InspIRCd::Duration(tag->getString("duration", "60")); /* Use portparser for record replies */ /* yeah, logic here is a little messy */ if ((e->bitmask <= 0) && (DNSBLConfEntry::A_BITMASK == e->type)) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): invalid bitmask", location.c_str()); } else if (e->name.empty()) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid name", location.c_str()); } else if (e->domain.empty()) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid domain", location.c_str()); } else if (e->banaction == DNSBLConfEntry::I_UNKNOWN) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid banaction", location.c_str()); } else if (e->duration <= 0) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid duration", location.c_str()); } else { if (e->reason.empty()) { std::string location = tag->getTagLocation(); ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): empty reason, using defaults", location.c_str()); e->reason = "Your IP has been blacklisted."; } /* add it, all is ok */ DNSBLConfEntries.push_back(e); continue; } /* delete and drop it, error somewhere */ delete e; } }
~ModuleDNSBL() { ClearEntries(); }