From e84bafdd3f3d2eb67e10a9bd3fbe600748962b6f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 Mar 2017 15:38:17 +0300 Subject: revolution in chat menus - common code moved to the core (Chat_CreateGCMenu, Chat_DestroyGCMenu); - ability added to any plugin to add its own items into any GC menu, not only to the protocol plugins to do that a plugin calls Chat_AddMenuItems and returns 0 to allow any other plugin to process menu hook --- protocols/MSN/src/msn_chat.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'protocols/MSN/src') diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index f46ca005ca..e276f165a5 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -574,8 +574,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE }, { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE } }; - gcmi->nItems = _countof(Items); - gcmi->Item = (gc_item*)Items; + Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items); } else if (gcmi->Type == MENU_ON_NICKLIST) { char *email = mir_u2a(gcmi->pszUID); @@ -587,8 +586,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { L"", 100, MENU_SEPARATOR, FALSE }, { LPGENW("&Leave chat session"), 110, MENU_ITEM, FALSE } }; - gcmi->nItems = _countof(Items); - gcmi->Item = (gc_item*)Items; + Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items); } else { static struct gc_item Items[] = @@ -608,8 +606,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (pszRole && !mir_wstrcmpi(pszRole, L"admin")) Items[3].pszDesc = LPGENW("&Deop user"); } - gcmi->nItems = _countof(Items); - gcmi->Item = (gc_item*)Items; + Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items); } mir_free(email); } -- cgit v1.2.3