summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-30 20:27:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-30 20:27:23 +0000
commita8c93cfbf235c31cf604cb6bd40009e9bf88f36a (patch)
tree0eaf9592ee3cd752e8f2d0273132de0004aa1f6e /src/mir_app
parent6b893bc94df93321a216ba62c3d56a6e08086e36 (diff)
- fix for the old perversion with manual protocol root calculation;
- protocol menu root is always created by the core; - other minor problems with protocol menus in main menu went away git-svn-id: http://svn.miranda-ng.org/main/trunk@14462 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/genmenu.cpp23
-rw-r--r--src/mir_app/src/proto_opts.cpp6
2 files changed, 21 insertions, 8 deletions
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp
index 4821c15d84..758d3c8b5e 100644
--- a/src/mir_app/src/genmenu.cpp
+++ b/src/mir_app/src/genmenu.cpp
@@ -225,13 +225,18 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(const char *szProto)
+MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis)
{
- if (szProto == NULL)
+ if (pThis == NULL)
return 0;
- if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
- return cli.pfnGetProtocolMenu(szProto);
+ if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) {
+ if (pThis->m_hMainMenuItem != NULL) {
+ Menu_RemoveItem(pThis->m_hMainMenuItem);
+ pThis->m_hMainMenuItem = NULL;
+ }
+ return cli.pfnGetProtocolMenu(pThis->m_szModuleName);
+ }
TIntMenuObject *pmo = GetMenuObjbyId(hMainMenuObject);
if (pmo == NULL)
@@ -239,10 +244,16 @@ MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(const char *szProto)
mir_cslock lck(csMenuHook);
for (TMO_IntMenuItem *p = pmo->m_items.first; p != NULL; p = p->next)
- if (!mir_strcmp(p->UniqName, szProto))
+ if (!mir_strcmp(p->UniqName, pThis->m_szModuleName))
return p;
- return NULL;
+ // create protocol root in the main menu
+ CMenuItem mi;
+ mi.name.t = pThis->m_tszUserName;
+ mi.position = 500090000;
+ mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
+ mi.hIcolibItem = pThis->m_hProtoIcon;
+ return pThis->m_hMainMenuItem = Menu_AddMainMenuItem(&mi);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index d4f29726c7..151a3c2ff8 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -1034,9 +1034,11 @@ static int OnAccListChanged(WPARAM eventCode, LPARAM lParam)
switch (eventCode) {
case PRAC_CHANGED:
if (pa->ppro) {
- mir_free(pa->ppro->m_tszUserName);
- pa->ppro->m_tszUserName = mir_tstrdup(pa->tszAccountName);
+ replaceStrT(pa->ppro->m_tszUserName, pa->tszAccountName);
pa->ppro->OnEvent(EV_PROTO_ONRENAME, 0, lParam);
+
+ if (pa->ppro->m_hMainMenuItem)
+ Menu_ModifyItem(pa->ppro->m_hMainMenuItem, pa->tszAccountName);
}
}