diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-27 12:54:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-27 12:54:43 +0000 |
commit | 3234474db8b36b1a644d8686c5a54d261748769f (patch) | |
tree | b01f6af0e7bca040d9b1b1fba66db2564a940217 /protocols/JabberG/src | |
parent | d8be737e63c38f6a3a293158351b1fa4d62ecba6 (diff) |
fix for the protocols' menus
git-svn-id: http://svn.miranda-ng.org/main/trunk@14411 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_menu.cpp | 85 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 16 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xstatus.cpp | 4 |
3 files changed, 51 insertions, 54 deletions
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 7124ed79bd..4c2091eb02 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -577,15 +577,9 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) void CJabberProto::MenuInit()
{
- char text[200];
- strncpy(text, m_szModuleName, sizeof(text) - 1);
- char* tDest = text + mir_strlen(text);
-
- CLISTMENUITEM mi = { 0 };
- mi.pszService = text;
-
HGENMENU hJabberRoot = Menu_GetProtocolRoot(m_szModuleName);
if (hJabberRoot == NULL) {
+ CLISTMENUITEM mi = { 0 };
mi.name.t = m_tszUserName;
mi.position = -1999901006;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
@@ -593,95 +587,97 @@ void CJabberProto::MenuInit() hJabberRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if (m_hMenuRoot)
+ if (m_hMenuRoot) {
Menu_RemoveItem(m_hMenuRoot);
- m_hMenuRoot = NULL;
+ m_hMenuRoot = NULL;
+ }
}
- // "Bookmarks..."
- CreateProtoService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks);
- mir_strcpy(tDest, "/Bookmarks");
- mi.flags = 0;
+ CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hJabberRoot;
+
+ // "Bookmarks..."
+ mi.pszService = "/Bookmarks";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleBookmarks);
mi.name.a = LPGEN("Bookmarks");
mi.position = 200001;
mi.icolibItem = GetIconHandle(IDI_BOOKMARKS);
- m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi);
+ m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Services..."
+ mi.pszService = NULL;
mi.name.a = LPGEN("Services...");
- mir_strcpy(tDest, "/Services");
mi.position = 200003;
mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
- HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi);
+ HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Service Discovery..."
- CreateProtoService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery);
- mir_strcpy(tDest, "/ServiceDiscovery");
+ mi.hParentMenu = hMenuServicesRoot;
+ mi.pszService = "/ServiceDiscovery";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscovery);
mi.name.a = LPGEN("Service Discovery");
mi.position = 2000050001;
mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
- mi.hParentMenu = hMenuServicesRoot;
- m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi);
+ m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/MyTransports", &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
- mir_strcpy(tDest, "/SD/MyTransports");
+ mi.pszService = "/SD/MyTransports";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
mi.name.a = LPGEN("Registered Transports");
mi.position = 2000050003;
mi.icolibItem = GetIconHandle(IDI_TRANSPORTL);
- m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/Transports", &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
- mir_strcpy(tDest, "/SD/Transports");
+ mi.pszService = "/SD/Transports";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
mi.name.a = LPGEN("Local Server Transports");
mi.position = 2000050004;
mi.icolibItem = GetIconHandle(IDI_TRANSPORT);
- m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/SD/Conferences", &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
- mir_strcpy(tDest, "/SD/Conferences");
+ mi.pszService = "/SD/Conferences";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
mi.name.a = LPGEN("Browse chatrooms");
mi.position = 2000050005;
mi.icolibItem = GetIconHandle(IDI_GROUP);
- m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi);
+ m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/Groupchat", &CJabberProto::OnMenuHandleJoinGroupchat);
- mir_strcpy(tDest, "/Groupchat");
+ mi.pszService = "/Groupchat";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleJoinGroupchat);
mi.name.a = LPGEN("Create/Join group chat");
mi.position = 2000050006;
mi.icolibItem = GetIconHandle(IDI_GROUP);
- m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi);
+ m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Change Password..."
- CreateProtoService("/ChangePassword", &CJabberProto::OnMenuHandleChangePassword);
- mir_strcpy(tDest, "/ChangePassword");
+ mi.pszService = "/ChangePassword";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleChangePassword);
mi.name.a = LPGEN("Change Password");
mi.position = 2000050007;
mi.icolibItem = GetIconHandle(IDI_KEYS);
- m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi);
+ m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "Roster editor"
- CreateProtoService("/RosterEditor", &CJabberProto::OnMenuHandleRosterControl);
- mir_strcpy(tDest, "/RosterEditor");
+ mi.pszService = "/RosterEditor";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleRosterControl);
mi.name.a = LPGEN("Roster editor");
mi.position = 2000050009;
mi.icolibItem = GetIconHandle(IDI_AGENTS);
- m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi);
+ m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// "XML Console"
- CreateProtoService("/XMLConsole", &CJabberProto::OnMenuHandleConsole);
- mir_strcpy(tDest, "/XMLConsole");
+ mi.pszService = "/XMLConsole";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleConsole);
mi.name.a = LPGEN("XML Console");
mi.position = 2000050010;
mi.icolibItem = GetIconHandle(IDI_CONSOLE);
- Menu_AddProtoMenuItem(&mi);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
- CreateProtoService("/Notes", &CJabberProto::OnMenuHandleNotes);
- mir_strcpy(tDest, "/Notes");
+ mi.pszService = "/Notes";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleNotes);
mi.name.a = LPGEN("Notes");
mi.position = 2000050011;
mi.icolibItem = GetIconHandle(IDI_NOTES);
- m_hMenuNotes = Menu_AddProtoMenuItem(&mi);
+ m_hMenuNotes = Menu_AddProtoMenuItem(&mi, m_szModuleName);
BuildPrivacyMenu();
if (m_menuItemsStatus)
@@ -693,6 +689,7 @@ void CJabberProto::MenuInit() m_priorityMenuVal = 0;
m_priorityMenuValSet = false;
+ mi.pszService = NULL;
mi.position = 200006;
mi.hParentMenu = hJabberRoot;
mi.name.a = LPGEN("Resource priority");
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 27b686607f..48b3900a8d 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2098,8 +2098,8 @@ void CJabberProto::BuildPrivacyMenu() mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName);
m_hPrivacyMenuRoot = Menu_AddProtoMenuItem(&mi);
- CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
mi.pszService = "/PrivacyLists";
+ CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandlePrivacyLists);
mi.position = 3000040000;
mi.flags = CMIF_TCHAR;
mi.icolibItem = GetIconHandle(IDI_PRIVACY_LISTS);
@@ -2118,7 +2118,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mir_cslock lck(m_privacyListManager.m_cs);
- char srvFce[MAX_PATH + 64], *svcName = srvFce + mir_strlen(m_szModuleName);
+ char srvFce[MAX_PATH + 64];
CLISTMENUITEM mi = { 0 };
mi.position = 2000040000;
@@ -2127,22 +2127,22 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.pszService = srvFce;
int i = 0;
- mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "/menuPrivacy%d", i);
if (i > m_privacyMenuServiceAllocated) {
- CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateProtoServiceParam(srvFce, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
mi.position++;
mi.icolibItem = Skin_GetIconHandle(m_privacyListManager.GetActiveListName() ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
mi.name.t = LPGENT("<none>");
- m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi));
+ m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
i++;
- mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "/menuPrivacy%d", i);
if (i > m_privacyMenuServiceAllocated) {
- CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
+ CreateProtoServiceParam(srvFce, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
}
@@ -2150,6 +2150,6 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.icolibItem = Skin_GetIconHandle(
mir_tstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
mi.name.t = pList->GetListName();
- m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi));
+ m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
}
}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 7e1cd47ed0..93aad6d7e3 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -463,7 +463,7 @@ void CPepGuiService::RebuildMenu() return;
char szService[128];
- mir_snprintf(szService, "%s/AdvStatusSet/%s", m_proto->m_szModuleName, m_name);
+ mir_snprintf(szService, "/AdvStatusSet/%s", m_name);
CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hJabberRoot;
@@ -472,7 +472,7 @@ void CPepGuiService::RebuildMenu() mi.flags = CMIF_TCHAR | CMIF_HIDDEN;
mi.icolibItem = m_hIcolibItem;
mi.name.t = m_szText ? m_szText : _T("<advanced status slot>");
- m_hMenuItem = Menu_AddProtoMenuItem(&mi);
+ m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName);
}
bool CPepGuiService::LaunchSetGui(BYTE bQuiet)
|