From b542ecadc35c7613abecf807963785f16a73711e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Mar 2024 18:15:47 +0300 Subject: =?UTF-8?q?fixes=20#4281=20(Weather:=20=D0=BD=D0=B5=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D1=91=D1=82=D1=81=D1=8F=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B3=D0=BE=D0=B4=D1=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir_app/src/clui.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 3a4ee46c8b..e168c53cf1 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -135,7 +135,8 @@ class CDeleteDlg : public CDlgBase public: char *szProto; - bool bDelContact, bDelHistory, bForEveryone; + bool bDelContact = true, bDelHistory = false, bForEveryone = false; + bool bHasServer, bHasHistory; CDeleteDlg(MCONTACT hContact) : CDlgBase(g_plugin, IDD_DELETECONTACT), @@ -145,17 +146,18 @@ public: chkForEveryone(this, IDC_BOTH) { szProto = Proto_GetBaseAccountName(hContact); - bDelContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1) & PF1_SERVERCLIST) != 0; - bDelHistory = ProtoServiceExists(szProto, PS_EMPTY_SRV_HISTORY); + bHasServer = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1) & PF1_SERVERCLIST) != 0; + bHasHistory = ProtoServiceExists(szProto, PS_EMPTY_SRV_HISTORY); bForEveryone = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4) & PF4_DELETEFORALL) != 0; } bool OnInitDialog() override { - chkDelContact.SetState(bDelContact); + chkDelContact.SetState(bHasServer); + chkDelContact.Enable(bHasServer); chkDelHistory.SetState(false); - chkDelHistory.Enable(bDelHistory); + chkDelHistory.Enable(bHasHistory); // this checkbox is disabled & checked, if deletion for everyone is not possible // and enabled & unchecked otherwise @@ -219,15 +221,19 @@ static INT_PTR MenuItem_DeleteContact(WPARAM hContact, LPARAM lParam) options |= CDF_FOR_EVERYONE; // Check if protocol uses server side lists - int status = Proto_GetStatus(dlg.szProto); - if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) { - // Set a flag so we remember to delete the contact when the protocol goes online the next time - db_set_b(hContact, "CList", "Delete", options); - MessageBoxW(nullptr, - TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), - TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK); + if (dlg.bHasServer) { + int status = Proto_GetStatus(dlg.szProto); + if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) { + // Set a flag so we remember to delete the contact when the protocol goes online the next time + db_set_b(hContact, "CList", "Delete", options); + MessageBoxW(nullptr, + TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), + TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK); + return 0; + } } - else db_delete_contact(hContact, options); + + db_delete_contact(hContact, options); return 0; } -- cgit v1.2.3