summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
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);
}
}