diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-13 18:15:47 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-13 18:15:51 +0300 |
commit | b542ecadc35c7613abecf807963785f16a73711e (patch) | |
tree | 5865291e4c4ad6ac7ef35bc5a642cb9bed10a1c0 /src | |
parent | ea1f5ff1b4126eba62958443f081c07c5f1cfbcc (diff) |
fixes #4281 (Weather: не удаётся удалить контакт погоды)
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clui.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
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;
}
|