summaryrefslogtreecommitdiff
path: root/protocols/AimOscar
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-24 15:38:17 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-24 15:38:17 +0300
commite84bafdd3f3d2eb67e10a9bd3fbe600748962b6f (patch)
tree1b563061e473ef8bbe62b86821da21c319cca2c5 /protocols/AimOscar
parentaa55162ab85df5aa0ac6b87711bfee222b3222dd (diff)
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
Diffstat (limited to 'protocols/AimOscar')
-rw-r--r--protocols/AimOscar/src/chat.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index bd7a371619..24df22d77b 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -162,16 +162,15 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam)
int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{
GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
-
- if (gcmi == NULL || _stricmp(gcmi->pszModule, m_szModuleName)) return 0;
+ if (mir_strcmp(gcmi->pszModule, m_szModuleName))
+ return 0;
if (gcmi->Type == MENU_ON_LOG) {
static const struct gc_item Items[] = {
{ TranslateT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ TranslateT("&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* sn = mir_u2a(gcmi->pszUID);
@@ -182,16 +181,14 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ L"", 100, MENU_SEPARATOR, FALSE },
{ TranslateT("&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 const struct gc_item Items[] = {
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
{ TranslateT("User &history"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = _countof(Items);
- gcmi->Item = (gc_item*)Items;
+ Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items);
}
mir_free(sn);
}