diff options
| author | Dioksin <dioksin@ua.fm> | 2014-05-27 13:39:32 +0000 | 
|---|---|---|
| committer | Dioksin <dioksin@ua.fm> | 2014-05-27 13:39:32 +0000 | 
| commit | be8c5e916f1719875ebd96580c0f46666b3e2ee5 (patch) | |
| tree | b59b047370d0360141d8c7a6b9f290c48fd30234 | |
| parent | 2e13624b7cf4e8ef8a0dfdb49ce5407e59f7df01 (diff) | |
Updating of Quotes plugin
git-svn-id: http://svn.miranda-ng.org/main/trunk@9322 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
| -rw-r--r-- | plugins/Quotes/src/ExtraImages.cpp | 22 | ||||
| -rw-r--r-- | plugins/Quotes/src/ExtraImages.h | 2 | ||||
| -rw-r--r-- | plugins/Quotes/src/Forex.cpp | 239 | ||||
| -rw-r--r-- | plugins/Quotes/src/IQuotesProvider.h | 5 | ||||
| -rw-r--r-- | plugins/Quotes/src/OptionDukasCopy.cpp | 2 | ||||
| -rw-r--r-- | plugins/Quotes/src/QuotesProviderBase.cpp | 108 | ||||
| -rw-r--r-- | plugins/Quotes/src/QuotesProviderBase.h | 5 | ||||
| -rw-r--r-- | plugins/Quotes/src/QuotesProviderDukasCopy.cpp | 4 | ||||
| -rw-r--r-- | plugins/Quotes/src/QuotesProviderFinance.cpp | 2 | ||||
| -rw-r--r-- | plugins/Quotes/src/QuotesProviderGoogle.cpp | 2 | ||||
| -rw-r--r-- | plugins/Quotes/src/version.h | 2 | 
11 files changed, 228 insertions, 165 deletions
| diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index 4d061a0651..8b14ce5c4c 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -45,14 +45,14 @@ bool CExtraImages::SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)con  	return ExtraIcon_SetIcon(m_hExtraIcons, hContact, hIcolib) == 0;
  }
 -int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
 -{
 -	MCONTACT hContact = MCONTACT(wp);
 -
 -	const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 -	CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
 -	if(pProvider)
 -		pProvider->SetContactExtraIcon(hContact);
 -
 -	return 0;
 -}
 +// int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
 +// {
 +// 	MCONTACT hContact = MCONTACT(wp);
 +// 
 +// 	const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 +// 	CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
 +// 	if(pProvider)
 +// 		pProvider->SetContactExtraIcon(hContact);
 +// 
 +// 	return 0;
 +// }
 diff --git a/plugins/Quotes/src/ExtraImages.h b/plugins/Quotes/src/ExtraImages.h index 6099ee5f94..d5581c6df3 100644 --- a/plugins/Quotes/src/ExtraImages.h +++ b/plugins/Quotes/src/ExtraImages.h @@ -30,6 +30,6 @@ private:  	bool m_bExtraImagesInit;
  };
 -int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
 +// int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
  #endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
 diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index c4ac039c8c..1443562de2 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -66,55 +66,71 @@ namespace  	}
 -	INT_PTR QuoteProtoFunc_SetStatus(WPARAM wp,LPARAM /*lp*/)
 -	{
 -		if ((ID_STATUS_ONLINE == wp) || (ID_STATUS_OFFLINE == wp))
 -		{
 -			bool bAutoUpdate = (ID_STATUS_ONLINE == wp);
 -			bool bOldFlag = g_bAutoUpdate;
 -
 -			if(bAutoUpdate != g_bAutoUpdate)
 -			{
 -				g_bAutoUpdate = bAutoUpdate;
 -				db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
 -				if (bOldFlag && !g_bAutoUpdate)
 -				{
 -					BOOL b = ::SetEvent(g_hEventWorkThreadStop);
 -					assert(b);
 -				}
 -				else if (g_bAutoUpdate && !bOldFlag)
 -				{
 -					BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
 -					assert(b && "Failed to reset event");
 -
 -					const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 -					const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
 -					for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
 -					{
 -						const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
 -						g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
 -					}
 -				}
 -
 -				UpdateMenu(g_bAutoUpdate);
 -				//ProtoBroadcastAck(QUOTES_PROTOCOL_NAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,reinterpret_cast<HANDLE>(nOldStatus),g_nStatus);
 -			}
 -
 -		}
 -
 -		return 0;
 -	}
 +// 	INT_PTR QuoteProtoFunc_SetStatus(WPARAM wp,LPARAM /*lp*/)
 +// 	{
 +// 		if ((ID_STATUS_ONLINE == wp) || (ID_STATUS_OFFLINE == wp))
 +// 		{
 +// 			bool bAutoUpdate = (ID_STATUS_ONLINE == wp);
 +// 			bool bOldFlag = g_bAutoUpdate;
 +// 
 +// 			if(bAutoUpdate != g_bAutoUpdate)
 +// 			{
 +// 				g_bAutoUpdate = bAutoUpdate;
 +// 				db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
 +// 				if (bOldFlag && !g_bAutoUpdate)
 +// 				{
 +// 					BOOL b = ::SetEvent(g_hEventWorkThreadStop);
 +// 					assert(b);
 +// 				}
 +// 				else if (g_bAutoUpdate && !bOldFlag)
 +// 				{
 +// 					BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
 +// 					assert(b && "Failed to reset event");
 +// 
 +// 					const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 +// 					const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
 +// 					for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
 +// 					{
 +// 						const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
 +// 						g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
 +// 					}
 +// 				}
 +// 
 +// 				UpdateMenu(g_bAutoUpdate);
 +// 				//ProtoBroadcastAck(QUOTES_PROTOCOL_NAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,reinterpret_cast<HANDLE>(nOldStatus),g_nStatus);
 +// 			}
 +// 
 +// 		}
 +// 
 +// 		return 0;
 +// 	}
  	INT_PTR QuotesMenu_RefreshAll(WPARAM wp,LPARAM lp)
  	{
  		const CQuotesProviders::TQuotesProviders& apProviders = CModuleInfo::GetQuoteProvidersPtr()->GetProviders();
 -		std::for_each(apProviders.begin(),apProviders.end(),boost::bind(&IQuotesProvider::RefreshAll,_1));
 +		std::for_each(apProviders.begin(),apProviders.end(),boost::bind(&IQuotesProvider::RefreshAllContacts,_1));
  		return 0;
  	}
  	INT_PTR QuotesMenu_EnableDisable(WPARAM wp,LPARAM lp)
  	{
 -		QuoteProtoFunc_SetStatus(g_bAutoUpdate ? ID_STATUS_OFFLINE : ID_STATUS_ONLINE,0L);
 +		//QuoteProtoFunc_SetStatus(g_bAutoUpdate ? ID_STATUS_OFFLINE : ID_STATUS_ONLINE,0L);
 +
 +		g_bAutoUpdate = (g_bAutoUpdate) ? false : true;
 +		db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
 +
 +		const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 +		const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
 +		std::for_each(std::begin(rapProviders),std::end(rapProviders),[](const CQuotesProviders::TQuotesProviderPtr& pProvider)
 +		{
 +			pProvider->RefreshSettings();
 +			if(g_bAutoUpdate)
 +			{
 +				pProvider->RefreshAllContacts();
 +			}
 +		});
 +		UpdateMenu(g_bAutoUpdate);
 +
  		return 0;
  	}
 @@ -285,11 +301,11 @@ namespace  	{
  		CHTTPSession::Init();
 -		HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
 -		g_ahEvents.push_back(h);
 +// 		HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
 +// 		g_ahEvents.push_back(h);
  		g_hEventWorkThreadStop = ::CreateEvent(NULL,TRUE,FALSE,NULL);
 -		h = (ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
 +		auto h = HookEvent(ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
  		g_ahEvents.push_back(h);
  		h = HookEvent(ME_CLIST_DOUBLECLICKED,Quotes_OnContactDoubleClick);
 @@ -298,8 +314,21 @@ namespace  		h = HookEvent(ME_TTB_MODULELOADED, Quotes_OnToolbarLoaded);
  		g_ahEvents.push_back(h);
 +		g_bAutoUpdate = 1 == db_get_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,1);
 +
  		InitMenu();
 +		BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
 +		assert(b && "Failed to reset event");
 +
 +		const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
 +		const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
 +		for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
 +		{
 +			const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
 +			g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
 +		}
 +
  		return 0;
  	}
 @@ -317,10 +346,10 @@ namespace  		return 0;
  	}
 -	INT_PTR QuoteProtoFunc_GetStatus(WPARAM/* wp*/,LPARAM/* lp*/)
 -	{
 -		return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
 -	}
 +// 	INT_PTR QuoteProtoFunc_GetStatus(WPARAM/* wp*/,LPARAM/* lp*/)
 +// 	{
 +// 		return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
 +// 	}
  	void WaitForWorkingThreads()
  	{
 @@ -335,54 +364,56 @@ namespace  	int QuotesEventFunc_PreShutdown(WPARAM wParam, LPARAM lParam)
  	{
 -		QuoteProtoFunc_SetStatus(ID_STATUS_OFFLINE,0);
 +		//QuoteProtoFunc_SetStatus(ID_STATUS_OFFLINE,0);
 +		BOOL b = ::SetEvent(g_hEventWorkThreadStop);
 +
  		CModuleInfo::GetInstance().OnMirandaShutdown();
  		return 0;
  	}
 -	INT_PTR QuoteProtoFunc_GetName(WPARAM wParam, LPARAM lParam)
 -	{
 -		if(lParam)
 -		{
 -			lstrcpynA(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
 -			return 0;
 -		}
 -		else
 -		{
 -			return 1;
 -		}
 -	}
 -
 -	INT_PTR QuoteProtoFunc_GetCaps(WPARAM wp,LPARAM lp)
 -	{
 -		int ret = 0;
 -		switch(wp)
 -		{
 -		case PFLAGNUM_1:
 -			ret = PF1_PEER2PEER;
 -			break;
 -		case PFLAGNUM_3:
 -		case PFLAGNUM_2:
 -			ret = PF2_ONLINE|PF2_LONGAWAY;
 -			if(CModuleInfo::GetInstance().GetExtendedStatusFlag())
 -			{
 -				ret |= PF2_LIGHTDND;
 -			}
 -			break;
 -		}
 -
 -		return ret;
 -	}
 -
 -	INT_PTR QuoteProtoFunc_LoadIcon(WPARAM wp,LPARAM /*lp*/)
 -	{
 -		if ((wp & 0xffff) == PLI_PROTOCOL)
 -		{
 -			return reinterpret_cast<int>(::CopyIcon(Quotes_LoadIconEx(ICON_STR_MAIN)));
 -		}
 -
 -		return 0;
 -	}
 +// 	INT_PTR QuoteProtoFunc_GetName(WPARAM wParam, LPARAM lParam)
 +// 	{
 +// 		if(lParam)
 +// 		{
 +// 			lstrcpynA(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
 +// 			return 0;
 +// 		}
 +// 		else
 +// 		{
 +// 			return 1;
 +// 		}
 +// 	}
 +// 
 +// 	INT_PTR QuoteProtoFunc_GetCaps(WPARAM wp,LPARAM lp)
 +// 	{
 +// 		int ret = 0;
 +// 		switch(wp)
 +// 		{
 +// 		case PFLAGNUM_1:
 +// 			ret = PF1_PEER2PEER;
 +// 			break;
 +// 		case PFLAGNUM_3:
 +// 		case PFLAGNUM_2:
 +// 			ret = PF2_ONLINE|PF2_LONGAWAY;
 +// 			if(CModuleInfo::GetInstance().GetExtendedStatusFlag())
 +// 			{
 +// 				ret |= PF2_LIGHTDND;
 +// 			}
 +// 			break;
 +// 		}
 +// 
 +// 		return ret;
 +// 	}
 +// 
 +// 	INT_PTR QuoteProtoFunc_LoadIcon(WPARAM wp,LPARAM /*lp*/)
 +// 	{
 +// 		if ((wp & 0xffff) == PLI_PROTOCOL)
 +// 		{
 +// 			return reinterpret_cast<int>(::CopyIcon(Quotes_LoadIconEx(ICON_STR_MAIN)));
 +// 		}
 +// 
 +// 		return 0;
 +// 	}
  	int QuotesEventFunc_OptInitialise(WPARAM wp,LPARAM/* lp*/)
  	{
 @@ -447,18 +478,18 @@ extern "C"  		pd.type = PROTOTYPE_VIRTUAL;
  		CallService(MS_PROTO_REGISTERMODULE, 0, ( LPARAM )&pd );
 -		HANDLE h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName);
 -		g_ahServices.push_back(h);
 -		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps);
 -		g_ahServices.push_back(h);
 -		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus);
 -		g_ahServices.push_back(h);
 -		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus);
 -		g_ahServices.push_back(h);
 -		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon);
 -		g_ahServices.push_back(h);
 -
 -		h = HookEvent(ME_SYSTEM_MODULESLOADED,QuotesEventFunc_OnModulesLoaded);
 +// 		HANDLE h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName);
 +// 		g_ahServices.push_back(h);
 +// 		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps);
 +// 		g_ahServices.push_back(h);
 +// 		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus);
 +// 		g_ahServices.push_back(h);
 +// 		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus);
 +// 		g_ahServices.push_back(h);
 +// 		h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon);
 +// 		g_ahServices.push_back(h);
 +
 +		auto h = HookEvent(ME_SYSTEM_MODULESLOADED,QuotesEventFunc_OnModulesLoaded);
  		g_ahEvents.push_back(h);
  		h = HookEvent(ME_DB_CONTACT_DELETED,QuotesEventFunc_OnContactDeleted);
  		g_ahEvents.push_back(h);
 @@ -472,7 +503,7 @@ extern "C"  		h = CreateServiceFunction(MS_QUOTES_IMPORT, Quotes_Import);
  		g_ahServices.push_back(h);
 -		g_bAutoUpdate = 1 == db_get_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,1);
 +
  		return 0;
  	}
 diff --git a/plugins/Quotes/src/IQuotesProvider.h b/plugins/Quotes/src/IQuotesProvider.h index f72a68f3a0..5c60536e41 100644 --- a/plugins/Quotes/src/IQuotesProvider.h +++ b/plugins/Quotes/src/IQuotesProvider.h @@ -26,9 +26,10 @@ public:  	virtual void DeleteContact(MCONTACT hContact) = 0;
  	virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) = 0;
 -	virtual void RefreshAll() = 0;
 +	virtual void RefreshAllContacts() = 0;
 +	virtual void RefreshSettings() = 0;
   	virtual void RefreshContact(MCONTACT hContact) = 0;
 -	virtual void SetContactExtraIcon(MCONTACT hContact)const = 0;
 +// 	virtual void SetContactExtraIcon(MCONTACT hContact)const = 0;
  	virtual void Run() = 0;
 diff --git a/plugins/Quotes/src/OptionDukasCopy.cpp b/plugins/Quotes/src/OptionDukasCopy.cpp index 8ba2d9768f..162c95bb7f 100644 --- a/plugins/Quotes/src/OptionDukasCopy.cpp +++ b/plugins/Quotes/src/OptionDukasCopy.cpp @@ -344,7 +344,7 @@ namespace  						if(pDukasProvider)
  						{
  							recursive_save_selection(::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES),pDukasProvider);
 -							pDukasProvider->RefreshAll();
 +							pDukasProvider->RefreshSettings();
  						}
  					}
  					break;
 diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index 3751454b58..560bfde7c2 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -235,7 +235,7 @@ const tstring& CQuotesProviderBase::GetURL()const  bool CQuotesProviderBase::IsOnline()
  {
 -	return g_bAutoUpdate;
 +	return /*g_bAutoUpdate*/true;
  }
  void CQuotesProviderBase::AddContact(MCONTACT hContact)
 @@ -819,7 +819,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact,double dRate,const  	}
 -	if((true == IsOnline()))
 +// 	if((true == IsOnline()))
  	{
  		SetContactStatus(hContact,ID_STATUS_ONLINE);
  	}
 @@ -851,6 +851,11 @@ namespace  {
  	DWORD get_refresh_timeout_miliseconds(const CQuotesProviderVisitorDbSettings& visitor)
  	{
 +		if(!g_bAutoUpdate)
 +		{
 +			return INFINITE;
 +		}
 +
  		assert(visitor.m_pszDbRefreshRateType);
  		assert(visitor.m_pszDbRefreshRateValue);
 @@ -934,14 +939,14 @@ void CQuotesProviderBase::Run()  	bool bGoToBed = false;
 +	if(g_bAutoUpdate)
 +	{
 +		CBoolGuard bg(m_bRefreshInProgress);		
 +		RefreshQuotes(anContacts);
 +	}
 +
  	while(false == bGoToBed)
  	{		
 -		{
 -			CBoolGuard bg(m_bRefreshInProgress);
 -// 			LogIt(Info,_T("Begin contacts refreshing"));
 -			RefreshQuotes(anContacts);
 -// 			LogIt(Info,_T("End contacts refreshing"));
 -		}
  		anContacts.clear();
  		DWORD dwBegin = ::GetTickCount();
 @@ -973,12 +978,21 @@ void CQuotesProviderBase::Run()  		case WAIT_OBJECT_0+REFRESH_CONTACT:
  			{
  				DWORD dwTimeRest = ::GetTickCount()-dwBegin;
 -				if(dwTimeRest < nTimeout)
 +				if(INFINITE != nTimeout && dwTimeRest < nTimeout)
 +				{
  					nTimeout -= dwTimeRest;
 +				}
 -				CGuard<CLightMutex> cs(m_cs);
 -				anContacts = m_aRefreshingContacts;
 -				m_aRefreshingContacts.clear();
 +				{
 +					CGuard<CLightMutex> cs(m_cs);
 +					anContacts = m_aRefreshingContacts;
 +					m_aRefreshingContacts.clear();
 +				}
 +
 +				{
 +					CBoolGuard bg(m_bRefreshInProgress);
 +					RefreshQuotes(anContacts);
 +				}
  			}
  			break;
  		case WAIT_TIMEOUT:
 @@ -987,6 +1001,10 @@ void CQuotesProviderBase::Run()  				CGuard<CLightMutex> cs(m_cs);
  				anContacts = m_aContacts;
  			}
 +			{
 +				CBoolGuard bg(m_bRefreshInProgress);
 +				RefreshQuotes(anContacts);
 +			}
  			break;
  		default:
  			assert(!"What is the hell?");
 @@ -1014,48 +1032,60 @@ void CQuotesProviderBase::Accept(CQuotesProviderVisitor& visitor)const  	visitor.Visit(*this);
  }
 -void CQuotesProviderBase::RefreshAll()
 +void CQuotesProviderBase::RefreshSettings()
  {
  	BOOL b = ::SetEvent(m_hEventSettingsChanged);
  	assert(b && "Failed to set event");
  }
 -void CQuotesProviderBase::RefreshContact(MCONTACT hContact)
 +void CQuotesProviderBase::RefreshAllContacts()
  {
  	{// for CCritSection
  		CGuard<CLightMutex> cs(m_cs);
 -		m_aRefreshingContacts.push_back(hContact);
 +		m_aRefreshingContacts.clear();
 +		std::for_each(std::begin(m_aContacts),std::end(m_aContacts),[&](MCONTACT hContact){m_aRefreshingContacts.push_back(hContact);});
  	}
  	BOOL b = ::SetEvent(m_hEventRefreshContact);
  	assert(b && "Failed to set event");
  }
 -void CQuotesProviderBase::SetContactExtraIcon(MCONTACT hContact)const
 +void CQuotesProviderBase::RefreshContact(MCONTACT hContact)
  {
 -// 	tstring s = DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
 -// 	tostringstream o;
 -// 	o << "Request on " << s << " refreshing\nIs online " << IsOnline() << ", is in progress " << m_bRefreshInProgress << "\n";
 -
 -	bool bResult = false;
 -	if(true == IsOnline() && (false == m_bRefreshInProgress))
 -	{
 -		CTendency tendency;
 -		if(tendency.Parse(this,m_sTendencyFormat,hContact) && (false == m_bRefreshInProgress))
 -		{
 -			bResult = do_set_contact_extra_icon(hContact,tendency);
 -		}
 -// 		double dCurrRate = 0.0;
 -// 		double dPrevRate = 0.0;
 -// 		if((true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dCurrRate))
 -// 			&& (true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PREV_VALUE,dPrevRate))
 -// 			&& (false == m_bRefreshInProgress))
 -// 		{
 -// // 			o << "Curr rate = " << dCurrRate << ", prev rate " << dPrevRate << "\n";
 -// 			bResult = do_set_contact_extra_icon(hContact,dCurrRate,dPrevRate);
 -// 		}
 +	{// for CCritSection
 +		CGuard<CLightMutex> cs(m_cs);
 +		m_aRefreshingContacts.push_back(hContact);
  	}
 -// 	o << "Result is " << bResult;
 -// 	LogIt(Info,o.str());
 +	BOOL b = ::SetEvent(m_hEventRefreshContact);
 +	assert(b && "Failed to set event");
  }
 +
 +// void CQuotesProviderBase::SetContactExtraIcon(MCONTACT hContact)const
 +// {
 +// // 	tstring s = DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
 +// // 	tostringstream o;
 +// // 	o << "Request on " << s << " refreshing\nIs online " << IsOnline() << ", is in progress " << m_bRefreshInProgress << "\n";
 +// 
 +// 	bool bResult = false;
 +// 	if(/*true == IsOnline() && */(false == m_bRefreshInProgress))
 +// 	{
 +// 		CTendency tendency;
 +// 		if(tendency.Parse(this,m_sTendencyFormat,hContact) && (false == m_bRefreshInProgress))
 +// 		{
 +// 			bResult = do_set_contact_extra_icon(hContact,tendency);
 +// 		}
 +// // 		double dCurrRate = 0.0;
 +// // 		double dPrevRate = 0.0;
 +// // 		if((true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dCurrRate))
 +// // 			&& (true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PREV_VALUE,dPrevRate))
 +// // 			&& (false == m_bRefreshInProgress))
 +// // 		{
 +// // // 			o << "Curr rate = " << dCurrRate << ", prev rate " << dPrevRate << "\n";
 +// // 			bResult = do_set_contact_extra_icon(hContact,dCurrRate,dPrevRate);
 +// // 		}
 +// 	}
 +// 
 +// // 	o << "Result is " << bResult;
 +// // 	LogIt(Info,o.str());
 +// }
 diff --git a/plugins/Quotes/src/QuotesProviderBase.h b/plugins/Quotes/src/QuotesProviderBase.h index 2be1658c1d..62d551f4b6 100644 --- a/plugins/Quotes/src/QuotesProviderBase.h +++ b/plugins/Quotes/src/QuotesProviderBase.h @@ -69,9 +69,10 @@ public:  	virtual void DeleteContact(MCONTACT hContact);
  	virtual void Run();
  	virtual void Accept(CQuotesProviderVisitor& visitor)const;
 -	virtual void RefreshAll();
 +	virtual void RefreshAllContacts();
 +	virtual void RefreshSettings();
  	virtual void RefreshContact(MCONTACT hContact);
 -	virtual void SetContactExtraIcon(MCONTACT hContact)const;
 +// 	virtual void SetContactExtraIcon(MCONTACT hContact)const;
  protected:
  	const tstring& GetURL()const;
 diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index afdc79c6f5..0be79c498e 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -223,13 +223,13 @@ void CQuotesProviderDukasCopy::RefreshQuotes(TContracts& anContacts)  // 	LogIt(Info,sURL);
  	if(true == http.OpenURL(sURL))
  	{
 -		if(true == IsOnline())
 +// 		if(true == IsOnline())
  		{
  			tstring sHTML;
  			if(true == http.ReadResponce(sHTML))
  			{
  // 				LogIt(Info,sHTML);
 -				if(true == IsOnline())
 +// 				if(true == IsOnline())
  				{
  					TEconomicRates aRates;
  					if(true == parse_HTML(sHTML,aRates)
 diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index b0912dddb5..0b586985ed 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -278,7 +278,7 @@ namespace  							});
 -						pProvider->RefreshAll();
 +						pProvider->RefreshSettings();
  					}
  					return (TRUE);
 diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 907639ff47..3638423424 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -303,7 +303,7 @@ namespace  							std::for_each(aRemove.begin(),aRemove.end(),boost::bind(&CQuotesProviderGoogle::WatchForRate,pProvider,_1,false));
  							std::for_each(aTemp.begin(),aTemp.end(),boost::bind(&CQuotesProviderGoogle::WatchForRate,pProvider,_1,true));
 -							pProvider->RefreshAll();
 +							pProvider->RefreshSettings();
  						}
  					}
  					break;
 diff --git a/plugins/Quotes/src/version.h b/plugins/Quotes/src/version.h index 4ec361f96a..077ac316d5 100644 --- a/plugins/Quotes/src/version.h +++ b/plugins/Quotes/src/version.h @@ -1,6 +1,6 @@  #define __MAJOR_VERSION            0
  #define __MINOR_VERSION            0
 -#define __RELEASE_NUM            25
 +#define __RELEASE_NUM            26
  #define __BUILD_NUM               0
  #include <stdver.h>
 | 
