Exemplo n.º 1
0
void ResourceManager::loadLanguage(const string& aFile) {
	try {
		File f(aFile, File::READ, File::OPEN);
		SimpleXML xml;
		xml.fromXML(f.read());

		unordered_map<string, int> h;
		
		for(int i = 0; i < LAST; ++i) {
			h[names[i]] = i;
		}

		if(xml.findChild("Language")) {
			rtl = xml.getBoolChildAttrib("RightToLeft");

			xml.stepIn();
			if(xml.findChild("Strings")) {
				xml.stepIn();

				while(xml.findChild("String")) {
					unordered_map<string, int>::const_iterator j = h.find(xml.getChildAttrib("Name"));

					if(j != h.end()) {
						strings[j->second] = xml.getChildData();
					}
				}
				createWide();
			}
		}
	} catch(const Exception&) {
		// ...
	}
}
void IpManager::onIPUpdate(string buf, bool isFailed) {
	if(!isFailed) {
		if(!buf.empty()) {
			try {
				SimpleXML xml;
				xml.fromXML(buf);
				if(xml.findChild("html")) {
					xml.stepIn();
					if(xml.findChild("body")) {
						string x = xml.getChildData().substr(20);
						if(Util::isPrivateIp(x)) {
							SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_PASSIVE);
						}
						SettingsManager::getInstance()->set(SettingsManager::EXTERNAL_IP, x);				
					} else {
						SettingsManager::getInstance()->set(SettingsManager::EXTERNAL_IP, Util::getLocalIp());
					}
				}
			} catch(const SimpleXMLException&) {
				//...
			}
		}
	} else {
		if(!SETTING(NO_IP_OVERRIDE)) {
			if(Util::isPrivateIp(Util::getLocalIp())) {
				SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_PASSIVE);
			}
			SettingsManager::getInstance()->set(SettingsManager::EXTERNAL_IP, Util::getLocalIp());
		}
	}

}
void FireResourceManager::loadLanguage(const string& aFile) {
	try {
		File f(aFile, File::READ, File::OPEN);
		SimpleXML xml;
		xml.fromXML(f.read());

		HASH_MAP<string, int> h;
//FireDC++ start
		HASH_MAP<string, int> e;
		
//FireDC++ end
		for(int i = 0; i < LAST; ++i) {
			h[names[i]] = i;
		}
//FireDC++ start
		for(int i = 0; i < LASTTWO; ++i) {
			e[namesTwo[i]] = i;
		}
//FireDC++ end
		if(xml.findChild("Language")) {
			rtl = xml.getBoolChildAttrib("RightToLeft");

			xml.stepIn();
			if(xml.findChild("Strings")) {
				xml.stepIn();

				while(xml.findChild("String")) {
					HASH_MAP<string, int>::iterator j = h.find(xml.getChildAttrib("Name"));

					if(j != h.end()) {
						strings[j->second] = xml.getChildData();
					}
				}
				createWide();
			}
//FireDC++ start
			xml.stepOut();
			if(xml.findChild("StringsTwo")) {
				xml.stepIn();

				while(xml.findChild("StringTwo")) {
					HASH_MAP<string, int>::iterator j = e.find(xml.getChildAttrib("Name"));

					if(j != e.end()) {
						stringsTwo[j->second] = xml.getChildData();
					}
				}
				createWideTwo();
			}
//FireDC++ end
		}
	} catch(const Exception&) {
		// ...
	}
}
void FireSettingsManager::load(string const& aFileName)
{
	try {
		SimpleXML xml;
		
		xml.fromXML(File(aFileName, File::READ, File::OPEN).read());
		
		xml.resetCurrentChild();
		
		xml.stepIn();
		
		if(xml.findChild("FireSettings"))
		{
			xml.stepIn();

			int i;
			
			for(i=STR_FIRST; i<STR_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);
				
				if(xml.findChild(attr))
					set(StrSetting(i), xml.getChildData());
				xml.resetCurrentChild();
			}
			for(i=INT_FIRST; i<INT_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);
				
				if(xml.findChild(attr))
					set(IntSetting(i), Util::toInt(xml.getChildData()));
				xml.resetCurrentChild();
			}
			for(i=INT64_FIRST; i<INT64_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);
				
				if(xml.findChild(attr))
					set(Int64Setting(i), Util::toInt64(xml.getChildData()));
				xml.resetCurrentChild();
			}
			
			xml.stepOut();
		}
	
		fire(FireSettingsManagerListener::Load(), xml);
//		fire(FireSettingsManagerListener::Load(), &xml);
		xml.stepOut();

	} catch(const Exception&) {
	}
}
Exemplo n.º 5
0
bool CAGEmotionSetup::LoadEmotion(const string& p_file_name) {
  const string l_fileName = Util::getDataPath() + "EmoPacks\\" + p_file_name + ".xml";
  if ((p_file_name == "Disabled") || !Util::fileExists(l_fileName)) {
    return true;
  }
  try {
    SimpleXML xml;
    xml.fromXML(File(l_fileName, File::READ, File::OPEN).read());
    if (xml.findChild("Emoticons")) {
      xml.stepIn();
      while (xml.findChild("Emoticon")) {
        string strEmotionText = xml.getChildAttrib("PasteText");
        if (strEmotionText.empty()) {
          strEmotionText = xml.getChildAttrib("Expression");
        }
        while (strEmotionText[0] == ' ') // ltrim
          strEmotionText.erase(0, 1);
        if (!strEmotionText.empty()) { 
          // dcdebug("CAGEmotionSetup::Create: emotion:[%s]\n", Text::fromT(strEmotionText).c_str());
          if (m_FilterEmotiion.count(strEmotionText)) {
            //	dcdebug("CAGEmotionSetup::Create: dup emotion:[%s]\n", strEmotionText.c_str());
            continue;
          }
          m_FilterEmotiion.insert(strEmotionText); 
          string strEmotionBmpPath = xml.getChildAttrib("Bitmap");
          if (strEmotionBmpPath.size() > 0) {
            if (strEmotionBmpPath[0] == '.') {
              // Relativni cesta - dame od aplikace
              strEmotionBmpPath = Util::getDataPath() + "EmoPacks\\" + strEmotionBmpPath;
            }
            else strEmotionBmpPath = "EmoPacks\\" + strEmotionBmpPath;
          }
          CAGEmotion* pEmotion = new CAGEmotion();
          //[!]PPA for lock bmp
          //File* l__f = new File (Util::getDataPath() + strEmotionBmpPath, File::READ, File::OPEN);
          if (!pEmotion->Create(Text::toT(strEmotionText), strEmotionBmpPath)) {
            delete pEmotion;
            continue;
          }
          m_CountSelEmotions++;
          EmotionsList.push_back(pEmotion);
        } 
      }
      xml.stepOut();
    }
  } 
  catch(const Exception& e) {
    dcdebug("CAGEmotionSetup::Create: %s\n", e.getError().c_str());
    return false;
  }
  return true;
}
void IpManager::WatchLoad() {
	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getPath(Util::PATH_USER_CONFIG) + "IPWatch.xml", File::READ, File::OPEN).read());
		if(xml.findChild("IPWatch")) {
			xml.stepIn();
			loadWatch(xml);
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("IpManager::WatchLoad: %s\n", e.getError().c_str());
	}	
}
void RawManager::loadActionRaws() {
	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getPath(Util::PATH_USER_CONFIG) + "Raws.xml", File::READ, File::OPEN).read());
		
		if(xml.findChild("ActionRaws")) {
			xml.stepIn();
			loadActionRaws(xml);
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("RawManager::loadActionRaws: %s\n", e.getError().c_str());
	}
}
Exemplo n.º 8
0
void ClientProfileManager::loadClientProfiles() {
	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getConfigPath() + "Profiles.xml", File::READ, File::OPEN).read());
		
		if(xml.findChild("Profiles")) {
			xml.stepIn();
			loadClientProfiles(&xml);
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("FavoriteManager::loadClientProfiles: %s\n", e.getError().c_str());
	}
}
Exemplo n.º 9
0
	void BootstrapManager::on(HttpConnectionListener::Complete, HttpConnection*, string const&, bool /*fromCoral*/) throw()
	{
		if(!nodesXML.empty())
		{
			try
			{
				uLongf destLen = BUFSIZE;
				boost::scoped_array<uint8_t> destBuf;

				// decompress incoming packet
				int result;

				do
				{
					destLen *= 2;
					destBuf.reset(new uint8_t[destLen]);

					result = uncompress(&destBuf[0], &destLen, (Bytef*)nodesXML.data(), nodesXML.length());
				}
				while (result == Z_BUF_ERROR);

				if(result != Z_OK)
				{
					// decompression error!!!
					throw Exception("Decompress error.");
				}

				SimpleXML remoteXml;
				remoteXml.fromXML(string((char*)&destBuf[0], destLen));
				remoteXml.stepIn();

				while(remoteXml.findChild("Node"))
				{
					CID cid		= CID(remoteXml.getChildAttrib("CID"));
					string i4	= remoteXml.getChildAttrib("I4");
					string u4	= remoteXml.getChildAttrib("U4");

					addBootstrapNode(i4, static_cast<uint16_t>(Util::toInt(u4)), cid, UDPKey());
				}

				remoteXml.stepOut();
			}
			catch(Exception& e)
			{
				LogManager::getInstance()->message("DHT bootstrap error: " + e.getError());
			}
		}
	}
Exemplo n.º 10
0
void DetectNetworkSetupThread::on(Complete, HttpConnection*, const string&) throw() {
	debug_log(AUTODETECT, "parsing response {%s}", m_buffer.c_str());
	try {
		SimpleXML xml;
		xml.fromXML(m_buffer);
		if (xml.findChild("response")) {
			debug_log(AUTODETECT, "found <response>");
			xml.stepIn();
			if (xml.findChild("mode")) {
				string mode = xml.getChildData();
				info_log(AUTODETECT, "mode={%s}", mode.c_str());
				xml.resetCurrentChild();
				string address;
				if (xml.findChild("address")) {
					string address = xml.getChildData();
					info_log(AUTODETECT, "address={%s}", address.c_str());
					if (!address.empty()) {
						SettingsManager::getInstance()->set(SettingsManager::EXTERNAL_IP, address);
					}
				}
				else {
					warn_log(AUTODETECT, "<address> not found");
				}
				debug_log(AUTODETECT, "local address={%s}", connection.m_localIp.c_str());
				if (Util::stricmp(mode, "active") == 0) {
					SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_NAT);
					debug_log(AUTODETECT, "setting ACTIVE mode");
				}
				else if (Util::stricmp(mode, "passive") == 0) {
					SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_PASSIVE);
				}
				else {
					throw Exception("Wrong mode '" + mode + "'");
				}
			}
			else {
				warn_log(AUTODETECT, "<mode> not found");
			}
		}
		else {
			warn_log(AUTODETECT, "<response> not found");
		}
	} 
	catch (const Exception &e) {
		error_log(AUTODETECT, "Error parsing response: %s", e.getError().c_str());
	}
	finalize();
}
Exemplo n.º 11
0
void ClientManager::loadUsers() {
	try {
		SimpleXML xml;
		xml.fromXML(File(getUsersFile(), File::READ, File::OPEN).read());

		if(xml.findChild("Users")) {
			xml.stepIn();

			{
				Lock l(cs);
				while(xml.findChild("User")) {
					nicks[CID(xml.getChildAttrib("CID"))] = std::make_pair(xml.getChildAttrib("Nick"), false);
				}
			}

			xml.stepOut();
		}
	} catch(const Exception&) { }
}
Exemplo n.º 12
0
void ResourceManager::loadLanguage(const string& aFile) {
	try {
		File f(aFile, File::READ, File::OPEN, File::BUFFER_SEQUENTIAL, false);
		SimpleXML xml;
		xml.fromXML(f.read());

		unordered_map<string, int> h;
		
		for(int i = 0; i < LAST; ++i) {
			h[names[i]] = i;
		}

		string childName = "String";
		string attribName = "Name";
		if (xml.findChild("Language")) {
			rtl = xml.getBoolChildAttrib("RightToLeft");

			xml.stepIn();
			if (xml.findChild("Strings")) {
				xml.stepIn();
			}
		} else {
			xml.resetCurrentChild();
			if (xml.findChild("resources")) {
				xml.stepIn();
				childName = "string";
				attribName = "name";
			} else {
				throw Exception("Invalid format");
			}
		}

		while (xml.findChild(childName)) {
			const auto j = h.find(xml.getChildAttrib(attribName));
			if(j != h.end()) {
				strings[j->second] = xml.getChildData();
			}
		}
		createWide();
	} catch(const Exception& e) {
		LogManager::getInstance()->message("Failed to load the language file " + aFile + ": " + e.getError(), LogManager::LOG_ERROR);
	}
}
Exemplo n.º 13
0
void EmoticonsManager::Load() {

	setUseEmoticons(false);

	if((SETTING(EMOTICONS_FILE) == "Disabled") || !Util::fileExists(Util::getPath(Util::PATH_EMOPACKS) + SETTING(EMOTICONS_FILE) + ".xml" )) {
		return;
	}

	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getPath(Util::PATH_EMOPACKS) + SETTING(EMOTICONS_FILE) + ".xml", File::READ, File::OPEN).read());
		
		if(xml.findChild("Emoticons")) {
			xml.stepIn();

			while(xml.findChild("Emoticon")) {
				tstring strEmotionText = Text::toT(xml.getChildAttrib("PasteText"));
				if (strEmotionText.empty()) {
					strEmotionText = Text::toT(xml.getChildAttrib("Expression"));
				}
				
				string strEmotionBmpPath = xml.getChildAttrib("Bitmap");
				if (!strEmotionBmpPath.empty()) {
					if (strEmotionBmpPath[0] == '.') {
						// change relative path
						strEmotionBmpPath = Util::getPath(Util::PATH_EMOPACKS) + strEmotionBmpPath;
					} else {
						strEmotionBmpPath = "EmoPacks\\" + strEmotionBmpPath;
					}
				}

				emoticons.push_back(new Emoticon(strEmotionText, strEmotionBmpPath));
			}
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("EmoticonsManager::Create: %s\n", e.getError().c_str());
		return;
	}
	
	setUseEmoticons(true);
}
Exemplo n.º 14
0
bool IpGuard::load()
{
	if (noSave)
	{
		Lock l(cs);
		noSave = false;
		
		try
		{
			SimpleXML xml;
			xml.fromXML(File(Util::getPath(Util::PATH_USER_CONFIG) + "IPGuard.xml", File::READ, File::OPEN).read());
			if (xml.findChild("IpRanges"))
			{
				xml.stepIn();
				while (xml.findChild("Range"))
				{
					uint32_t start = Util::toUInt32(xml.getChildAttrib("Start"));
					uint32_t end = Util::toUInt32(xml.getChildAttrib("End"));
					ranges.push_front(range(++lastRange, xml.getChildAttrib("Comment"), ip(std::min(start, end)), ip(std::max(start, end))));
				}
				xml.resetCurrentChild();
				xml.stepOut();
			}
		}
		catch (const Exception& e)
		{
			dcdebug("IpGuard::load: %s\n", e.getError().c_str());
		}
		
		// Optimize ranges
		ranges.sort();
		ranges.unique(merger);
		
		return true;
	}
	
	return false;
}
void NetworkPage::onHttpRequest(string buf, bool isFailed) {
	if(!isFailed) {
		if(!buf.empty()) {
			try {
				SimpleXML xml;
				xml.fromXML(buf);
				if(xml.findChild("html")) {
					xml.stepIn();
					if(xml.findChild("body")) {
						string x = xml.getChildData().substr(20);
						if(Util::isPrivateIp(x)) {
								CheckRadioButton(IDC_DIRECT, IDC_FIREWALL_PASSIVE, IDC_FIREWALL_PASSIVE);
								fixControls();
						}
						SetDlgItemText(IDC_SERVER, Text::toT(x).c_str());
					} else {
						if(Util::isPrivateIp(Util::getLocalIp())) {
								CheckRadioButton(IDC_DIRECT, IDC_FIREWALL_PASSIVE, IDC_FIREWALL_PASSIVE);
								fixControls();
						}
						SetDlgItemText(IDC_SERVER, Text::toT(Util::getLocalIp()).c_str());
					}
				}
			} catch(const SimpleXMLException&) {
				//...
			}
		}
	} else {
		if(Util::isPrivateIp(Util::getLocalIp())) {
			CheckRadioButton(IDC_DIRECT, IDC_FIREWALL_PASSIVE, IDC_FIREWALL_PASSIVE);
			fixControls();
		}
		SetDlgItemText(IDC_SERVER, Text::toT(Util::getLocalIp()).c_str());
	}
	::EnableWindow(GetDlgItem(IDC_GETIP), true);
}
Exemplo n.º 16
0
bool
RSSFeed::UpdateFeedOldParser(const string& data)
{
	clearNewsList();
	SimpleXML xml;
	try
	{
		xml.fromXML(data);
		xml.resetCurrentChild();
		const RssFormat rssFormat = DetectRSSFormat(&xml, XML_SIMPLE);
		switch (rssFormat)
		{
			case RSS_2_0:
				return ProcessRSS(&xml, XML_SIMPLE, true);
			case RSS_ATOM:
				return ProcessAtom(&xml, XML_SIMPLE, true);
		}
		
	}
	catch (SimpleXMLException& /*ex*/)
	{
	}
	return false;
}
Exemplo n.º 17
0
void UpdateManager::completeVersionDownload(bool manualCheck) {
	auto& conn = conns[CONN_VERSION];
	if(!conn) { return; }
	ScopedFunctor([&conn] { conn.reset(); });

	if (conn->buf.empty()) {
		failVersionDownload(STRING_F(DOWNLOAD_VERSION_FAILED, conn->status), manualCheck);
		return; 
	}

	bool verified = !versionSig.empty() && UpdateManager::verifyVersionData(conn->buf, versionSig);
	if(!verified) {
		failVersionDownload(STRING(VERSION_VERIFY_FAILED), manualCheck);
	}

	try {
		SimpleXML xml;
		xml.fromXML(conn->buf);
		xml.stepIn();


		//Check for updated HTTP links
		if(xml.findChild("Links")) {
			xml.stepIn();
			if(xml.findChild("Homepage")) {
				links.homepage = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("Downloads")) {
				links.downloads = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("GeoIPv6")) {
				links.geoip6 = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("GeoIPv4")) {
				links.geoip4 = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("Customize")) {
				links.customize = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("Forum")) {
				links.discuss = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("Languages")) {
				links.language = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("Guides")) {
				links.guides = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("IPCheck")) {
				links.ipcheck4 = xml.getChildData();
			}
			xml.resetCurrentChild();
			if(xml.findChild("IPCheck6")) {
				links.ipcheck6 = xml.getChildData();
			}
			xml.stepOut();
		}
		xml.resetCurrentChild();

		updater->onVersionDownloaded(xml, verified, manualCheck);
	} catch (const Exception& e) {
		failVersionDownload(STRING_F(VERSION_PARSING_FAILED, e.getError()), manualCheck);
	}

	checkAdditionalUpdates(manualCheck);
}
Exemplo n.º 18
0
LRESULT PropPageTextStyles::onImport(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	tstring x = _T("");	
	if(WinUtil::browseFile(x, m_hWnd, false, x, types, defExt) == IDOK) {
		SimpleXML xml;
		xml.fromXML(File(Text::fromT(x), File::READ, File::OPEN).read());
		xml.resetCurrentChild();
		xml.stepIn();
		if(xml.findChild(("Settings"))) {
			xml.stepIn();

			importData("Font", TEXT_FONT);
			importData("BackgroundColor", BACKGROUND_COLOR);
			importData("TextColor", TEXT_COLOR);
			importData("DownloadBarColor", DOWNLOAD_BAR_COLOR);
			importData("UploadBarColor", UPLOAD_BAR_COLOR);
			importData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR);
			importData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR);
			importData("TextGeneralBold", TEXT_GENERAL_BOLD);
			importData("TextGeneralItalic", TEXT_GENERAL_ITALIC);
			importData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR);
			importData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR);
			importData("TextMyOwnBold", TEXT_MYOWN_BOLD);
			importData("TextMyOwnItalic", TEXT_MYOWN_ITALIC);
			importData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR);
			importData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR);
			importData("TextPrivateBold", TEXT_PRIVATE_BOLD);
			importData("TextPrivateItalic", TEXT_PRIVATE_ITALIC);
			importData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR);
			importData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR);
			importData("TextSystemBold", TEXT_SYSTEM_BOLD);
			importData("TextSystemItalic", TEXT_SYSTEM_ITALIC);
			importData("TextServerBackColor", TEXT_SERVER_BACK_COLOR);
			importData("TextServerForeColor", TEXT_SERVER_FORE_COLOR);
			importData("TextServerBold", TEXT_SERVER_BOLD);
			importData("TextServerItalic", TEXT_SERVER_ITALIC);
			importData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR);
			importData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR);
			importData("TextTimestampBold", TEXT_TIMESTAMP_BOLD);
			importData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC);
			importData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR);
			importData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR);
			importData("TextMyNickBold", TEXT_MYNICK_BOLD);
			importData("TextMyNickItalic", TEXT_MYNICK_ITALIC);
			importData("TextFavBackColor", TEXT_FAV_BACK_COLOR);
			importData("TextFavForeColor", TEXT_FAV_FORE_COLOR);
			importData("TextFavBold", TEXT_FAV_BOLD);
			importData("TextFavItalic", TEXT_FAV_ITALIC);
			importData("TextURLBackColor", TEXT_URL_BACK_COLOR);
			importData("TextURLForeColor", TEXT_URL_FORE_COLOR);
			importData("TextURLBold", TEXT_URL_BOLD);
			importData("TextURLItalic", TEXT_URL_ITALIC);
			importData("BoldAuthorsMess", BOLD_AUTHOR_MESS);
			importData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN);
			importData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP);
			importData("ErrorColor", ERROR_COLOR);
			importData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS);
			importData("MenubarTwoColors", MENUBAR_TWO_COLORS);
			importData("MenubarLeftColor", MENUBAR_LEFT_COLOR);
			importData("MenubarRightColor", MENUBAR_RIGHT_COLOR);
			importData("MenubarBumped", MENUBAR_BUMPED);
			importData("Progress3DDepth", PROGRESS_3DDEPTH);
			importData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2);
			importData("TextOPBackColor", TEXT_OP_BACK_COLOR);
			importData("TextOPForeColor", TEXT_OP_FORE_COLOR);
			importData("TextOPBold", TEXT_OP_BOLD);
			importData("TextOPItalic", TEXT_OP_ITALIC);
			importData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR);
			importData("ProgressBackColor", PROGRESS_BACK_COLOR);
			importData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR);
			importData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR);
			importData("ColorDone", COLOR_DONE);
			importData("ColorDownloaded", COLOR_DOWNLOADED);
			importData("ColorRunning", COLOR_RUNNING);
			importData("IgnoredColor", IGNORED_COLOR);
			importData("FavoriteColor", FAVORITE_COLOR);
			importData("NormalColour", NORMAL_COLOUR);
			importData("PasiveColor", PASIVE_COLOR);
			importData("OpColor", OP_COLOR);
			importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE);
			importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE);
		}
		xml.resetCurrentChild();
		xml.stepOut();
	}

	SendMessage(WM_DESTROY,0,0);
	//SettingsManager::getInstance()->save();
	PropertiesDlg::needUpdate = true;
	SendMessage(WM_INITDIALOG,0,0);

//	RefreshPreview();
	return 0;
}
Exemplo n.º 19
0
void SettingsManager::load(string const& aFileName)
{
	try {
		SimpleXML xml;

		xml.fromXML(File(aFileName, File::READ, File::OPEN).read());

		xml.resetCurrentChild();

		xml.stepIn();

		if(xml.findChild("Settings"))
		{
			xml.stepIn();

			int i;

			for(i=STR_FIRST; i<STR_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);

				if(xml.findChild(attr))
					set(StrSetting(i), xml.getChildData());
				xml.resetCurrentChild();
			}
			for(i=INT_FIRST; i<INT_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);

				if(xml.findChild(attr))
					set(IntSetting(i), Util::toInt(xml.getChildData()));
				xml.resetCurrentChild();
			}
			for(i=INT64_FIRST; i<INT64_LAST; i++)
			{
				const string& attr = settingTags[i];
				dcassert(attr.find("SENTRY") == string::npos);

				if(xml.findChild(attr))
					set(Int64Setting(i), Util::toInt64(xml.getChildData()));
				xml.resetCurrentChild();
			}

			xml.stepOut();
		}

		if(SETTING(PRIVATE_ID).length() != 39 || CID(SETTING(PRIVATE_ID)).isZero()) {
			set(PRIVATE_ID, CID::generate().toBase32());
		}
		
		double v = Util::toDouble(SETTING(CONFIG_VERSION));
		// if(v < 0.x) { // Fix old settings here }

		if(v <= 0.674) {

			// Formats changed, might as well remove these...
			set(LOG_FORMAT_POST_DOWNLOAD, Util::emptyString);
			set(LOG_FORMAT_POST_UPLOAD, Util::emptyString);
			set(LOG_FORMAT_MAIN_CHAT, Util::emptyString);
			set(LOG_FORMAT_PRIVATE_CHAT, Util::emptyString);
			set(LOG_FORMAT_STATUS, Util::emptyString);
			set(LOG_FORMAT_SYSTEM, Util::emptyString);
			set(LOG_FILE_MAIN_CHAT, Util::emptyString);
			set(LOG_FILE_STATUS, Util::emptyString);
			set(LOG_FILE_PRIVATE_CHAT, Util::emptyString);
			set(LOG_FILE_UPLOAD, Util::emptyString);
			set(LOG_FILE_DOWNLOAD, Util::emptyString);
			set(LOG_FILE_SYSTEM, Util::emptyString);
		}

		if(SETTING(SET_MINISLOT_SIZE) < 64)
			set(SET_MINISLOT_SIZE, 64);
		if(SETTING(AUTODROP_INTERVAL) < 1)
			set(AUTODROP_INTERVAL, 1);
		if(SETTING(AUTODROP_ELAPSED) < 1)
			set(AUTODROP_ELAPSED, 1);
		if(SETTING(AUTO_SEARCH_LIMIT) > 5)
			set(AUTO_SEARCH_LIMIT, 5);
		else if(SETTING(AUTO_SEARCH_LIMIT) < 1)
			set(AUTO_SEARCH_LIMIT, 1);

#ifdef _DEBUG
		set(PRIVATE_ID, CID::generate().toBase32());
#endif
		setDefault(UDP_PORT, SETTING(TCP_PORT));

		File::ensureDirectory(SETTING(TLS_TRUSTED_CERTIFICATES_PATH));

		fire(SettingsManagerListener::Load(), xml);

		xml.stepOut();

	} catch(const Exception&) {
		if(CID(SETTING(PRIVATE_ID)).isZero())
			set(PRIVATE_ID, CID::generate().toBase32());
	}
}
Exemplo n.º 20
0
void WulforSettings::loadOldConfig(){
    //Load default values into maps
    {
        strmap.insert(WS_CHAT_LOCAL_COLOR,      "#078010");
        strmap.insert(WS_CHAT_OP_COLOR,         "#000000");
        strmap.insert(WS_CHAT_BOT_COLOR,        "#838383");
        strmap.insert(WS_CHAT_FIND_COLOR,       "#FFFF00");
        strmap.insert(WS_CHAT_PRIV_LOCAL_COLOR, "#078010");
        strmap.insert(WS_CHAT_PRIV_USER_COLOR,  "#ac0000");
        strmap.insert(WS_CHAT_SAY_NICK,         "#2344e7");
        strmap.insert(WS_CHAT_CORE_COLOR,       "#ff0000");
        strmap.insert(WS_CHAT_STAT_COLOR,       "#ac0000");
        strmap.insert(WS_CHAT_USER_COLOR,       "#ac0000");
        strmap.insert(WS_CHAT_FAVUSER_COLOR,    "#00ff7f");
        strmap.insert(WS_CHAT_TIME_COLOR,       qApp->palette().text().color().name());
        strmap.insert(WS_CHAT_MSG_COLOR,        qApp->palette().text().color().name());
        strmap.insert(WS_CHAT_USERLIST_STATE,   "");
        strmap.insert(WS_CHAT_CMD_ALIASES,      "");
        strmap.insert(WS_CHAT_FONT,             "");
        strmap.insert(WS_CHAT_ULIST_FONT,       "");
        strmap.insert(WS_CHAT_PM_FONT,          "");
        strmap.insert(WS_CHAT_SEPARATOR,        ":");
        strmap.insert(WS_CHAT_TIMESTAMP,        "hh:mm:ss");
        strmap.insert(WS_QCONNECT_HISTORY,      "");
        strmap.insert(WS_DEFAULT_LOCALE,        "UTF-8");
        strmap.insert(WS_DOWNLOAD_DIR_HISTORY,  "");
        strmap.insert(WS_DQUEUE_STATE,          "");
        strmap.insert(WS_SEARCH_STATE,          "");
        strmap.insert(WS_SEARCH_HISTORY,        "");
        strmap.insert(WS_TRANSLATION_FILE,      "");
        strmap.insert(WS_TRANSFERS_STATE,       "");
        strmap.insert(WS_SHARE_LPANE_STATE,     "");
        strmap.insert(WS_SHARE_RPANE_STATE,     "");
        strmap.insert(WS_MAINWINDOW_STATE,      "");
        strmap.insert(WS_MAINWINDOW_TOOLBAR_ACTS,"");
        strmap.insert(WS_FTRANSFERS_FILES_STATE,"");
        strmap.insert(WS_FTRANSFERS_USERS_STATE,"");
        strmap.insert(WS_FAV_HUBS_STATE,        "");
        strmap.insert(WS_ADLS_STATE,            "");
        strmap.insert(WS_APP_THEME,             "");
        strmap.insert(WS_APP_FONT,              "");
        strmap.insert(WS_APP_ICONTHEME,         "default");
        strmap.insert(WS_APP_USERTHEME,         "default");
        strmap.insert(WS_APP_SHARED_FILES_COLOR,"#1f8f1f");
        strmap.insert(WS_NOTIFY_SOUNDS,         "");
        strmap.insert(WS_NOTIFY_SND_CMD,        "");
        strmap.insert(WS_FAVUSERS_STATE,        "");
        strmap.insert(WS_SHAREHEADER_STATE,     "");
        strmap.insert(WS_DOWNLOADTO_ALIASES,    "");
        strmap.insert(WS_DOWNLOADTO_PATHS,      "");
        strmap.insert(WS_APP_EMOTICON_THEME,    "default");
        strmap.insert(WS_APP_ASPELL_LANG,       "");
        strmap.insert(WS_APP_ENABLED_SCRIPTS,   "");
        strmap.insert(WS_PUBLICHUBS_STATE,      "");
        strmap.insert(WS_SETTINGS_GUI_FONTS_STATE, "");

        intmap.insert(WB_APP_AUTOAWAY_BY_TIMER, static_cast<int>(false));
        intmap.insert(WB_CHAT_SHOW_TIMESTAMP,   static_cast<int>(true));
        intmap.insert(WB_SHOW_FREE_SPACE,       static_cast<int>(true));
        intmap.insert(WB_LAST_STATUS,           static_cast<int>(true));
        intmap.insert(WB_USERS_STATISTICS,      static_cast<int>(true));
        intmap.insert(WB_CHAT_SHOW_JOINS,       static_cast<int>(false));
        intmap.insert(WB_CHAT_REDIRECT_BOT_PMS, static_cast<int>(true));
        intmap.insert(WB_CHAT_KEEPFOCUS,        static_cast<int>(true));
        intmap.insert(WB_CHAT_SHOW_JOINS_FAV,   static_cast<int>(true));
        intmap.insert(WB_CHAT_HIGHLIGHT_FAVS,   static_cast<int>(true));
        intmap.insert(WB_CHAT_ROTATING_MSGS,    static_cast<int>(true));
        intmap.insert(WB_CHAT_USE_SMILE_PANEL,  static_cast<int>(false));
        intmap.insert(WB_CHAT_HIDE_SMILE_PANEL, static_cast<bool>(true));
        intmap.insert(WB_MAINWINDOW_MAXIMIZED,  static_cast<int>(true));
        intmap.insert(WB_MAINWINDOW_HIDE,       static_cast<int>(false));
        intmap.insert(WB_MAINWINDOW_REMEMBER,   static_cast<int>(false));
        intmap.insert(WB_MAINWINDOW_USE_M_TABBAR, static_cast<int>(true));
        intmap.insert(WB_MAINWINDOW_USE_SIDEBAR, static_cast<int>(true));
        intmap.insert(WB_SEARCHFILTER_NOFREE,   static_cast<int>(false));
        intmap.insert(WB_SEARCH_DONTHIDEPANEL,  static_cast<int>(false));
        intmap.insert(WB_ANTISPAM_ENABLED,      static_cast<int>(false));
        intmap.insert(WB_ANTISPAM_AS_FILTER,    static_cast<int>(false));
        intmap.insert(WB_ANTISPAM_FILTER_OPS,   static_cast<int>(false));
        intmap.insert(WB_IPFILTER_ENABLED,      static_cast<int>(false));
        intmap.insert(WB_TRAY_ENABLED,          static_cast<int>(true));
        intmap.insert(WB_EXIT_CONFIRM,          static_cast<int>(false));
        intmap.insert(WB_SHOW_IP_IN_CHAT,       static_cast<int>(false));
        intmap.insert(WB_SHOW_HIDDEN_USERS,     static_cast<int>(false));
        intmap.insert(WB_SHOW_JOINS,            static_cast<int>(false));
        intmap.insert(WB_NOTIFY_ENABLED,        static_cast<int>(true));
        intmap.insert(WB_NOTIFY_SND_ENABLED,    static_cast<int>(false));
        intmap.insert(WB_NOTIFY_SND_EXTERNAL,   static_cast<int>(false));
        intmap.insert(WB_NOTIFY_CH_ICON_ALWAYS, static_cast<int>(false));
        intmap.insert(WB_NOTIFY_SHOW_ON_ACTIVE, static_cast<int>(false));
        intmap.insert(WB_NOTIFY_SHOW_ON_VISIBLE, static_cast<int>(false));
        intmap.insert(WB_FAVUSERS_AUTOGRANT,    static_cast<int>(true));
        intmap.insert(WB_APP_ENABLE_EMOTICON,   static_cast<int>(true));
        intmap.insert(WB_APP_FORCE_EMOTICONS,   static_cast<int>(false));
        intmap.insert(WB_APP_ENABLE_ASPELL,     static_cast<int>(true));
        intmap.insert(WB_APP_REMOVE_NOT_EX_DIRS,static_cast<int>(false));
        intmap.insert(WB_APP_AUTO_AWAY,         static_cast<int>(false));
        intmap.insert(WB_APP_TBAR_SHOW_CL_BTNS, static_cast<int>(true));
        intmap.insert(WB_WIDGETS_PANEL_VISIBLE, static_cast<int>(true));
        intmap.insert(WB_TOOLS_PANEL_VISIBLE,   static_cast<int>(true));
        intmap.insert(WB_SEARCH_PANEL_VISIBLE,  static_cast<int>(false));
        intmap.insert(WB_MAIN_MENU_VISIBLE,     static_cast<int>(true));
        intmap.insert(WB_USE_CTRL_ENTER,        static_cast<int>(false));
        intmap.insert(WB_SIMPLE_SHARE_MODE,     static_cast<int>(false));
        intmap.insert(WI_APP_UNIT_BASE,         1024);
        intmap.insert(WI_APP_AUTOAWAY_INTERVAL, 60);
        intmap.insert(WI_APP_SHARED_FILES_ALPHA, 127);
        intmap.insert(WI_CHAT_MAXPARAGRAPHS,    1000);
        intmap.insert(WI_DEF_MAGNET_ACTION,     0);
        intmap.insert(WI_CHAT_WIDTH,            -1);
        intmap.insert(WI_CHAT_USERLIST_WIDTH,   -1);
        intmap.insert(WI_CHAT_SORT_COLUMN,      0);
        intmap.insert(WI_CHAT_SORT_ORDER,       0);
        intmap.insert(WI_CHAT_DBLCLICK_ACT,     0);//nick in chat
        intmap.insert(WI_CHAT_MDLCLICK_ACT,     1);//browse files
        intmap.insert(WI_CHAT_FIND_COLOR_ALPHA, 127);
        intmap.insert(WI_CHAT_STATUS_HISTORY_SZ,5);
        intmap.insert(WI_CHAT_STATUS_MSG_MAX_LEN, 128);
        intmap.insert(WI_STATUSBAR_HISTORY_SZ,  5);
        intmap.insert(WI_MAINWINDOW_HEIGHT,     -1);
        intmap.insert(WI_MAINWINDOW_WIDTH,      -1);
        intmap.insert(WI_MAINWINDOW_X,          -1);
        intmap.insert(WI_MAINWINDOW_Y,          -1);
        intmap.insert(WI_SEARCH_SORT_COLUMN,    1);
        intmap.insert(WI_SEARCH_SORT_ORDER,     0);
        intmap.insert(WI_SEARCH_SHARED_ACTION,  0);
        intmap.insert(WI_SEARCH_LAST_TYPE,      0);
        intmap.insert(WI_TRANSFER_HEIGHT,       -1);
        intmap.insert(WI_SHARE_RPANE_WIDTH,     -1);
        intmap.insert(WI_SHARE_WIDTH,           -1);
        intmap.insert(WI_NOTIFY_EVENTMAP,       0x0B);// 0b00001011, (transfer done = off)
        intmap.insert(WI_NOTIFY_MODULE,         1);//default
        intmap.insert(WI_NOTIFY_SNDMAP,         0x0F);// 0b00001111, all events
        intmap.insert(WI_OUT_IN_HIST,           50);//number of output messages in history
    }

    if (!QFile::exists(configFileOld))
        return;

    try{
        SimpleXML xml;
        xml.fromXML(File(configFileOld.toStdString(), File::READ, File::OPEN).read());
        xml.resetCurrentChild();
        xml.stepIn();

        if (xml.findChild("Settings")){

            xml.stepIn();

            auto it = strmap.begin();

            for (; it != strmap.end(); ++it){
                if (xml.findChild(it.key().toStdString()))
                        strmap.insert(it.key(), QString::fromStdString(xml.getChildData()));

                xml.resetCurrentChild();
            }

            auto iit = intmap.begin();

            for (; iit != intmap.end(); ++iit){
                if (xml.findChild(iit.key().toStdString()))
                    intmap.insert(iit.key(), Util::toInt(xml.getChildData()));

                xml.resetCurrentChild();
            }
        }
    }
    catch (Exception &ex){}
}
Exemplo n.º 21
0
void SettingsManager::load(string const& aFileName, bool main)
{
	try {
		SimpleXML xml;
		xml.fromXML(File(aFileName, File::READ, File::OPEN).read());
		xml.resetCurrentChild();
		xml.stepIn();
		if(xml.findChild("Settings")) {
			xml.stepIn();
			for(int i=STR_FIRST; i<STR_LAST; i++) {
				const string& attr = settingTags[i];
				dcassert(attr.find(SENTRY) == string::npos);
				
				if(xml.findChild(attr))
					set(StrSetting(i), xml.getChildData());
				xml.resetCurrentChild();
			}
			for(int i=INT_FIRST+1; i<INT_LAST; i++) {
				const string& attr = settingTags[i];
				dcassert(attr.find(SENTRY) == string::npos);
				
				if(xml.findChild(attr))
					set(IntSetting(i), Util::toInt(xml.getChildData()));
				xml.resetCurrentChild();
			}
			for(int i=INT64_FIRST; i<INT64_LAST; i++) {
				const string& attr = settingTags[i];
				dcassert(attr.find(SENTRY) == string::npos);
				
				if(xml.findChild(attr))
					set(Int64Setting(i), Util::toInt64(xml.getChildData()));
				xml.resetCurrentChild();
			}			
			xml.stepOut();
		}

		if (main) {
			double v = Util::toDouble(SETTING(CONFIG_VERSION));
			// if(v < 0.x) { // Fix old settings here }

			if(v <= 0.674 || SETTING(PRIVATE_ID).length() != 39 || CID(SETTING(PRIVATE_ID)).isZero()) {
				set(PRIVATE_ID, CID::generate().toBase32());

				// Formats changed, might as well remove these...
				set(LOG_FORMAT_POST_DOWNLOAD, Util::emptyString);
				set(LOG_FORMAT_POST_UPLOAD, Util::emptyString);
				set(LOG_FORMAT_MAIN_CHAT, Util::emptyString);
				set(LOG_FORMAT_PRIVATE_CHAT, Util::emptyString);
				set(LOG_FORMAT_STATUS, Util::emptyString);
				set(LOG_FORMAT_SYSTEM, Util::emptyString);
				set(LOG_FILE_MAIN_CHAT, Util::emptyString);
				set(LOG_FILE_STATUS, Util::emptyString);
				set(LOG_FILE_PRIVATE_CHAT, Util::emptyString);
				set(LOG_FILE_UPLOAD, Util::emptyString);
				set(LOG_FILE_DOWNLOAD, Util::emptyString);
				set(LOG_FILE_SYSTEM, Util::emptyString);
			}

			if(v <= 16) {
				set(HUBLIST_SERVERS, Util::emptyString);
			}
#ifdef _DEBUG
			set(PRIVATE_ID, CID::generate().toBase32());
#endif
			setDefault(UDP_PORT, SETTING(TCP_PORT));

#ifdef PPA_INCLUDE_SSL
			File::ensureDirectory(SETTING(TLS_TRUSTED_CERTIFICATES_PATH));
#endif

			fire(SettingsManagerListener::Load(), xml);
		}

		xml.stepOut();

	} catch(const Exception&) {
		if (main) {
			if(CID(SETTING(PRIVATE_ID)).isZero())
				set(PRIVATE_ID, CID::generate().toBase32());
		}
	}

	if (main) {
		if(SETTING(TCP_PORT) == 0) {
			set(TCP_PORT, (int)Util::rand(1025, 8000));
		}
		if(SETTING(UDP_PORT) == 0) {
			set(UDP_PORT, (int)Util::rand(1025, 8000));
		}
		if(SETTING(TLS_PORT) == 0) {
			set(TLS_PORT, (int)Util::rand(1025, 32000));
		}
	}

}
Exemplo n.º 22
0
///////////////////////////////////////////////////////////////////////////////
//
//	Load old searches from disk
//
///////////////////////////////////////////////////////////////////////////////
void ADLSearchManager::Load()
{
	// Clear current
	collection.clear();

	// Load file as a string
	try {
		SimpleXML xml;
		Util::migrate(getConfigFile());
		xml.fromXML(File(getConfigFile(), File::READ, File::OPEN).read());

		if(xml.findChild("ADLSearch")) {
			xml.stepIn();

			// Predicted several groups of searches to be differentiated
			// in multiple categories. Not implemented yet.
			if(xml.findChild("SearchGroup")) {
				xml.stepIn();

				// Loop until no more searches found
				while(xml.findChild("Search")) {
					xml.stepIn();

					// Found another search, load it
					ADLSearch search;

					if(xml.findChild("SearchString")) {
						search.searchString = xml.getChildData();
					}
					if(xml.findChild("SourceType")) {
						search.sourceType = search.StringToSourceType(xml.getChildData());
					}
					if(xml.findChild("DestDirectory")) {
						search.destDir = xml.getChildData();
					}
					if(xml.findChild("IsActive")) {
						search.isActive = (Util::toInt(xml.getChildData()) != 0);
					}
					if(xml.findChild("MaxSize")) {
						search.maxFileSize = Util::toInt64(xml.getChildData());
					}
					if(xml.findChild("MinSize")) {
						search.minFileSize = Util::toInt64(xml.getChildData());
					}
					if(xml.findChild("SizeType")) {
						search.typeFileSize = search.StringToSizeType(xml.getChildData());
					}
					if(xml.findChild("IsAutoQueue")) {
						search.isAutoQueue = (Util::toInt(xml.getChildData()) != 0);
					}

					// Add search to collection
					if(search.searchString.size() > 0) {
						collection.push_back(search);
					}

					// Go to next search
					xml.stepOut();
				}
			}
		}
	} catch(const SimpleXMLException&) {
		return;
	} catch(const FileException&) {
		return;
	}
}
void PropPageTextStyles::LoadTheme(const string& path) {
		
	SimpleXML xml;
	try {
		xml.fromXML(File(path, File::READ, File::OPEN, false).read());
	} catch(...) {
		return;
	}
	xml.resetCurrentChild();
	xml.stepIn();
	if(xml.findChild(("Settings"))) {
		xml.stepIn();

		importData("Font", TEXT_FONT);
		importData("BackgroundColor", BACKGROUND_COLOR);
		importData("TextColor", TEXT_COLOR);
		importData("DownloadBarColor", DOWNLOAD_BAR_COLOR);
		importData("UploadBarColor", UPLOAD_BAR_COLOR);
		importData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR);
		importData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR);
		importData("TextGeneralBold", TEXT_GENERAL_BOLD);
		importData("TextGeneralItalic", TEXT_GENERAL_ITALIC);
		importData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR);
		importData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR);
		importData("TextMyOwnBold", TEXT_MYOWN_BOLD);
		importData("TextMyOwnItalic", TEXT_MYOWN_ITALIC);
		importData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR);
		importData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR);
		importData("TextPrivateBold", TEXT_PRIVATE_BOLD);
		importData("TextPrivateItalic", TEXT_PRIVATE_ITALIC);
		importData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR);
		importData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR);
		importData("TextSystemBold", TEXT_SYSTEM_BOLD);
		importData("TextSystemItalic", TEXT_SYSTEM_ITALIC);
		importData("TextServerBackColor", TEXT_SERVER_BACK_COLOR);
		importData("TextServerForeColor", TEXT_SERVER_FORE_COLOR);
		importData("TextServerBold", TEXT_SERVER_BOLD);
		importData("TextServerItalic", TEXT_SERVER_ITALIC);
		importData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR);
		importData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR);
		importData("TextTimestampBold", TEXT_TIMESTAMP_BOLD);
		importData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC);
		importData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR);
		importData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR);
		importData("TextMyNickBold", TEXT_MYNICK_BOLD);
		importData("TextMyNickItalic", TEXT_MYNICK_ITALIC);
		importData("TextFavBackColor", TEXT_FAV_BACK_COLOR);
		importData("TextFavForeColor", TEXT_FAV_FORE_COLOR);
		importData("TextFavBold", TEXT_FAV_BOLD);
		importData("TextFavItalic", TEXT_FAV_ITALIC);
		importData("TextURLBackColor", TEXT_URL_BACK_COLOR);
		importData("TextURLForeColor", TEXT_URL_FORE_COLOR);
		importData("TextURLBold", TEXT_URL_BOLD);
		importData("TextURLItalic", TEXT_URL_ITALIC);
		importData("TextDupeBackColor", TEXT_DUPE_BACK_COLOR);
		importData("TextDupeColor", DUPE_COLOR);
		importData("TextDupeBold", TEXT_DUPE_BOLD);
		importData("TextDupeItalic", TEXT_DUPE_ITALIC);
		importData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN);
		importData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP);
		importData("ErrorColor", ERROR_COLOR);
		importData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS);
		importData("MenubarTwoColors", MENUBAR_TWO_COLORS);
		importData("MenubarLeftColor", MENUBAR_LEFT_COLOR);
		importData("MenubarRightColor", MENUBAR_RIGHT_COLOR);
		importData("MenubarBumped", MENUBAR_BUMPED);
		importData("Progress3DDepth", PROGRESS_3DDEPTH);
		importData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2);
		importData("TextOPBackColor", TEXT_OP_BACK_COLOR);
		importData("TextOPForeColor", TEXT_OP_FORE_COLOR);
		importData("TextOPBold", TEXT_OP_BOLD);
		importData("TextOPItalic", TEXT_OP_ITALIC);
		importData("TextNormBackColor", TEXT_NORM_BACK_COLOR);
		importData("TextNormForeColor", TEXT_NORM_FORE_COLOR);
		importData("TextNormBold", TEXT_NORM_BOLD);
		importData("TextNormItalic", TEXT_NORM_ITALIC);
		importData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR);
		importData("ProgressBackColor", PROGRESS_BACK_COLOR);
		importData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR);
		importData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR);
		importData("ColorDone", COLOR_DONE);
		importData("ColorDownloaded", COLOR_DOWNLOADED);
		importData("ColorRunning", COLOR_RUNNING);
		importData("ReservedSlotColor", RESERVED_SLOT_COLOR);
		importData("IgnoredColor", IGNORED_COLOR);
		importData("FavoriteColor", FAVORITE_COLOR);
		importData("NormalColour", NORMAL_COLOUR);
		importData("PasiveColor", PASIVE_COLOR);
		importData("OpColor", OP_COLOR);
		importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE);
		importData("UnderlineLinks", UNDERLINE_LINKS);
		importData("UnderlineDupes", UNDERLINE_DUPES);
		importData("TextQueueBackColor", TEXT_QUEUE_BACK_COLOR);
		importData("QueueColor", QUEUE_COLOR);
		importData("TextQueueBold", TEXT_QUEUE_BOLD);
		importData("TextQueueItalic", TEXT_QUEUE_ITALIC);
		importData("UnderlineQueue", UNDERLINE_QUEUE);

		//tabs
		importData("tabactivebg", TAB_ACTIVE_BG);
		importData("TabActiveText", TAB_ACTIVE_TEXT);
		importData("TabActiveBorder", TAB_ACTIVE_BORDER);
		importData("TabInactiveBg", TAB_INACTIVE_BG);
		importData("TabInactiveBgDisconnected", TAB_INACTIVE_BG_DISCONNECTED);
		importData("TabInactiveText", TAB_INACTIVE_TEXT);
		importData("TabInactiveBorder", TAB_INACTIVE_BORDER);
		importData("TabInactiveBgNotify", TAB_INACTIVE_BG_NOTIFY);
		importData("TabDirtyBlend", TAB_DIRTY_BLEND);
		importData("BlendTabs", BLEND_TABS);
		importData("TabSize", TAB_SIZE);

	}
	xml.stepOut();

	if(xml.findChild("Icons")) {
		if(MessageBox(CTSTRING(ICONS_IN_THEME), _T("AirDC++") _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
			xml.stepIn();
			importData("IconPath", ICON_PATH);
			//toolbars not exported to avoid absolute local paths in toolbar settings.
			importData("ToolbarImage", TOOLBARIMAGE);
			importData("ToolbarHot", TOOLBARHOTIMAGE);
			xml.resetCurrentChild();
			xml.stepOut();
		}
	}
	xml.resetCurrentChild();
	if(xml.findChild("Highlights")) {
		if(MessageBox(CTSTRING(HIGHLIGHTS_IN_THEME), _T("AirDC++") _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
			HighlightManager::getInstance()->clearList();
			HighlightManager::getInstance()->load(xml);
		}
	}
	xml.resetCurrentChild();
			
	//SendMessage(WM_DESTROY,0,0);
	//SettingsManager::getInstance()->save();
	//SendMessage(WM_INITDIALOG,0,0);
	SettingsManager::getInstance()->reloadPages();
	
	fontdirty = true;

}