diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-10 22:02:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-10 22:02:52 +0300 |
commit | 210acddc8bc8d48c7a3d71c09db0eed3f5a9c2b0 (patch) | |
tree | 2a1041f133ed8884f7f979ea085482f245bd85fc /protocols/JabberG | |
parent | a5f518e4cbfd3b47c62d2ef5b524ae1252af9e35 (diff) |
fixes #2438 (Jabber: списки приватности странно себя ведут) + some another DoModal() calls cleaning
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 5c9cfb9eff..9a415c336c 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -1666,8 +1666,7 @@ public: CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList && pRule) {
CJabberDlgPrivacyRule dlgPrivacyRule(m_proto, m_hwnd, pRule);
- int nResult = dlgPrivacyRule.DoModal();
- if (nResult) {
+ if (dlgPrivacyRule.DoModal()) {
pList->SetModified();
::PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
@@ -1683,8 +1682,7 @@ public: if (pList) {
CPrivacyListRule* pRule = new CPrivacyListRule(m_proto, Jid, "", FALSE);
CJabberDlgPrivacyRule dlgPrivacyRule(m_proto, m_hwnd, pRule);
- int nResult = dlgPrivacyRule.DoModal();
- if (nResult) {
+ if (dlgPrivacyRule.DoModal()) {
pList->AddRule(pRule);
pList->Reorder();
pList->SetModified();
@@ -1752,35 +1750,36 @@ public: // FIXME: line length is hard coded in dialog procedure
CJabberDlgPrivacyAddList dlgPrivacyAddList(m_proto, m_hwnd);
int nRetVal = dlgPrivacyAddList.DoModal();
- if (nRetVal && mir_strlen(dlgPrivacyAddList.szLine)) {
- mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
-
- CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
- if (pList == nullptr) {
- m_proto->m_privacyListManager.AddList(dlgPrivacyAddList.szLine);
- pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
- if (pList) {
- pList->SetModified(TRUE);
- pList->SetLoaded(TRUE);
- }
- }
- if (pList)
- pList->SetDeleted(FALSE);
- int nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)dlgPrivacyAddList.szLine);
- if (nSelected == CB_ERR) {
- nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_ADDSTRING, 0, (LPARAM)dlgPrivacyAddList.szLine);
- SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETITEMDATA, nSelected, (LPARAM)pList);
- SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETCURSEL, nSelected, 0);
+ if (!nRetVal || !mir_strlen(dlgPrivacyAddList.szLine))
+ return;
+
+ mir_cslock lck(m_proto->m_privacyListManager.m_cs);
+
+ CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
+ if (pList == nullptr) {
+ m_proto->m_privacyListManager.AddList(dlgPrivacyAddList.szLine);
+ pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
+ if (pList) {
+ pList->SetModified(TRUE);
+ pList->SetLoaded(TRUE);
}
+ }
+ if (pList)
+ pList->SetDeleted(FALSE);
- lck.unlock();
- PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
+ int nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)dlgPrivacyAddList.szLine);
+ if (nSelected == CB_ERR) {
+ nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_ADDSTRING, 0, (LPARAM)dlgPrivacyAddList.szLine);
+ SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETITEMDATA, nSelected, (LPARAM)pList);
+ SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETCURSEL, nSelected, 0);
}
+
+ PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
void btnRemoveList_OnClick(CCtrlButton*)
{
- mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
+ mir_cslock lck(m_proto->m_privacyListManager.m_cs);
CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList) {
@@ -1795,7 +1794,6 @@ public: pList->SetModified();
}
- lck.unlock();
PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
|