summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_svc.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-26 17:33:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-26 17:33:51 +0000
commitda6b6d88e3fb3e28959f82969665880a5d90993b (patch)
tree6b7a1da48c8d781b78e382cd1dd691295e056065 /protocols/JabberG/src/jabber_svc.cpp
parenta8715e36ca4c5c757afcac6c86cf00a6965dd476 (diff)
- real fix for hangups in Jabber;
- rollback of mir_cslockfull removal git-svn-id: http://svn.miranda-ng.org/main/trunk@5493 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_svc.cpp')
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp58
1 files changed, 28 insertions, 30 deletions
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index d65d9687bf..c8a3bedb96 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -1011,26 +1011,25 @@ int CJabberNetInterface::AddFeatures(LPCTSTR szFeatures)
if ( !szFeatures)
return false;
- bool ret = true;
- {
- mir_cslock lck(m_psProto->m_csLists);
- LPCTSTR szFeat = szFeatures;
- while (szFeat[0]) {
- JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
- // if someone is trying to add one of core features, RegisterFeature() will return false, so we don't have to perform this check here
- if ( !fcp) { // if the feature is not registered yet
- if ( !RegisterFeature(szFeat, NULL))
- ret = false;
- else
- fcp = FindFeature(szFeat); // update fcp after RegisterFeature()
- }
- if (fcp)
- m_psProto->m_uEnabledFeatCapsDynamic |= fcp->jcbCap;
- else
+ mir_cslockfull lck(m_psProto->m_csLists);
+ BOOL ret = true;
+ LPCTSTR szFeat = szFeatures;
+ while (szFeat[0]) {
+ JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
+ // if someone is trying to add one of core features, RegisterFeature() will return false, so we don't have to perform this check here
+ if ( !fcp) { // if the feature is not registered yet
+ if ( !RegisterFeature(szFeat, NULL))
ret = false;
- szFeat += lstrlen(szFeat) + 1;
+ else
+ fcp = FindFeature(szFeat); // update fcp after RegisterFeature()
}
+ if (fcp)
+ m_psProto->m_uEnabledFeatCapsDynamic |= fcp->jcbCap;
+ else
+ ret = false;
+ szFeat += lstrlen(szFeat) + 1;
}
+ lck.unlock();
if (m_psProto->m_bJabberOnline)
m_psProto->SendPresence(m_psProto->m_iStatus, true);
@@ -1043,20 +1042,19 @@ int CJabberNetInterface::RemoveFeatures(LPCTSTR szFeatures)
if ( !szFeatures)
return false;
- bool ret = true;
- {
- mir_cslock lck(m_psProto->m_csLists);
- LPCTSTR szFeat = szFeatures;
- while (szFeat[0]) {
- JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
- if (fcp)
- m_psProto->m_uEnabledFeatCapsDynamic &= ~fcp->jcbCap;
- else
- ret = false; // indicate that there was an error removing at least one of the specified features
+ mir_cslockfull lck(m_psProto->m_csLists);
+ BOOL ret = true;
+ LPCTSTR szFeat = szFeatures;
+ while (szFeat[0]) {
+ JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
+ if (fcp)
+ m_psProto->m_uEnabledFeatCapsDynamic &= ~fcp->jcbCap;
+ else
+ ret = false; // indicate that there was an error removing at least one of the specified features
- szFeat += lstrlen(szFeat) + 1;
- }
+ szFeat += lstrlen(szFeat) + 1;
}
+ lck.unlock();
if (m_psProto->m_bJabberOnline)
m_psProto->SendPresence(m_psProto->m_iStatus, true);
@@ -1070,7 +1068,7 @@ LPTSTR CJabberNetInterface::GetResourceFeatures(LPCTSTR jid)
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
return NULL;
- mir_cslock lck(m_psProto->m_csLists);
+ mir_cslockfull lck(m_psProto->m_csLists);
int i;
int iLen = 1; // 1 for extra zero terminator at the end of the string
// calculate total necessary string length