summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/QuotesProviderBase.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 14:42:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 14:42:51 +0000
commit33953cc6a0fab6a91af293c6838f8a46dd7922da (patch)
tree2dbbe718ad42545bde6c9f7672387827c530550a /plugins/Quotes/src/QuotesProviderBase.cpp
parente190a7fde521bd6af9ea485cc730f854aaf38e11 (diff)
HCONTACT, part 3
git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes/src/QuotesProviderBase.cpp')
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index b017c7c162..462154c478 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -827,24 +827,19 @@ void CQuotesProviderBase::WriteContactRate(HCONTACT hContact,double dRate,const
HCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(CallService(MS_DB_CONTACT_ADD,0,0));
- if(hContact)
- {
- if(0 == CallService(MS_PROTO_ADDTOCONTACT,reinterpret_cast<WPARAM>(hContact),(LPARAM)QUOTES_PROTOCOL_NAME))
- {
+ HCONTACT hContact = HCONTACT(CallService(MS_DB_CONTACT_ADD,0,0));
+ if(hContact) {
+ if(0 == CallService(MS_PROTO_ADDTOCONTACT, WPARAM(hContact), (LPARAM)QUOTES_PROTOCOL_NAME)) {
tstring sProvName = GetInfo().m_sName;
db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PROVIDER,sProvName.c_str());
db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL,rsName.c_str());
db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,rsName.c_str());
- {// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
- m_aContacts.push_back(hContact);
- }
+ CGuard<CLightMutex> cs(m_cs);
+ m_aContacts.push_back(hContact);
}
- else
- {
- CallService(MS_DB_CONTACT_DELETE,reinterpret_cast<WPARAM>(hContact),0);
+ else {
+ CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
hContact = NULL;
}
}
@@ -979,14 +974,11 @@ void CQuotesProviderBase::Run()
{
DWORD dwTimeRest = ::GetTickCount()-dwBegin;
if(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();
}
break;
case WAIT_TIMEOUT: