summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_caps.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-18 14:32:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-18 14:32:44 +0000
commit9a10fa95b91ae9e77ba0b0601374fe1abf7782ba (patch)
treedda025f3b39dd572550a511edf067d2b98946f31 /protocols/JabberG/src/jabber_caps.cpp
parent3acd84bf6889f8fe2086eda619a0175d88e05a56 (diff)
CRITICAL_SECTION removed from Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@10229 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_caps.cpp')
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 4dde4c8864..ad8fad2425 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -520,7 +520,6 @@ BOOL CJabberClientCaps::SetPartialCaps(int nIqId, JabberCapsBits jcbCaps)
CJabberClientCapsManager::CJabberClientCapsManager(CJabberProto* proto)
{
ppro = proto;
- InitializeCriticalSection(&m_cs);
m_pClients = NULL;
}
@@ -528,7 +527,6 @@ CJabberClientCapsManager::~CJabberClientCapsManager()
{
if (m_pClients)
delete m_pClients;
- DeleteCriticalSection(&m_cs);
}
CJabberClientCaps * CJabberClientCapsManager::FindClient(const TCHAR *szNode)
@@ -556,45 +554,43 @@ void CJabberClientCapsManager::AddDefaultCaps()
JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szVer)
{
- Lock();
+ mir_cslockfull lck(m_cs);
CJabberClientCaps *pClient = FindClient(szNode);
if (!pClient) {
- Unlock();
+ lck.unlock();
ppro->debugLog(_T("CAPS: get no caps for: %s, %s"), szNode, szVer);
return JABBER_RESOURCE_CAPS_UNINIT;
}
JabberCapsBits jcbCaps = pClient->GetPartialCaps(szVer);
- Unlock();
+ lck.unlock();
ppro->debugLog(_T("CAPS: get caps %I64x for: %s, %s"), jcbCaps, szNode, szVer);
return jcbCaps;
}
BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
{
- Lock();
+ mir_cslockfull lck(m_cs);
CJabberClientCaps *pClient = FindClient(szNode);
if (!pClient) {
pClient = new CJabberClientCaps(szNode);
- if (!pClient) {
- Unlock();
+ if (!pClient)
return FALSE;
- }
+
pClient->SetNext(m_pClients);
m_pClients = pClient;
}
BOOL bOk = pClient->SetPartialCaps(szVer, jcbCaps, nIqId);
- Unlock();
+ lck.unlock();
ppro->debugLog(_T("CAPS: set caps %I64x for: %s, %s"), jcbCaps, szNode, szVer);
return bOk;
}
BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
{
- Lock();
- if (!m_pClients) {
- Unlock();
+ mir_cslock lck(m_cs);
+ if (!m_pClients)
return FALSE;
- }
+
BOOL bOk = FALSE;
CJabberClientCaps *pClient = m_pClients;
while (pClient) {
@@ -605,7 +601,6 @@ BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
}
pClient = pClient->GetNext();
}
- Unlock();
return bOk;
}