diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-25 06:36:29 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-25 06:36:29 +0000 |
commit | 1662307100ce7cd803321f5dd9052ce67d037279 (patch) | |
tree | 8c9990338f1e1bbda2909f16c902537e4f400968 /protocols/JabberG/src/jabber_svc.cpp | |
parent | d12d5e2d51b892e5c65168643e63723e8a9739f8 (diff) |
attemt to fix hangup in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@5479 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_svc.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_svc.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index c8a3bedb96..d65d9687bf 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -1011,25 +1011,26 @@ int CJabberNetInterface::AddFeatures(LPCTSTR szFeatures) if ( !szFeatures)
return false;
- 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;
+ 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
- fcp = FindFeature(szFeat); // update fcp after RegisterFeature()
+ ret = false;
+ szFeat += lstrlen(szFeat) + 1;
}
- 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);
@@ -1042,19 +1043,20 @@ int CJabberNetInterface::RemoveFeatures(LPCTSTR szFeatures) if ( !szFeatures)
return false;
- 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
+ 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
- szFeat += lstrlen(szFeat) + 1;
+ szFeat += lstrlen(szFeat) + 1;
+ }
}
- lck.unlock();
if (m_psProto->m_bJabberOnline)
m_psProto->SendPresence(m_psProto->m_iStatus, true);
@@ -1068,7 +1070,7 @@ LPTSTR CJabberNetInterface::GetResourceFeatures(LPCTSTR jid) if (jcb & JABBER_RESOURCE_CAPS_ERROR)
return NULL;
- mir_cslockfull lck(m_psProto->m_csLists);
+ mir_cslock 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
|