summaryrefslogtreecommitdiff
path: root/plugins/New_GPG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-06-23 18:51:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-06-23 18:51:19 +0300
commit74d117e4355b71d7a5660c5b9b67d24df8bfa4c7 (patch)
tree90e78f7cfb328d00d74810403b1f3aaf8f17d29a /plugins/New_GPG
parentc7f6afe4b2f0dd41d7a97ea26075398bf7bd1843 (diff)
New_GPG: also a fix for menu items
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-xplugins/New_GPG/src/globals.h1
-rwxr-xr-xplugins/New_GPG/src/init.cpp6
-rwxr-xr-xplugins/New_GPG/src/stdafx.h1
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp12
4 files changed, 9 insertions, 11 deletions
diff --git a/plugins/New_GPG/src/globals.h b/plugins/New_GPG/src/globals.h
index 96d6a81c1d..63756f59a5 100755
--- a/plugins/New_GPG/src/globals.h
+++ b/plugins/New_GPG/src/globals.h
@@ -30,7 +30,6 @@ struct globals_s
wchar_t key_id_global[17] = { 0 };
list <JabberAccount*> Accounts;
HFONT bold_font = nullptr;
- HGENMENU hSendKey = nullptr, hToggleEncryption = nullptr;
logtofile debuglog;
bool gpg_valid = false, gpg_keyexist = false;
std::map<MCONTACT, contact_data> hcontact_data;
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 1473f85550..92fb488608 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -182,14 +182,14 @@ int CMPlugin::Load()
mi.position = -0x7FFFFFFe;
mi.name.a = LPGEN("Toggle GPG encryption");
mi.pszService = "/ToggleEncryption";
- globals.hToggleEncryption = Menu_AddContactMenuItem(&mi);
+ g_plugin.hToggleEncryption = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, ToggleEncryption);
SET_UID(mi, 0x42bb535f, 0xd58e, 0x4edb, 0xbf, 0x2c, 0xfa, 0x9a, 0xbf, 0x1e, 0xb8, 0x69);
mi.position = -0x7FFFFFFd;
mi.name.a = LPGEN("Send public key");
mi.pszService = "/SendKey";
- globals.hSendKey = Menu_AddContactMenuItem(&mi);
+ g_plugin.hSendKey = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, SendKey);
////////////////////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@ int CMPlugin::Load()
hCLIcon = ExtraIcon_RegisterIcolib(MODULENAME, Translate("GPG encryption status"), "secured", &onExtraIconPressed);
for (auto &cc : Contacts())
if (isContactHaveKey(cc))
- ExtraIcon_SetIconByName(hCLIcon, cc, "unsecured");
+ setSrmmIcon(cc);
return 0;
}
diff --git a/plugins/New_GPG/src/stdafx.h b/plugins/New_GPG/src/stdafx.h
index 1df8b1518e..3a0f1cdb22 100755
--- a/plugins/New_GPG/src/stdafx.h
+++ b/plugins/New_GPG/src/stdafx.h
@@ -75,6 +75,7 @@ struct CMPlugin : public PLUGIN<CMPlugin>
{
CMOption<bool> bJabberAPI, bPresenceSigning, bFileTransfers, bAutoExchange, bSameAction, bAppendTags, bStripTags, bDebugLog, bSendErrorMessages;
HANDLE hCLIcon = nullptr;
+ HGENMENU hToggleEncryption = nullptr, hSendKey = nullptr;
CMPlugin();
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index bcfd9205ef..b9b23a8dc1 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -156,8 +156,6 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM)
g_plugin.setByte(hContact, "GPGEncryption", enc ? 0 : 1);
}
setSrmmIcon(hContact);
-
- Menu_ModifyItem(globals.hToggleEncryption, enc ? LPGENW("Turn off GPG encryption") : LPGENW("Turn on GPG encryption"));
return 0;
}
@@ -180,7 +178,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM)
wchar_t buf[128] = { 0 };
mir_snwprintf(buf, L"%s: %S", TranslateT("Send public key"), keyid.c_str());
- Menu_ModifyItem(globals.hSendKey, buf);
+ Menu_ModifyItem(g_plugin.hSendKey, buf);
}
int flags;
@@ -191,13 +189,13 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM)
}
else flags = 0;
- Menu_ModifyItem(globals.hToggleEncryption,
- g_plugin.getByte(hContact, "GPGEncryption", 0) ? L"Turn off GPG encryption" : L"Turn on GPG encryption",
- INVALID_HANDLE_VALUE, flags);
+ if (g_plugin.getByte(hContact, "GPGEncryption"))
+ Menu_ModifyItem(g_plugin.hToggleEncryption, LPGENW("Turn off GPG encryption"), g_plugin.getIconHandle(IDI_SECURED), flags);
+ else
+ Menu_ModifyItem(g_plugin.hToggleEncryption, LPGENW("Turn on GPG encryption"), g_plugin.getIconHandle(IDI_UNSECURED), flags);
return 0;
}
-
list<wstring> transfers;
int onProtoAck(WPARAM, LPARAM l)