summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_menus.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-12-21 16:08:58 +0300
committeraunsane <aunsane@gmail.com>2017-12-21 16:09:15 +0300
commit70c13e5c4475aedd296c51e68070e85096eb4f39 (patch)
tree83ed7d0e4bf25d25babfd7fdfe741e9e457f6c6d /protocols/Tox/src/tox_menus.cpp
parentf4184ffdc42c7a1753a77ea8087f5f16635ac942 (diff)
Tox: improved profile encription management
Diffstat (limited to 'protocols/Tox/src/tox_menus.cpp')
-rw-r--r--protocols/Tox/src/tox_menus.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index ffa47b8621..34b3047fb4 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -61,7 +61,17 @@ void CToxProto::InitContactMenu()
int CToxProto::PrebuildStatusMenu(WPARAM, LPARAM)
{
bool isOnline = IsOnline();
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD], isOnline);
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_CREATE], isOnline);
Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_CHANGE], isOnline);
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_REMOVE], isOnline);
+
+ pass_ptrW password(getWStringA(TOX_SETTINGS_PASSWORD));
+ bool passwordExists = mir_wstrlen(password) > 0;
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_CREATE], !passwordExists);
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_CHANGE], passwordExists);
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_REMOVE], passwordExists);
+
return 0;
}
@@ -80,12 +90,32 @@ int CToxProto::OnInitStatusMenu()
mi.position = SMI_POSITION + SMI_TOXID_COPY;
StatusMenuItems[SMI_TOXID_COPY] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ // Password
+ mi.pszService = nullptr;
+ mi.name.w = LPGENW("Password");
+ StatusMenuItems[SMI_PASSWORD] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ mi.root = StatusMenuItems[SMI_PASSWORD];
+
+ // Create password command
+ mi.pszService = "/CreatePassword";
+ CreateProtoService(mi.pszService, &CToxProto::OnCreatePassword);
+ mi.name.w = LPGENW("Create password");
+ mi.position = SMI_PASSWORD_CREATE;
+ StatusMenuItems[SMI_PASSWORD_CREATE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
// Change password command
mi.pszService = "/ChangePassword";
CreateProtoService(mi.pszService, &CToxProto::OnChangePassword);
mi.name.w = LPGENW("Change password");
- mi.position = SMI_POSITION + SMI_PASSWORD_CHANGE;
+ mi.position = SMI_PASSWORD_CHANGE;
StatusMenuItems[SMI_PASSWORD_CHANGE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ // Remove password command
+ mi.pszService = "/RemovePassword";
+ CreateProtoService(mi.pszService, &CToxProto::OnRemovePassword);
+ mi.name.w = LPGENW("Remove password");
+ mi.position = SMI_PASSWORD_REMOVE;
+ StatusMenuItems[SMI_PASSWORD_REMOVE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
return 0;
}