summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_rc.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_rc.h')
-rw-r--r--protocols/JabberG/src/jabber_rc.h34
1 files changed, 12 insertions, 22 deletions
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h
index 526598a5d6..806b42839f 100644
--- a/protocols/JabberG/src/jabber_rc.h
+++ b/protocols/JabberG/src/jabber_rc.h
@@ -163,7 +163,7 @@ protected:
CJabberProto *m_pProto;
CJabberAdhocNode* m_pNodes;
CJabberAdhocSession* m_pSessions;
- CRITICAL_SECTION m_cs;
+ mir_cs m_cs;
CJabberAdhocSession* FindSession(const TCHAR *szSession)
{
@@ -253,26 +253,16 @@ protected:
public:
CJabberAdhocManager(CJabberProto* pProto)
{
- ZeroMemory(this, sizeof(CJabberAdhocManager));
m_pProto = pProto;
- InitializeCriticalSection(&m_cs);
+ m_pNodes = NULL;
+ m_pSessions = NULL;
}
~CJabberAdhocManager()
{
- if (m_pNodes)
- delete m_pNodes;
- if (m_pSessions)
- delete m_pSessions;
- DeleteCriticalSection(&m_cs);
- }
- void Lock()
- {
- EnterCriticalSection(&m_cs);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_cs);
+ delete m_pNodes;
+ delete m_pSessions;
}
+
BOOL FillDefaultNodes();
BOOL AddNode(TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler)
{
@@ -280,7 +270,7 @@ public:
if (!pNode)
return FALSE;
- Lock();
+ mir_cslock lck(m_cs);
if (!m_pNodes)
m_pNodes = pNode;
else {
@@ -289,24 +279,24 @@ public:
pTmp = pTmp->GetNext();
pTmp->SetNext(pNode);
}
- Unlock();
-
return TRUE;
}
+
CJabberAdhocNode* GetFirstNode()
{
return m_pNodes;
}
+
BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
BOOL ExpireSessions()
{
- Lock();
+ mir_cslock lck(m_cs);
DWORD dwExpireTime = GetTickCount() - JABBER_ADHOC_SESSION_EXPIRE_TIME;
- while (_ExpireSession(dwExpireTime));
- Unlock();
+ while (_ExpireSession(dwExpireTime))
+ ;
return TRUE;
}
};